prompt
stringlengths
94
42.6k
completion
stringlengths
6
120
api
stringlengths
14
68
# -*- 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...
tensor(data)
megengine.tensor
# -*- 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...
tensor(data)
megengine.tensor
# -*- 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...
tensor(data1)
megengine.tensor
# -*- 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...
tensor(data2)
megengine.tensor
# -*- 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...
tensor(data1)
megengine.tensor
# -*- 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...
tensor(data2)
megengine.tensor
# -*- 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...
tensor(data1)
megengine.tensor
# -*- 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...
tensor(data2)
megengine.tensor
# -*- 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...
jit.trace(symbolic=is_symbolic)
megengine.jit.trace
# -*- 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...
tensor(data)
megengine.tensor
# -*- 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...
jit.trace(symbolic=symbolic)
megengine.jit.trace
# -*- 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...
tensor(input, dtype=dtype)
megengine.tensor
# -*- 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...
mge.get_logger(__name__)
megengine.get_logger
# -*- 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...
jit.trace(symbolic=True)
megengine.jit.trace
# -*- 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...
data.dataset.ImageNet(args.data, train=False)
megengine.data.dataset.ImageNet
# -*- 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...
mge.get_device_count("gpu")
megengine.get_device_count
# -*- 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...
mge.set_default_device("cpux")
megengine.set_default_device
# -*- 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...
Q.quantize_qat(model, Q.ema_fakequant_qconfig)
megengine.quantization.quantize_qat
# -*- 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...
mge.load(args.checkpoint)
megengine.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...
Q.quantize(model)
megengine.quantization.quantize
# -*- 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...
F.cross_entropy_with_softmax(logits, label, label_smooth=0.1)
megengine.functional.cross_entropy_with_softmax
# -*- 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...
F.accuracy(logits, label, (1, 5))
megengine.functional.accuracy
# -*- 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...
dist.is_distributed()
megengine.distributed.is_distributed
# -*- 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...
dist.all_reduce_sum(loss, "valid_loss")
megengine.distributed.all_reduce_sum
# -*- 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...
dist.get_world_size()
megengine.distributed.get_world_size
# -*- 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...
dist.all_reduce_sum(acc1, "valid_acc1")
megengine.distributed.all_reduce_sum
# -*- 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...
dist.get_world_size()
megengine.distributed.get_world_size
# -*- 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...
dist.all_reduce_sum(acc5, "valid_acc5")
megengine.distributed.all_reduce_sum
# -*- 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...
dist.get_world_size()
megengine.distributed.get_world_size
# -*- 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...
dist.get_rank()
megengine.distributed.get_rank
# -*- 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...
T.Resize(256)
megengine.data.transform.Resize
# -*- 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...
T.CenterCrop(224)
megengine.data.transform.CenterCrop
# -*- 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...
T.Normalize(mean=128)
megengine.data.transform.Normalize
# -*- 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...
T.ToMode("CHW")
megengine.data.transform.ToMode
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import argparse import importlib import json import multiprocessing as mp import os import pathlib import sys import megengine as mge import megengine.distributed as dist from basecore.config import ConfigDict from loguru import logger ...
mge.device.get_device_count("gpu")
megengine.device.get_device_count
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import argparse import importlib import json import multiprocessing as mp import os import pathlib import sys import megengine as mge import megengine.distributed as dist from basecore.config import ConfigDict from loguru import logger ...
mge.functional.debug_param.set_execution_strategy("PROFILE")
megengine.functional.debug_param.set_execution_strategy
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import argparse import importlib import json import multiprocessing as mp import os import pathlib import sys import megengine as mge import megengine.distributed as dist from basecore.config import ConfigDict from loguru import logger ...
dist.launcher(worker)
megengine.distributed.launcher
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import argparse import importlib import json import multiprocessing as mp import os import pathlib import sys import megengine as mge import megengine.distributed as dist from basecore.config import ConfigDict from loguru import logger ...
dist.get_rank()
megengine.distributed.get_rank
import logging import os import pickle import numpy as np import h5py from megengine.data import DataLoader from megengine.data.dataset import Dataset from megengine.data.sampler import RandomSampler, SequentialSampler import megengine.distributed as dist from dataset.transformations import fetch_transform from comm...
RandomSampler(train_ds, batch_size=params.train_batch_size, drop_last=True)
megengine.data.sampler.RandomSampler
import logging import os import pickle import numpy as np import h5py from megengine.data import DataLoader from megengine.data.dataset import Dataset from megengine.data.sampler import RandomSampler, SequentialSampler import megengine.distributed as dist from dataset.transformations import fetch_transform from comm...
DataLoader(train_ds, train_sampler, num_workers=params.num_workers)
megengine.data.DataLoader
import logging import os import pickle import numpy as np import h5py from megengine.data import DataLoader from megengine.data.dataset import Dataset from megengine.data.sampler import RandomSampler, SequentialSampler import megengine.distributed as dist from dataset.transformations import fetch_transform from comm...
dist.get_rank()
megengine.distributed.get_rank
import logging import os import pickle import numpy as np import h5py from megengine.data import DataLoader from megengine.data.dataset import Dataset from megengine.data.sampler import RandomSampler, SequentialSampler import megengine.distributed as dist from dataset.transformations import fetch_transform from comm...
dist.get_rank()
megengine.distributed.get_rank
import logging import os import pickle import numpy as np import h5py from megengine.data import DataLoader from megengine.data.dataset import Dataset from megengine.data.sampler import RandomSampler, SequentialSampler import megengine.distributed as dist from dataset.transformations import fetch_transform from comm...
SequentialSampler(val_ds, batch_size=params.eval_batch_size)
megengine.data.sampler.SequentialSampler
import logging import os import pickle import numpy as np import h5py from megengine.data import DataLoader from megengine.data.dataset import Dataset from megengine.data.sampler import RandomSampler, SequentialSampler import megengine.distributed as dist from dataset.transformations import fetch_transform from comm...
DataLoader(val_ds, val_sampler, num_workers=params.num_workers)
megengine.data.DataLoader
import logging import os import pickle import numpy as np import h5py from megengine.data import DataLoader from megengine.data.dataset import Dataset from megengine.data.sampler import RandomSampler, SequentialSampler import megengine.distributed as dist from dataset.transformations import fetch_transform from comm...
SequentialSampler(test_ds, batch_size=params.eval_batch_size)
megengine.data.sampler.SequentialSampler
import logging import os import pickle import numpy as np import h5py from megengine.data import DataLoader from megengine.data.dataset import Dataset from megengine.data.sampler import RandomSampler, SequentialSampler import megengine.distributed as dist from dataset.transformations import fetch_transform from comm...
DataLoader(test_ds, test_sampler, num_workers=params.num_workers)
megengine.data.DataLoader
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.Linear(256*7*7, 1024)
megengine.module.Linear
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.Linear(1024, 1024)
megengine.module.Linear
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.ReLU()
megengine.module.ReLU
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.Linear(1024, 5 * self.n)
megengine.module.Linear
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.Linear(1024, 5 * self.n)
megengine.module.Linear
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.concat([fc3, pred_boxes], axis=1)
megengine.functional.concat
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.flatten(poo5, start_axis=1)
megengine.functional.flatten
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.stack([loss0, loss1], axis=1)
megengine.functional.stack
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.max_pool2d(results[0], kernel_size=1, stride=2, padding=0)
megengine.functional.max_pool2d
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.Linear(1054, 1024)
megengine.module.Linear
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.Linear(1024, 5 * self.n)
megengine.module.Linear
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.Linear(1024, 5 * self.n)
megengine.module.Linear
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.init.normal_(l.weight, std=0.01)
megengine.module.init.normal_
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.init.fill_(l.bias, 0)
megengine.module.init.fill_
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.softmax(scores, axis=1)
megengine.functional.softmax
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.concat([offsets, cls_scores], axis=2)
megengine.functional.concat
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.softmax(cls_scores, axis=1)
megengine.functional.softmax
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.init.msra_normal_(lateral_conv.weight, mode="fan_in")
megengine.module.init.msra_normal_
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.init.msra_normal_(output_conv.weight, mode="fan_in")
megengine.module.init.msra_normal_
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
mge.tensor(mean)
megengine.tensor
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
mge.tensor(std)
megengine.tensor
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.init.normal_(l.weight, std=0.01)
megengine.module.init.normal_
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.init.fill_(l.bias, 0)
megengine.module.init.fill_
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.stack([a, b], axis=1)
megengine.functional.stack
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.stack([a, b], axis=1)
megengine.functional.stack
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.init.fill_(lateral_conv.bias, 0)
megengine.module.init.fill_
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
M.init.fill_(output_conv.bias, 0)
megengine.module.init.fill_
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.expand_dims(pred_boxes, axis=1)
megengine.functional.expand_dims
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.expand_dims(fc2, axis=1)
megengine.functional.expand_dims
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.expand_dims(cls_prob, axis=2)
megengine.functional.expand_dims
import numpy as np import megengine as mge import megengine.functional as F import megengine.module as M from config import config from backbone.resnet50 import ResNet50 from module.rpn import RPN from layers.roi_pool import roi_pool from det_opr.bbox_opr import bbox_transform_inv_opr, restore_bbox from det_opr.fpn_roi...
F.expand_dims(rcnn_rois[:, 1:5], axis=1)
megengine.functional.expand_dims
# -*- 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...
AvgPool2d(kernel_size, stride=stride, padding=padding, mode="average")
megengine.module.AvgPool2d
# -*- 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...
tensor(inp)
megengine.tensor
# -*- 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...
assertTensorClose(a, b)
megengine.test.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...
tensor(data, device="xpux", dtype=np.int32)
megengine.core.tensor
# Copyright (c) Megvii, Inc. and its affiliates. import math import megengine.functional as F import megengine.module as M class LogitsFullyConnected(M.Module): """single fully connected layer, mapping embedding to logits with normalized weight """ def __init__(self, num_class, feature_dim): su...
M.Linear(feature_dim, num_class, bias=False)
megengine.module.Linear
# Copyright (c) Megvii, Inc. and its affiliates. import math import megengine.functional as F import megengine.module as M class LogitsFullyConnected(M.Module): """single fully connected layer, mapping embedding to logits with normalized weight """ def __init__(self, num_class, feature_dim): su...
F.normalize(self.weight, axis=1)
megengine.functional.normalize
# Copyright (c) Megvii, Inc. and its affiliates. import math import megengine.functional as F import megengine.module as M class LogitsFullyConnected(M.Module): """single fully connected layer, mapping embedding to logits with normalized weight """ def __init__(self, num_class, feature_dim): su...
F.one_hot(target, self.num_class)
megengine.functional.one_hot
# Copyright (c) Megvii, Inc. and its affiliates. import math import megengine.functional as F import megengine.module as M class LogitsFullyConnected(M.Module): """single fully connected layer, mapping embedding to logits with normalized weight """ def __init__(self, num_class, feature_dim): su...
F.loss.cross_entropy(logits, target)
megengine.functional.loss.cross_entropy
# Copyright (c) Megvii, Inc. and its affiliates. import math import megengine.functional as F import megengine.module as M class LogitsFullyConnected(M.Module): """single fully connected layer, mapping embedding to logits with normalized weight """ def __init__(self, num_class, feature_dim): su...
F.topk_accuracy(origin_logits, target, topk=1)
megengine.functional.topk_accuracy
# Copyright (c) Megvii, Inc. and its affiliates. import math import megengine.functional as F import megengine.module as M class LogitsFullyConnected(M.Module): """single fully connected layer, mapping embedding to logits with normalized weight """ def __init__(self, num_class, feature_dim): su...
F.where(origin_logits >= 0, large_margined_logit, small_margined_logit)
megengine.functional.where
# Copyright (c) Megvii, Inc. and its affiliates. import math import megengine.functional as F import megengine.module as M class LogitsFullyConnected(M.Module): """single fully connected layer, mapping embedding to logits with normalized weight """ def __init__(self, num_class, feature_dim): su...
F.where(one_hot_target, margined_logit, origin_logits)
megengine.functional.where
# Copyright (c) Megvii, Inc. and its affiliates. import math import megengine.functional as F import megengine.module as M class LogitsFullyConnected(M.Module): """single fully connected layer, mapping embedding to logits with normalized weight """ def __init__(self, num_class, feature_dim): su...
F.loss.cross_entropy(logits, target)
megengine.functional.loss.cross_entropy
# Copyright (c) Megvii, Inc. and its affiliates. import math import megengine.functional as F import megengine.module as M class LogitsFullyConnected(M.Module): """single fully connected layer, mapping embedding to logits with normalized weight """ def __init__(self, num_class, feature_dim): su...
F.topk_accuracy(origin_logits, target, topk=1)
megengine.functional.topk_accuracy
# Copyright (c) Megvii, Inc. and its affiliates. import math import megengine.functional as F import megengine.module as M class LogitsFullyConnected(M.Module): """single fully connected layer, mapping embedding to logits with normalized weight """ def __init__(self, num_class, feature_dim): su...
F.one_hot(target, self.num_class)
megengine.functional.one_hot
# Copyright (c) Megvii, Inc. and its affiliates. import math import megengine.functional as F import megengine.module as M class LogitsFullyConnected(M.Module): """single fully connected layer, mapping embedding to logits with normalized weight """ def __init__(self, num_class, feature_dim): su...
F.acos(origin_logits)
megengine.functional.acos
# -*- 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...
mge.tensor(x, dtype="float32")
megengine.tensor
# -*- 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...
mge.tensor(s, dtype="float32")
megengine.tensor
# -*- 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...
mge.tensor(g_y, dtype="float32")
megengine.tensor
# -*- 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...
tqt_forward(-127, 127, x, s)
megengine.quantization.utils.tqt_forward
# -*- 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...
tensor([1.0], dtype=np.float32)
megengine.tensor
# -*- 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...
tensor([4.0], dtype=np.float32)
megengine.tensor
# -*- 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...
tensor(inp_data, dtype=np.float32)
megengine.tensor
# -*- 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...
tensor(inp_data, dtype=np.float32)
megengine.tensor