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-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...
mge.tensor(image, 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(label, dtype="int32")
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...
dist.functional.all_reduce_sum(loss)
megengine.distributed.functional.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.functional.all_reduce_sum(acc1)
megengine.distributed.functional.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.functional.all_reduce_sum(acc5)
megengine.distributed.functional.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.functional.all_reduce_sum(loss)
megengine.distributed.functional.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.functional.all_reduce_sum(acc1)
megengine.distributed.functional.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.functional.all_reduce_sum(acc5)
megengine.distributed.functional.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
# 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 ...
M.Conv2d(3, 64, kernel_size=7, stride=2, padding=3, bias=False)
megengine.module.Conv2d
# 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 ...
M.BatchNorm2d(64)
megengine.module.BatchNorm2d
# 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 ...
M.AvgPool2d(kernel_size=5, stride=5, padding=0)
megengine.module.AvgPool2d
# 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 ...
M.Linear(64, 10)
megengine.module.Linear
# 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 ...
F.relu(x)
megengine.functional.relu
# 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 ...
F.avg_pool2d(x, 22)
megengine.functional.avg_pool2d
# 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 ...
F.flatten(x, 1)
megengine.functional.flatten
# 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 ...
ad.GradManager()
megengine.autodiff.GradManager
# 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 ...
ad.GradManager()
megengine.autodiff.GradManager
# 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 ...
mge.tensor(x)
megengine.tensor
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 =
M.Conv2d(1, 6, 5)
megengine.module.Conv2d
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.ReLU()
megengine.module.ReLU
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.MaxPool2d(2, 2)
megengine.module.MaxPool2d
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.Conv2d(6, 16, 5)
megengine.module.Conv2d
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.ReLU()
megengine.module.ReLU
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.MaxPool2d(2, 2)
megengine.module.MaxPool2d
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.Linear(16 * 5 * 5, 120)
megengine.module.Linear
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.ReLU()
megengine.module.ReLU
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.Linear(120, 84)
megengine.module.Linear
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.ReLU()
megengine.module.ReLU
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.Linear(84, 10)
megengine.module.Linear
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
F.flatten(x, 1)
megengine.functional.flatten
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.Conv2d(1, 6, 5)
megengine.module.Conv2d
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.ReLU()
megengine.module.ReLU
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.MaxPool2d(2, 2)
megengine.module.MaxPool2d
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.Conv2d(6, 16, 5)
megengine.module.Conv2d
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.ReLU()
megengine.module.ReLU
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.MaxPool2d(2, 2)
megengine.module.MaxPool2d
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.Linear(16 * 53 * 53, 120)
megengine.module.Linear
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.ReLU()
megengine.module.ReLU
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.Linear(120, 84)
megengine.module.Linear
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.ReLU()
megengine.module.ReLU
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
M.Linear(84, 10)
megengine.module.Linear
# -*- coding: utf-8 -*- import megengine.module as M import megengine.functional as F class LeNet32x32(M.Module): def __init__(self): super().__init__() # single channel image, two 5x5 Conv + ReLU + Pool # Conv2d(1, 6, kernel_size=(5, 5)) self.conv1 = M.Conv2d(1, 6, 5) self....
F.flatten(x, 1)
megengine.functional.flatten
import megengine as mge import megengine.functional as F from megengine.core import Tensor def softmax_loss(pred, label, ignore_label=-1): max_pred = F.zero_grad(pred.max(axis=1, keepdims=True)) pred -= max_pred log_prob = pred - F.log(F.exp(pred).sum(axis=1, keepdims=True)) mask = 1 - F.equal(label, i...
F.abs(pred - target)
megengine.functional.abs
import megengine as mge import megengine.functional as F from megengine.core import Tensor def softmax_loss(pred, label, ignore_label=-1): max_pred = F.zero_grad(pred.max(axis=1, keepdims=True)) pred -= max_pred log_prob = pred - F.log(F.exp(pred).sum(axis=1, keepdims=True)) mask = 1 -
F.equal(label, ignore_label)
megengine.functional.equal
import megengine as mge import megengine.functional as F from megengine.core import Tensor def softmax_loss(pred, label, ignore_label=-1): max_pred = F.zero_grad(pred.max(axis=1, keepdims=True)) pred -= max_pred log_prob = pred - F.log(F.exp(pred).sum(axis=1, keepdims=True)) mask = 1 - F.equal(label, i...
F.indexing_one_hot(log_prob, vlabel, 1)
megengine.functional.indexing_one_hot
import megengine as mge import megengine.functional as F from megengine.core import Tensor def softmax_loss(pred, label, ignore_label=-1): max_pred = F.zero_grad(pred.max(axis=1, keepdims=True)) pred -= max_pred log_prob = pred - F.log(
F.exp(pred)
megengine.functional.exp
# -*- 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_Function(-127, 127)
megengine.quantization.fake_quant.TQT_Function
# -*- 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(a_np)
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(b_np)
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([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
# -*- 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...
fake_quant_tensor(x, qmin, qmax, q_dict)
megengine.quantization.utils.fake_quant_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...
make_shape_tuple(x.grad.shape)
megengine.core.tensor.utils.make_shape_tuple
# -*- 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...
make_shape_tuple(x1.grad.shape)
megengine.core.tensor.utils.make_shape_tuple
# -*- 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...
fake_quant_tensor(inp, qmin, qmax, q_dict)
megengine.quantization.utils.fake_quant_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...
Grad()
megengine.core.autodiff.grad.Grad
# -*- 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...
Grad()
megengine.core.autodiff.grad.Grad
# -*- coding: utf-8 -*- # This repo 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...
F.concat(box_logits_list, axis=1)
megengine.functional.concat
# -*- coding: utf-8 -*- # This repo 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...
F.concat(box_offsets_list, axis=1)
megengine.functional.concat
# -*- coding: utf-8 -*- # This repo 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...
F.concat(anchors_list, axis=0)
megengine.functional.concat
# -*- coding: utf-8 -*- # This repo 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...
F.sigmoid(pred_logits)
megengine.functional.sigmoid
# -*- coding: utf-8 -*- # This repo 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...
F.stack(box_prob_list, axis=0)
megengine.functional.stack
# -*- coding: utf-8 -*- # This repo 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...
F.broadcast_to(gather_idx, (num_gt, bucket_size))
megengine.functional.broadcast_to
# -*- coding: utf-8 -*- # This repo 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...
F.indexing_one_hot(gather_src, gather_idx, axis=2)
megengine.functional.indexing_one_hot
# -*- coding: utf-8 -*- # This repo 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...
F.exp(-reg_loss)
megengine.functional.exp
# -*- coding: utf-8 -*- # This repo 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...
F.maximum(num_foreground, 1)
megengine.functional.maximum
# -*- coding: utf-8 -*- # This repo 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...
F.maximum(num_foreground * bucket_size, 1)
megengine.functional.maximum
# -*- coding: utf-8 -*- # This repo 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...
F.sigmoid(all_level_box_logits)
megengine.functional.sigmoid
# -*- coding: utf-8 -*- # This repo 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...
F.cond_take(gt_pred_prob != 0, gt_pred_prob)
megengine.functional.cond_take
# -*- coding: utf-8 -*- # This repo 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...
F.zeros(pred_logits.shape[1:])
megengine.functional.zeros
# -*- coding: utf-8 -*- # This repo 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...
F.concat(positive_losses)
megengine.functional.concat
# -*- coding: utf-8 -*- # This repo 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...
F.expand_dims(boxes_info[:, :4], axis=1)
megengine.functional.expand_dims
# -*- 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...
hub.pretrained( "https://data.megengine.org.cn/models/weights/simplebaseline50_256x192_0_255_71_2.pkl" )
megengine.hub.pretrained
# -*- 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...
hub.pretrained( "https://data.megengine.org.cn/models/weights/simplebaseline101_256x192_0_255_72_2.pkl" )
megengine.hub.pretrained
# -*- 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...
hub.pretrained( "https://data.megengine.org.cn/models/weights/simplebaseline152_256x192_0_255_72_4.pkl" )
megengine.hub.pretrained
# -*- 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...
M.Sequential(*_body)
megengine.module.Sequential
# -*- 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...
M.Conv2d(cfg.deconv_channels[-1], cfg.keypoint_num, 3, 1, 1)
megengine.module.Conv2d
# -*- 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.square_loss(out * valid, label * valid)
megengine.functional.square_loss
# -*- 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...
M.init.normal_(self.last_layer.weight, std=0.001)
megengine.module.init.normal_
# -*- 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...
M.init.zeros_(self.last_layer.bias)
megengine.module.init.zeros_
# -*- 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(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(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(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...
M.ConvTranspose2d(nf1, nf2s[i], kernel, 2, padding, bias=bias)
megengine.module.ConvTranspose2d
# -*- 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...
M.ReLU()
megengine.module.ReLU