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...
M.Conv2d(channel, mid_channel, 1, 1, 0)
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...
M.ConvTranspose2d(mid_channel, mid_channel, 4, 2, 1)
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.Conv2d(channel, mid_channel, 1, 1, 0)
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...
M.ConvTranspose2d(mid_channel, mid_channel, 4, 2, 1)
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.Conv2d(channel, mid_channel, 1, 1, 0)
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...
M.Conv2d(3, 64, 3, 2, 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...
M.ReLU()
megengine.module.ReLU
# -*- 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(64, 64, 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...
M.ReLU()
megengine.module.ReLU
# -*- 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(64, 64, 3, 2, 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...
M.ReLU()
megengine.module.ReLU
# -*- 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.init.msra_normal_(m.weight, mode="fan_out", nonlinearity="relu")
megengine.module.init.msra_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.Conv2d(mid_channel, 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(scale_out, label)
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...
F.interpolate(out, scale_factor=2 ** (3 - j))
megengine.functional.interpolate
# -*- 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.calculate_fan_in_and_fan_out(m.weight)
megengine.module.init.calculate_fan_in_and_fan_out
# -*- 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.uniform_(m.bias, -bound, bound)
megengine.module.init.uniform_
# -*- 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.ones_(m.weight)
megengine.module.init.ones_
# -*- 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_(m.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...
M.Conv2d(mid_channel, 64, 1, 1, 0)
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...
M.ReLU()
megengine.module.ReLU
# -*- 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.calculate_fan_in_and_fan_out(m.weight)
megengine.module.init.calculate_fan_in_and_fan_out
# -*- 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.uniform_(m.bias, -bound, bound)
megengine.module.init.uniform_
# 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(-1.0)
megengine.tensor
# 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 ...
F.matmul(x, w)
megengine.functional.matmul
# 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.Parameter([1.0])
megengine.Parameter
# 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 ...
GradManager()
megengine.autodiff.GradManager
# 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.Parameter(2.0)
megengine.Parameter
# 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 ...
GradManager()
megengine.autodiff.GradManager
# 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(3)
megengine.tensor
# 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.Parameter(1.0)
megengine.Parameter
# 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.Parameter(1.0)
megengine.Parameter
# 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 ...
GradManager()
megengine.autodiff.GradManager
# 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 ...
F.ones((10, 10, 3, 3))
megengine.functional.ones
# 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.Conv2d(10, 10, kernel_size=3, padding=1)
megengine.module.Conv2d
# 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 ...
GradManager()
megengine.autodiff.GradManager
# 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 ...
F.matmul(x, w)
megengine.functional.matmul
# 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 ...
dist.get_rank()
megengine.distributed.get_rank
# 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 ...
dist.get_world_size()
megengine.distributed.get_world_size
# 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.Linear(rank * 2 + 2, rank * 2 + 4)
megengine.module.Linear
# 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 ...
get_device_count_by_fork("gpu")
megengine.distributed.helper.get_device_count_by_fork
# 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([1.0, 3.0, 5.0])
megengine.tensor
# 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([2.0, 4.0, 6.0])
megengine.tensor
# 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 ...
GradManager()
megengine.autodiff.GradManager
# 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(i, dtype="float32")
megengine.Tensor
# 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 ...
GradManager()
megengine.autodiff.GradManager
# 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 ...
trace(symbolic=False)
megengine.jit.trace
# 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 ...
trace(symbolic=True)
megengine.jit.trace
# 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 ...
dist.functional.remote_send(y, dest_rank=rank + 1)
megengine.distributed.functional.remote_send
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.transpose(right_slid, (0, 2, 1, 3, 4))
megengine.functional.transpose
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.mean(left_feature * right_slid, axis=1, keepdims=True)
megengine.functional.mean
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.transpose(coords, (0, 2, 3, 1))
megengine.functional.transpose
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.split(left_feature, 4, axis=1)
megengine.functional.split
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.split(right_feature, 4, axis=1)
megengine.functional.split
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.concat(corrs, axis=1)
megengine.functional.concat
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.split(left_feature, 4, axis=1)
megengine.functional.split
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.split(right_feature, 4, axis=1)
megengine.functional.split
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.concat(corrs, axis=1)
megengine.functional.concat
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.reshape(extra_offset, (N, search_num, 2, H, W))
megengine.functional.reshape
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.expand_dims(offsets, (0, 2, 3))
megengine.functional.expand_dims
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.transpose(coords, (0, 2, 3, 1))
megengine.functional.transpose
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.reshape(coords, (N, -1, W, 2))
megengine.functional.reshape
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.expand_dims(left_feature, 2)
megengine.functional.expand_dims
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.mean(left_feature * right_feature, axis=1)
megengine.functional.mean
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.transpose(left_feature, (0, 2, 3, 1))
megengine.functional.transpose
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.transpose(right_feature, (0, 2, 3, 1))
megengine.functional.transpose
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
mge.tensor(y_grid, device=self.fmap1.device)
megengine.tensor
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.expand_dims(coords, 1)
megengine.functional.expand_dims
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.reshape(x, (N, H, W, C))
megengine.functional.reshape
import numpy as np import megengine as mge import megengine.module as M import megengine.functional as F from .utils.utils import bilinear_sampler, coords_grid class AGCL: """ Implementation of Adaptive Group Correlation Layer (AGCL). """ def __init__(self, fmap1, fmap2, att=None): self.fmap1...
F.stack((x_grid, y_grid))
megengine.functional.stack
import megengine as mge import megengine.module as M from megengine import functional as F import numpy as np from .transformer import MultiheadAttention #from .utility import has_nan_or_inf # mge.core.set_option('async_level', 0) class DecoderWrapper(M.Module): def __init__(self, cfg): super().__init__()...
M.Linear(in_features=channels, out_features=channels)
megengine.module.Linear
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module
set_symbolic_shape(True)
megengine.core._trace_option.set_symbolic_shape
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module set_symbolic_shape(T...
F.ones((1, 14, 8, 8), dtype=np.uint8)
megengine.functional.ones
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module set_symbolic_shape(T...
trace_module(module, data)
megengine.traced_module.trace_module
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module set_symbolic_shape(T...
F.zeros((1,), dtype=np.int32)
megengine.functional.zeros
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module set_symbolic_shape(T...
F.ones((1, 2, 2), dtype=np.float32)
megengine.functional.ones
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module set_symbolic_shape(T...
trace_module(module, data, idx, roi)
megengine.traced_module.trace_module
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module set_symbolic_shape(T...
trace(traced_module, capture_as_const=True)
megengine.jit.trace
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module set_symbolic_shape(T...
cgtools.GraphInference(model)
megengine.utils.comp_graph_tools.GraphInference
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module set_symbolic_shape(T...
F.ones((1,))
megengine.functional.ones
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module set_symbolic_shape(T...
F.zeros((1,))
megengine.functional.zeros
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module set_symbolic_shape(T...
F.maximum((xmax - xmin) / W, (ymax - ymin) / H)
megengine.functional.maximum
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module set_symbolic_shape(T...
F.broadcast_to(self.I, (N,))
megengine.functional.broadcast_to
import io import pickle import numpy as np import megengine.functional as F import megengine.module as M import megengine.utils.comp_graph_tools as cgtools from megengine.core._trace_option import set_symbolic_shape from megengine.jit import trace from megengine.traced_module import trace_module set_symbolic_shape(T...
F.broadcast_to(self.M, (N, 3, 3))
megengine.functional.broadcast_to
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import os from typing import List import megengine.distributed as dist from basecore.config import ConfigDict from basecore.engine import BaseHook from basecore.utils import str_timestamp from basecls.utils import registers from .hooks...
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...
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...
trace(symbolic=True, capture_as_const=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...
M.Linear(100, 200, bias=False)
megengine.module.Linear
# -*- 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.Linear(200, 200, bias=True)
megengine.module.Linear
# -*- 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.relu(x)
megengine.functional.relu
# -*- 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.pooling.MaxPool2d(kernel_size=3, stride=2, padding=2)
megengine.module.pooling.MaxPool2d
# -*- 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.pooling.AvgPool2d(kernel_size=3, stride=2, padding=2)
megengine.module.pooling.AvgPool2d
# -*- 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.BatchNorm1d(32)
megengine.module.BatchNorm1d
# -*- 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.BatchNorm2d(3)
megengine.module.BatchNorm2d
# -*- 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.transpose(x, self.perm)
megengine.functional.transpose
# -*- 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.concat([a, a], self.concat_idx)
megengine.functional.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...
F.softmax(a)
megengine.functional.softmax