prompt
stringlengths
94
42.6k
completion
stringlengths
6
120
api
stringlengths
14
68
from collections import OrderedDict import numpy as np import megengine.functional as F import megengine.module as M from megengine import Tensor from megengine.core._imperative_rt.core2 import apply from megengine.core.ops import builtin from megengine.module import Module from megengine.traced_module import TracedM...
Tensor(1)
megengine.Tensor
from collections import OrderedDict import numpy as np import megengine.functional as F import megengine.module as M from megengine import Tensor from megengine.core._imperative_rt.core2 import apply from megengine.core.ops import builtin from megengine.module import Module from megengine.traced_module import TracedM...
Tensor(2)
megengine.Tensor
from collections import OrderedDict import numpy as np import megengine.functional as F import megengine.module as M from megengine import Tensor from megengine.core._imperative_rt.core2 import apply from megengine.core.ops import builtin from megengine.module import Module from megengine.traced_module import TracedM...
M.Elemwise("ADD")
megengine.module.Elemwise
from collections import OrderedDict import numpy as np import megengine.functional as F import megengine.module as M from megengine import Tensor from megengine.core._imperative_rt.core2 import apply from megengine.core.ops import builtin from megengine.module import Module from megengine.traced_module import TracedM...
M.Elemwise("ADD")
megengine.module.Elemwise
from collections import OrderedDict import numpy as np import megengine.functional as F import megengine.module as M from megengine import Tensor from megengine.core._imperative_rt.core2 import apply from megengine.core.ops import builtin from megengine.module import Module from megengine.traced_module import TracedM...
M.Elemwise("RELU")
megengine.module.Elemwise
from collections import OrderedDict import numpy as np import megengine.functional as F import megengine.module as M from megengine import Tensor from megengine.core._imperative_rt.core2 import apply from megengine.core.ops import builtin from megengine.module import Module from megengine.traced_module import TracedM...
M.Elemwise("RELU")
megengine.module.Elemwise
from collections import OrderedDict import numpy as np import megengine.functional as F import megengine.module as M from megengine import Tensor from megengine.core._imperative_rt.core2 import apply from megengine.core.ops import builtin from megengine.module import Module from megengine.traced_module import TracedM...
builtin.Elemwise(mode="ADD")
megengine.core.ops.builtin.Elemwise
from collections import OrderedDict import numpy as np import megengine.functional as F import megengine.module as M from megengine import Tensor from megengine.core._imperative_rt.core2 import apply from megengine.core.ops import builtin from megengine.module import Module from megengine.traced_module import TracedM...
Tensor(1)
megengine.Tensor
from collections import OrderedDict import numpy as np import megengine.functional as F import megengine.module as M from megengine import Tensor from megengine.core._imperative_rt.core2 import apply from megengine.core.ops import builtin from megengine.module import Module from megengine.traced_module import TracedM...
Tensor([1, 2])
megengine.Tensor
from collections import OrderedDict import numpy as np import megengine.functional as F import megengine.module as M from megengine import Tensor from megengine.core._imperative_rt.core2 import apply from megengine.core.ops import builtin from megengine.module import Module from megengine.traced_module import TracedM...
M.Elemwise("ADD")
megengine.module.Elemwise
from collections import OrderedDict import numpy as np import megengine.functional as F import megengine.module as M from megengine import Tensor from megengine.core._imperative_rt.core2 import apply from megengine.core.ops import builtin from megengine.module import Module from megengine.traced_module import TracedM...
M.Elemwise("ADD")
megengine.module.Elemwise
# -*- 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...
mgb.opr.matrix_mul(inp, weight, transposeB=True)
megengine._internal.opr.matrix_mul
# -*- 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...
mgb.opr.mark_no_broadcast_elemwise(inp)
megengine._internal.opr.mark_no_broadcast_elemwise
# -*- 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...
mgb.make_immutable(value=0, comp_node=comp_node, comp_graph=comp_graph)
megengine._internal.make_immutable
# -*- 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...
mgb.make_immutable(value=1, comp_node=comp_node, comp_graph=comp_graph)
megengine._internal.make_immutable
# -*- 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...
mgb.opr.eye((n, m), dtype=dtype, comp_node=device, comp_graph=comp_graph)
megengine._internal.opr.eye
# -*- 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...
mgb.opr.matrix_mul(inp1, inp2)
megengine._internal.opr.matrix_mul
# -*- 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...
mgb.opr.batched_matrix_mul(inp1, inp2)
megengine._internal.opr.batched_matrix_mul
# -*- 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...
mgb.opr.warp_perspective(inp, weight, dsize, imode="LINEAR", format="NCHW")
megengine._internal.opr.warp_perspective
# -*- 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...
mgb.opr.identity(inp)
megengine._internal.opr.identity
# -*- 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...
mgb.opr.assert_equal(get, expect, maxerr=max_err, verbose=verbose)
megengine._internal.opr.assert_equal
# -*- 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...
mgb.opr.indexing_one_hot(src, axis, index, keepdims=keepdims)
megengine._internal.opr.indexing_one_hot
# -*- 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...
mgb.opr.elemwise(inp, 0, mode="MAX")
megengine._internal.opr.elemwise
# -*- 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...
mgb.opr.elemwise(inp, 0, mode="MAX")
megengine._internal.opr.elemwise
# -*- 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...
mgb.opr.elem.exp(inp)
megengine._internal.opr.elem.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...
mgb.opr.add_axis(inp, 3)
megengine._internal.opr.add_axis
# -*- 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...
mgb.opr.concat([dsize[0], dsize[1]], axis=0)
megengine._internal.opr.concat
# -*- 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...
mgb.opr.broadcast(weight, (inp.shape[0], 3, 3))
megengine._internal.opr.broadcast
# -*- 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...
mgb.opr.broadcast(weight, (inp.shape[0], 3, 3))
megengine._internal.opr.broadcast
# -*- 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...
mgb.opr.reshape(ret, ret.shape[0:3])
megengine._internal.opr.reshape
# -*- 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...
mgb.opr.elem.exp(inp)
megengine._internal.opr.elem.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...
mgb.opr.elemwise(inp.shape[i + 2] * scale_factor[i], mode="FLOOR")
megengine._internal.opr.elemwise
# -*- 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...
mgb.opr.concat([wscale, [0, 0]], axis=0)
megengine._internal.opr.concat
# -*- 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...
mgb.opr.concat([[0], hscale, [0]], axis=0)
megengine._internal.opr.concat
# -*- 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...
mgb.opr.concat([row0, row1, [[0, 0, 1]]], axis=0)
megengine._internal.opr.concat
# -*- 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...
mgb.opr.concat([wscale, [0], 0.5 * wscale - 0.5], axis=0)
megengine._internal.opr.concat
# -*- 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...
mgb.opr.concat([[0], hscale, 0.5 * hscale - 0.5], axis=0)
megengine._internal.opr.concat
# -*- 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...
mgb.opr.concat([row0, row1, [[0, 0, 1]]], axis=0)
megengine._internal.opr.concat
# -*- 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...
mgb.opr.advanced_indexing(weight)
megengine._internal.opr.advanced_indexing
# 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 ...
quantize_qat(net)
megengine.quantization.quantize.quantize_qat
# 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 ...
quantize_qat(net)
megengine.quantization.quantize.quantize_qat
# 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 ...
dtype.qint8(16.0 / 128)
megengine.core.tensor.dtype.qint8
# 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 ...
quantize_qat(net)
megengine.quantization.quantize.quantize_qat
# 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 ...
dtype.qint8(16.0 / 128)
megengine.core.tensor.dtype.qint8
# 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 ...
quantize_qat(net)
megengine.quantization.quantize.quantize_qat
# 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 ...
dtype.qint8(16.0 / 128)
megengine.core.tensor.dtype.qint8
# 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 ...
quantize_qat(net)
megengine.quantization.quantize.quantize_qat
# 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 ...
dtype.qint8(16.0 / 128)
megengine.core.tensor.dtype.qint8
# 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 ...
quantize_qat(net)
megengine.quantization.quantize.quantize_qat
# 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 ...
dtype.qint8(16.0 / 128)
megengine.core.tensor.dtype.qint8
# 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 ...
dtype.qint8(16.0 / 128.0)
megengine.core.tensor.dtype.qint8
# 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 ...
dtype.qint8(16.0 / 128.0)
megengine.core.tensor.dtype.qint8
# 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 ...
dtype.get_scale(inp_dtype)
megengine.core.tensor.dtype.get_scale
# 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 ...
dtype.get_scale(inp_dtype)
megengine.core.tensor.dtype.get_scale
# 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 ...
dtype.get_scale(inp_dtype)
megengine.core.tensor.dtype.get_scale
# 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 ...
dtype.get_scale(inp_dtype)
megengine.core.tensor.dtype.get_scale
# 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 ...
dtype.get_scale(inp_dtype)
megengine.core.tensor.dtype.get_scale
# 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 ...
dtype.get_scale(inp_dtype)
megengine.core.tensor.dtype.get_scale
# 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 ...
M.Elemwise("add")
megengine.module.Elemwise
# 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 ...
M.Elemwise("add")
megengine.module.Elemwise
# 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 ...
M.Elemwise("add")
megengine.module.Elemwise
# 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 ...
QuantStub()
megengine.module.quant_dequant.QuantStub
# 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 ...
QuantStub()
megengine.module.quant_dequant.QuantStub
# 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 ...
mge.tensor(self.data1)
megengine.tensor
import numpy as np import megengine as mge import megengine.autodiff as ad import megengine.optimizer as optimizer from megengine import Parameter, tensor from megengine.core.tensor.raw_tensor import RawTensor from megengine.module import Module class Simple(Module): def __init__(self): super().__init__(...
tensor([2.34])
megengine.tensor
import numpy as np import megengine as mge import megengine.autodiff as ad import megengine.optimizer as optimizer from megengine import Parameter, tensor from megengine.core.tensor.raw_tensor import RawTensor from megengine.module import Module class Simple(Module): def __init__(self): super().__init__(...
mge.load(model_name, map_location="cpu0")
megengine.load
import numpy as np import megengine as mge import megengine.autodiff as ad import megengine.optimizer as optimizer from megengine import Parameter, tensor from megengine.core.tensor.raw_tensor import RawTensor from megengine.module import Module class Simple(Module): def __init__(self): super().__init__(...
mge.get_default_device()
megengine.get_default_device
import numpy as np import megengine as mge import megengine.autodiff as ad import megengine.optimizer as optimizer from megengine import Parameter, tensor from megengine.core.tensor.raw_tensor import RawTensor from megengine.module import Module class Simple(Module): def __init__(self): super().__init__(...
mge.set_default_device("cpu0")
megengine.set_default_device
import numpy as np import megengine as mge import megengine.autodiff as ad import megengine.optimizer as optimizer from megengine import Parameter, tensor from megengine.core.tensor.raw_tensor import RawTensor from megengine.module import Module class Simple(Module): def __init__(self): super().__init__(...
mge.set_default_device(device_save)
megengine.set_default_device
import numpy as np import megengine as mge import megengine.autodiff as ad import megengine.optimizer as optimizer from megengine import Parameter, tensor from megengine.core.tensor.raw_tensor import RawTensor from megengine.module import Module class Simple(Module): def __init__(self): super().__init__(...
Parameter(1.23, dtype=np.float32)
megengine.Parameter
import numpy as np import megengine as mge import megengine.autodiff as ad import megengine.optimizer as optimizer from megengine import Parameter, tensor from megengine.core.tensor.raw_tensor import RawTensor from megengine.module import Module class Simple(Module): def __init__(self): super().__init__(...
ad.GradManager()
megengine.autodiff.GradManager
# -*- 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...
_set_swap_flag(True)
megengine.core._imperative_rt.core2._set_swap_flag
# -*- 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...
_set_drop_flag(True)
megengine.core._imperative_rt.core2._set_drop_flag
# -*- 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...
get_option("buffer_length")
megengine.core._imperative_rt.core2.get_option
# -*- 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...
set_option("buffer_length", 0)
megengine.core._imperative_rt.core2.set_option
# -*- 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...
_set_swap_flag(False)
megengine.core._imperative_rt.core2._set_swap_flag
# -*- 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...
_set_drop_flag(False)
megengine.core._imperative_rt.core2._set_drop_flag
# -*- 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...
set_option("buffer_length", old_buffer_length)
megengine.core._imperative_rt.core2.set_option
# -*- 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...
Linear(self.num_class, self.mid_layers, bias=True)
megengine.module.Linear
# -*- 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...
Linear(self.mid_layers, self.mid_layers, bias=True)
megengine.module.Linear
# -*- 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...
Linear(self.mid_layers, self.num_class, bias=True)
megengine.module.Linear
# -*- 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...
F.tanh(y)
megengine.functional.tanh
# -*- 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...
F.tanh(y)
megengine.functional.tanh
# -*- 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, dtype=np.float32)
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(label, dtype=np.int32)
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...
ad.GradManager()
megengine.autodiff.GradManager
# -*- 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...
F.nn.cross_entropy(pred, label)
megengine.functional.nn.cross_entropy
# -*- 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 ARRANTIE...
uniform(size=num_class)
megengine.random.uniform
# -*- 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 ARRANTIE...
F.topk(topk_tensor, k=num_samples - num_class)
megengine.functional.topk
# -*- 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 ARRANTIE...
F.topk(random_tensor, k=num_sample - num_mask)
megengine.functional.topk
# -*- 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 ARRANTIE...
F.zeros(sampled_idx.shape)
megengine.functional.zeros
# -*- 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 ARRANTIE...
uniform(size=labels.shape)
megengine.random.uniform
# -*- 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 ARRANTIE...
F.zeros_like(labels)
megengine.functional.zeros_like
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import os from typing import Iterable, Union from megengine import Parameter, tensor from megengine.functional.inplace import _inplace_add_ from megengine.optimizer import Optimizer class SGD(Optimizer): r"""Implements stochastic g...
tensor(lr)
megengine.tensor
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import os from typing import Iterable, Union from megengine import Parameter, tensor from megengine.functional.inplace import _inplace_add_ from megengine.optimizer import Optimizer class SGD(Optimizer): r"""Implements stochastic g...
tensor(weight_decay)
megengine.tensor
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import os from typing import Iterable, Union from megengine import Parameter, tensor from megengine.functional.inplace import _inplace_add_ from megengine.optimizer import Optimizer class SGD(Optimizer): r"""Implements stochastic g...
tensor(momentum)
megengine.tensor
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import os from typing import Iterable, Union from megengine import Parameter, tensor from megengine.functional.inplace import _inplace_add_ from megengine.optimizer import Optimizer class SGD(Optimizer): r"""Implements stochastic g...
tensor(-lr)
megengine.tensor
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import os from typing import Iterable, Union from megengine import Parameter, tensor from megengine.functional.inplace import _inplace_add_ from megengine.optimizer import Optimizer class SGD(Optimizer): r"""Implements stochastic g...
tensor([1.0])
megengine.tensor
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import os from typing import Iterable, Union from megengine import Parameter, tensor from megengine.functional.inplace import _inplace_add_ from megengine.optimizer import Optimizer class SGD(Optimizer): r"""Implements stochastic g...
_inplace_add_(param, grad, alpha=c1, beta=_neg_lr)
megengine.functional.inplace._inplace_add_