code
stringlengths
208
42.9k
apis
list
extract_api
stringlengths
129
69.9k
# Some code is modified from pytorch # pytorch is licensed under BSD # From PyTorch: # Copyright (c) 2016- Facebook, Inc (<NAME>) # Copyright (c) 2014- Facebook, Inc (<NAME>) # Copyright (c) 2011-2014 Idiap Research Institute (<NAME>) # Copyright (c) 2012-2014 Deepmind Technologies (K...
[ "megengine.functional.nn.linear", "megengine.functional.floor_div", "megengine.functional.zeros", "megengine.module.init.zeros_", "megengine.functional.matmul", "megengine.functional.softmax", "megengine.functional.expand_dims", "megengine.functional.transpose", "megengine.functional.dropout", "me...
[((9573, 9596), 'megengine.functional.linear', 'F.linear', (['query', '_w', '_b'], {}), '(query, _w, _b)\n', (9581, 9596), True, 'from megengine import functional as F\n'), ((9843, 9864), 'megengine.functional.linear', 'F.linear', (['key', '_w', '_b'], {}), '(key, _w, _b)\n', (9851, 9864), True, 'from megengine import ...
import megengine as mge import megengine.module as nn import megengine.functional as F from model.module import Encoder, Fusion, Decoder, Regression from common import se3, quaternion import math class OMNet(nn.Module): def __init__(self, params): super(OMNet, self).__init__() self.num_iter = para...
[ "megengine.functional.repeat", "megengine.module.init.calculate_fan_in_and_fan_out", "megengine.functional.ones", "megengine.functional.expand_dims", "megengine.functional.concat", "megengine.functional.max", "megengine.functional.min", "megengine.functional.argmax", "megengine.tensor", "megengine...
[((1424, 1467), 'common.se3.mge_transform', 'se3.mge_transform', (['transform_gt', 'points_src'], {}), '(transform_gt, points_src)\n', (1441, 1467), False, 'from common import se3, quaternion\n'), ((1489, 1522), 'megengine.functional.expand_dims', 'F.expand_dims', (['points_src'], {'axis': '(2)'}), '(points_src, axis=2...
#! /usr/bin/env python3 # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
[ "megengine.utils.module_stats.sum_op_stats", "megengine.logger.get_logger", "megengine.utils.module_stats.print_param_stats", "megengine.utils.module_stats.sum_param_stats", "megengine.utils.module_stats.get_param_stats", "megengine.utils.module_stats.print_op_stats", "megengine.utils.network.Network.lo...
[((1019, 1039), 'megengine.logger.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (1029, 1039), False, 'from megengine.logger import _imperative_rt_logger, get_logger, set_mgb_log_level\n'), ((3458, 3482), 'megengine.utils.module_stats.enable_receptive_field', 'enable_receptive_field', ([], {}), '()\n', ...
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megv...
[ "megengine.functional.maximum", "megengine.functional.sigmoid", "megengine.core.tensor_factory.zeros", "megengine.functional.log", "megengine.functional.abs" ]
[((1132, 1154), 'megengine.functional.sigmoid', 'F.sigmoid', (['output_fake'], {}), '(output_fake)\n', (1141, 1154), True, 'import megengine.functional as F\n'), ((2374, 2406), 'megengine.core.tensor_factory.zeros', 'zeros', (['(output_fake.shape[0], 1)'], {}), '((output_fake.shape[0], 1))\n', (2379, 2406), False, 'fro...
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
[ "megengine.test.assertTensorClose", "megengine.core.Graph", "megengine.functional.softmax" ]
[((853, 858), 'helpers.MLP', 'MLP', ([], {}), '()\n', (856, 858), False, 'from helpers import MLP\n'), ((952, 968), 'megengine.functional.softmax', 'F.softmax', (['pred0'], {}), '(pred0)\n', (961, 968), True, 'import megengine.functional as F\n'), ((1395, 1430), 'megengine.test.assertTensorClose', 'assertTensorClose', ...
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
[ "megengine.data.sampler.RandomSampler", "megengine.data.dataloader.DataLoader", "megengine.data.dataset.ArrayDataset" ]
[((767, 838), 'numpy.random.randint', 'np.random.randint', (['(0)', '(255)'], {'size': '(sample_num, 1, 32, 32)', 'dtype': 'np.uint8'}), '(0, 255, size=(sample_num, 1, 32, 32), dtype=np.uint8)\n', (784, 838), True, 'import numpy as np\n'), ((851, 906), 'numpy.random.randint', 'np.random.randint', (['(0)', '(10)'], {'si...
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY ...
[ "megengine.core._imperative_rt.core2._get_amp_low_prec_dtype", "megengine.core._imperative_rt.core2._get_amp_high_prec_dtype", "megengine.device.get_device_count", "megengine.core._trace_option.use_symbolic_shape", "megengine.core._imperative_rt.core2._get_amp_dtype_autocast", "megengine.core.get_option",...
[((873, 896), 'megengine.device.get_device_count', 'get_device_count', (['"""gpu"""'], {}), "('gpu')\n", (889, 896), False, 'from megengine.device import get_device_count\n'), ((900, 928), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (914, 928), False, 'import pytest\n'), ((1213,...
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
[ "megengine.autodiff.GradManager", "megengine.module.Conv2d", "megengine.module.AvgPool2d", "megengine.functional.nn.cross_entropy", "megengine.functional.debug_param.set_conv_execution_strategy", "megengine.distributed.make_allreduce_cb", "megengine.serialization.save", "megengine.is_cuda_available", ...
[((5688, 5715), 'pytest.mark.require_ngpu', 'pytest.mark.require_ngpu', (['(2)'], {}), '(2)\n', (5712, 5715), False, 'import pytest\n'), ((1564, 1587), 'megengine.is_cuda_available', 'mge.is_cuda_available', ([], {}), '()\n', (1585, 1587), True, 'import megengine as mge\n'), ((3294, 3314), 'megengine.load', 'mge.load',...
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
[ "megengine._internal.cgtools.get_dep_vars", "megengine.tensor", "megengine.module.ReLU", "megengine._internal.cgtools.get_inputs", "megengine.module.BatchNorm2d", "megengine._internal.load_comp_graph_from_file", "megengine.module.Conv2d", "megengine._internal.opr.assert_equal", "megengine.jit.trace"...
[((770, 788), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {}), '()\n', (786, 788), False, 'import tempfile\n'), ((927, 963), 'megengine._internal.load_comp_graph_from_file', 'mgb.load_comp_graph_from_file', (['fpath'], {}), '(fpath)\n', (956, 963), True, 'import megengine._internal as mgb\n'), ((977, 1029), 'megengine...
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
[ "megengine.data.dataset.ImageNet", "megengine.logger.get_logger", "megengine.functional.nn.cross_entropy", "megengine.distributed.init_process_group", "megengine.functional.topk_accuracy", "megengine.data.SequentialSampler", "megengine.tensor", "megengine.distributed.Server", "megengine.functional.d...
[((653, 682), 'megengine.logger.get_logger', 'megengine.logger.get_logger', ([], {}), '()\n', (680, 682), False, 'import megengine\n'), ((710, 776), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""MegEngine ImageNet Training"""'}), "(description='MegEngine ImageNet Training')\n", (733, 77...
import math import numpy import megengine as mge import megengine.module as M import megengine.functional as F from .layer_norm import LayerNorm class DecoderLayer(M.Module): """Single decoder layer module.""" def __init__( self, size, self_attn, src_attn, feed_forwar...
[ "megengine.module.dropout.Dropout", "megengine.functional.concat" ]
[((744, 775), 'megengine.module.dropout.Dropout', 'M.dropout.Dropout', (['dropout_rate'], {}), '(dropout_rate)\n', (761, 775), True, 'import megengine.module as M\n'), ((2705, 2733), 'megengine.functional.concat', 'F.concat', (['[cache, x]'], {'axis': '(1)'}), '([cache, x], axis=1)\n', (2713, 2733), True, 'import megen...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # Copyright (c) Megvii, Inc. and its affiliates. import argparse from loguru import logger import multiprocessing as mp import megengine as mge import megengine.distributed as dist from yolox.core import Trainer from yolox.exp import get_exp from yolox.utils import confi...
[ "megengine.dtr.enable", "megengine.distributed.helper.get_device_count_by_fork", "megengine.distributed.launcher", "megengine.core._imperative_rt.core2.config_async_level" ]
[((364, 409), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""YOLOX train parser"""'], {}), "('YOLOX train parser')\n", (387, 409), False, 'import argparse\n'), ((1837, 1853), 'yolox.utils.configure_nccl', 'configure_nccl', ([], {}), '()\n', (1851, 1853), False, 'from yolox.utils import configure_nccl\n'), ...
import numpy as np import megengine.functional as F from common import se3, so3 def compute_losses(endpoints, params): loss = {} # compute losses if params.loss_type == "finet": num_iter = len(endpoints["all_pose_pair"]) triplet_loss = {} for i in range(num_iter): # reg...
[ "megengine.functional.nn.l1_loss", "megengine.functional.clip", "megengine.functional.nn.square_loss", "megengine.functional.mean", "megengine.functional.norm", "megengine.functional.abs", "megengine.functional.concat" ]
[((3616, 3672), 'megengine.functional.mean', 'F.mean', (['((r_gt_euler_deg - r_pred_euler_deg) ** 2)'], {'axis': '(1)'}), '((r_gt_euler_deg - r_pred_euler_deg) ** 2, axis=1)\n', (3622, 3672), True, 'import megengine.functional as F\n'), ((3752, 3788), 'megengine.functional.mean', 'F.mean', (['((t_gt - t_pred) ** 2)'], ...
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
[ "megengine.tensor", "megengine.distributed.functional.reduce_scatter_sum", "megengine.distributed.get_rank", "megengine.distributed.functional.all_gather", "megengine.distributed.functional.scatter", "megengine.distributed.functional.all_to_all", "megengine.jit.trace", "megengine.distributed.launcher"...
[((666, 693), 'pytest.mark.require_ngpu', 'pytest.mark.require_ngpu', (['(2)'], {}), '(2)\n', (690, 693), False, 'import pytest\n'), ((695, 783), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""shape"""', '[(2, 3), (8, 10), (99, 77), (2, 2, 2, 2)]'], {'ids': 'str'}), "('shape', [(2, 3), (8, 10), (99, 77), (...
import numpy as np import megengine as mge import megengine.functional as F from common import se3, so3 def compute_losses(data_batch, endpoints, params): loss = {} # compute losses if params.loss_type == "omnet": num_iter = len(endpoints["all_pose_pair"]) for i in range(num_iter): ...
[ "megengine.tensor", "megengine.functional.nn.l1_loss", "megengine.functional.clip", "megengine.functional.nn.square_loss", "megengine.functional.mean", "megengine.functional.norm", "megengine.functional.abs", "megengine.functional.concat" ]
[((2027, 2083), 'megengine.functional.mean', 'F.mean', (['((r_gt_euler_deg - r_pred_euler_deg) ** 2)'], {'axis': '(1)'}), '((r_gt_euler_deg - r_pred_euler_deg) ** 2, axis=1)\n', (2033, 2083), True, 'import megengine.functional as F\n'), ((2163, 2199), 'megengine.functional.mean', 'F.mean', (['((t_gt - t_pred) ** 2)'], ...
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY ...
[ "megengine.core.tensor.dtype.get_scale", "megengine.quantization.quantize.quantize_qat", "megengine.tensor", "megengine.core.tensor.dtype.get_zero_point", "megengine.core.tensor.dtype.qint8", "megengine.core.tensor.dtype.quint8", "megengine.module.quant_dequant.QuantStub", "megengine.quantization.util...
[((1033, 1050), 'megengine.quantization.quantize.quantize_qat', 'quantize_qat', (['net'], {}), '(net)\n', (1045, 1050), False, 'from megengine.quantization.quantize import quantize_qat\n'), ((2023, 2034), 'test.utils.LinearOpr', 'LinearOpr', ([], {}), '()\n', (2032, 2034), False, 'from test.utils import LinearOpr\n'), ...