prompt
stringlengths
94
42.6k
completion
stringlengths
6
120
api
stringlengths
14
68
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
T.ToMode()
megengine.data.transform.ToMode
import logging from megengine.distributed.group import get_rank from megengine.distributed import is_distributed logger_initialized = {} def get_logger(name, log_file=None, log_level=logging.INFO): """Initialize and get a logger by name. If the logger has not been initialized, this method will initialize the...
is_distributed()
megengine.distributed.is_distributed
import logging from megengine.distributed.group import get_rank from megengine.distributed import is_distributed logger_initialized = {} def get_logger(name, log_file=None, log_level=logging.INFO): """Initialize and get a logger by name. If the logger has not been initialized, this method will initialize the...
is_distributed()
megengine.distributed.is_distributed
import logging from megengine.distributed.group import get_rank from megengine.distributed import is_distributed logger_initialized = {} def get_logger(name, log_file=None, log_level=logging.INFO): """Initialize and get a logger by name. If the logger has not been initialized, this method will initialize the...
get_rank()
megengine.distributed.group.get_rank
import logging from megengine.distributed.group import get_rank from megengine.distributed import is_distributed logger_initialized = {} def get_logger(name, log_file=None, log_level=logging.INFO): """Initialize and get a logger by name. If the logger has not been initialized, this method will initialize the...
get_rank()
megengine.distributed.group.get_rank
import argparse import logging import os import dataset.data_loader as data_loader import model.net as net from common import utils from loss.losses import compute_losses, compute_metrics from common.manager import Manager import megengine.distributed as dist import megengine.functional as F parser = argparse.Argum...
dist.get_rank()
megengine.distributed.get_rank
import argparse import logging import os import dataset.data_loader as data_loader import model.net as net from common import utils from loss.losses import compute_losses, compute_metrics from common.manager import Manager import megengine.distributed as dist import megengine.functional as F parser = argparse.Argum...
dist.get_world_size()
megengine.distributed.get_world_size
import argparse import logging import os import dataset.data_loader as data_loader import model.net as net from common import utils from loss.losses import compute_losses, compute_metrics from common.manager import Manager import megengine.distributed as dist import megengine.functional as F parser = argparse.Argum...
F.distributed.all_reduce_sum(v)
megengine.functional.distributed.all_reduce_sum
import argparse import logging import os import dataset.data_loader as data_loader import model.net as net from common import utils from loss.losses import compute_losses, compute_metrics from common.manager import Manager import megengine.distributed as dist import megengine.functional as F parser = argparse.Argum...
F.distributed.all_reduce_sum(v)
megengine.functional.distributed.all_reduce_sum
import argparse import logging import os import dataset.data_loader as data_loader import model.net as net from common import utils from loss.losses import compute_losses, compute_metrics from common.manager import Manager import megengine.distributed as dist import megengine.functional as F parser = argparse.Argum...
F.distributed.all_reduce_sum(v)
megengine.functional.distributed.all_reduce_sum
import argparse import logging import os import dataset.data_loader as data_loader import model.net as net from common import utils from loss.losses import compute_losses, compute_metrics from common.manager import Manager import megengine.distributed as dist import megengine.functional as F parser = argparse.Argum...
F.distributed.all_reduce_sum(v)
megengine.functional.distributed.all_reduce_sum
import sys sys.path.append('.') import cv2 import megengine as mge import megengine.functional as F import numpy as np from model.RIFE import Model model = Model() model.load_model('train_log') model.eval() name = ['Beanbags', 'Dimetrodon', 'DogDance', 'Grove2', 'Grove3', 'Hydrangea', 'MiniCooper', 'RubberWhale', 'Ur...
F.zeros([1, 6, 480, 640])
megengine.functional.zeros
import sys sys.path.append('.') import cv2 import megengine as mge import megengine.functional as F import numpy as np from model.RIFE import Model model = Model() model.load_model('train_log') model.eval() name = ['Beanbags', 'Dimetrodon', 'DogDance', 'Grove2', 'Grove3', 'Hydrangea', 'MiniCooper', 'RubberWhale', 'Ur...
mge.Tensor(i0)
megengine.Tensor
import sys sys.path.append('.') import cv2 import megengine as mge import megengine.functional as F import numpy as np from model.RIFE import Model model = Model() model.load_model('train_log') model.eval() name = ['Beanbags', 'Dimetrodon', 'DogDance', 'Grove2', 'Grove3', 'Hydrangea', 'MiniCooper', 'RubberWhale', 'Ur...
mge.Tensor(i1)
megengine.Tensor
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
F.sqrt(running_var + eps)
megengine.functional.sqrt
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
F.conv2d(beta - running_mean * gamma / std, kernel, conv.bias)
megengine.functional.conv2d
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
F.flatten(conv.weight, end_axis=conv.weight.ndim - 4)
megengine.functional.flatten
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
F.sqrt(running_var + eps)
megengine.functional.sqrt
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
nn.Dropout(drop)
megengine.module.Dropout
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
nn.BatchNorm2d(channels)
megengine.module.BatchNorm2d
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
nn.BatchNorm2d(channels)
megengine.module.BatchNorm2d
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
nn.BatchNorm2d(dims[-1])
megengine.module.BatchNorm2d
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
nn.AdaptiveAvgPool2d(1)
megengine.module.AdaptiveAvgPool2d
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
F.flatten(x, 1)
megengine.functional.flatten
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
nn.Identity()
megengine.module.Identity
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
nn.Linear(dims[-1], num_classes)
megengine.module.Linear
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
nn.Identity()
megengine.module.Identity
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
F.pad(dw_small.weight, [[0, 0]] * 3 + [[(kernel - k) // 2] * 2] * 2)
megengine.functional.pad
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
nn.Identity()
megengine.module.Identity
# Copyright (c) 2014-2022 Megvii Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
nn.Identity()
megengine.module.Identity
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer =
nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias)
megengine.module.Conv2d
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer =
nn.Conv2d(in_chn, out_chn, kernel_size=4, stride=2, padding=1, bias=bias)
megengine.module.Conv2d
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
nn.Conv2d(in_size, out_size, kernel_size=1, bias=True)
megengine.module.Conv2d
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
nn.ConvTranspose2d(in_size, out_size, kernel_size=2, stride=2, bias=True)
megengine.module.ConvTranspose2d
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
F.concat([up, bridge], 1)
megengine.functional.concat
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
nn.Conv2d(in_size, out_size, kernel_size=1, bias=True)
megengine.module.Conv2d
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
nn.Conv2d(in_size, out_size, kernel_size=1, bias=True)
megengine.module.Conv2d
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
nn.Conv2d(in_size, out_size, kernel_size=3, padding=1, bias=True)
megengine.module.Conv2d
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
nn.LeakyReLU(relu_slope)
megengine.module.LeakyReLU
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
nn.Conv2d(out_size, out_size, kernel_size=3, padding=1, bias=True)
megengine.module.Conv2d
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
nn.LeakyReLU(relu_slope)
megengine.module.LeakyReLU
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
F.matmul(V_t, V)
megengine.functional.matmul
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
F.matinv(mat)
megengine.functional.matinv
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
F.matmul(mat_inv, V_t)
megengine.functional.matmul
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
F.concat([up, bridge], 1)
megengine.functional.concat
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
nn.init.xavier_uniform_(m.weight)
megengine.module.init.xavier_uniform_
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
nn.init.zeros_(m.bias)
megengine.module.init.zeros_
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
F.abs(V_t)
megengine.functional.abs
#!/usr/bin/env python3 import megengine as mge import megengine.module as nn import megengine.functional as F def conv3x3(in_chn, out_chn, bias=True): layer = nn.Conv2d(in_chn, out_chn, kernel_size=3, stride=1, padding=1, bias=bias) return layer def conv_down(in_chn, out_chn, bias=False): layer = nn.Conv...
F.matmul(V, project_feature)
megengine.functional.matmul
# -*- 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 ...
mge.load(self.params.restore_file)
megengine.load
# -*- 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 ...
mge.save(state, latest_ckpt_name)
megengine.save
# -*- 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 ...
mge.save(state, best_ckpt_name)
megengine.save
# -*- 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 ...
mge.save(state, best_ckpt_name)
megengine.save
# 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 ...
mgb.dtype.qint8(self.scale)
megengine._internal.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 ...
mgb.dtype.get_scale(inp.dtype)
megengine._internal.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 ...
mgb.dtype.get_scale(self.weight.dtype)
megengine._internal.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 ...
mgb.dtype.qint32(self.scale)
megengine._internal.dtype.qint32
# 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 ...
mgb.dtype.qint32(bias_scale)
megengine._internal.dtype.qint32
# -*- 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, 4])
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, 4])
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(2)
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)
megengine.tensor
import sys sys.path.append('.') import time import megengine as mge from model.RIFE import Model model = Model() model.eval() I0 =
mge.random(1, 3, 480, 640)
megengine.random
import sys sys.path.append('.') import time import megengine as mge from model.RIFE import Model model = Model() model.eval() I0 = mge.random(1, 3, 480, 640) I1 =
mge.random(1, 3, 480, 640)
megengine.random
import sys sys.path.append('.') import time import megengine as mge from model.RIFE import Model model = Model() model.eval() I0 = mge.random(1, 3, 480, 640) I1 = mge.random(1, 3, 480, 640) for i in range(100): pred = model.inference(I0, I1)
mge._full_sync()
megengine._full_sync
import sys sys.path.append('.') import time import megengine as mge from model.RIFE import Model model = Model() model.eval() I0 = mge.random(1, 3, 480, 640) I1 = mge.random(1, 3, 480, 640) for i in range(100): pred = model.inference(I0, I1) mge._full_sync() time_stamp = time.time() for i in range(100): pred ...
mge._full_sync()
megengine._full_sync
# Copyright (c) Megvii, Inc. and its affiliates. import megengine.functional as F import megengine.module as M from .head import get_head from .loss import get_loss from .resnet import get_backbone from .stn import STN class FaceRecognitionModel(M.Module): """combination of all building blocks, including backbo...
F.normalize(embedding, axis=1)
megengine.functional.normalize
# -*- 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...
mge.tensor(x, dtype="float32")
megengine.tensor
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-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...
mge.tensor(s, dtype="float32")
megengine.tensor
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-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...
mge.tensor(g_y, dtype="float32")
megengine.tensor
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-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...
QuantDtypeMeta("test_qint8", None, "int8", qmin, qmax)
megengine.core.tensor.dtype.QuantDtypeMeta
# -*- 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([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-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([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-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...
mge.tensor(x, dtype="float32")
megengine.tensor
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-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...
mge.tensor(s, dtype="float32")
megengine.tensor
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-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...
mge.tensor(zero_point, dtype="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...
mge.tensor(grad_s, dtype="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...
mge.tensor(g_y, dtype="float32")
megengine.tensor
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-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...
Grad()
megengine.core.autodiff.grad.Grad
# -*- 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...
tqt_forward(-127, 127, x, s)
megengine.quantization.utils.tqt_forward
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-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.round(x)
megengine.functional.round
# -*- 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.maximum(oup, qmin)
megengine.functional.maximum
# -*- 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...
create_qparams(QuantMode.ASYMMERTIC, test_dtype, scale, zero_point)
megengine.quantization.utils.create_qparams
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
tensor(inp_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(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-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
tensor(inp_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...
F.full((1, 32, 3, 3), np.nan)
megengine.functional.full
# -*- 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...
Grad()
megengine.core.autodiff.grad.Grad
# -*- 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...
lsq_forward(-127, 127, x, s, zero_point, grad_s)
megengine.quantization.utils.lsq_forward
# -*- 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...
Grad()
megengine.core.autodiff.grad.Grad
# -*- 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...
fake_quant_tensor(x, qparams)
megengine.quantization.utils.fake_quant_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...
Grad()
megengine.core.autodiff.grad.Grad
# -*- 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...
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-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...
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-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...
fake_quant_tensor(inp, qparams)
megengine.quantization.utils.fake_quant_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...
fake_quant_tensor(x, qparams)
megengine.quantization.utils.fake_quant_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...
F.ones_like(x)
megengine.functional.ones_like
# -*- 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.ones_like(x1)
megengine.functional.ones_like
# 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 ...
mgb.dtype.get_scale(inp.dtype)
megengine._internal.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 ...
mgb.dtype.get_scale(self.weight.dtype)
megengine._internal.dtype.get_scale