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.RandomHorizontalFlip()
megengine.data.transform.RandomHorizontalFlip
# -*- 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.ColorJitter(brightness=0.4, contrast=0.4, saturation=0.4)
megengine.data.transform.ColorJitter
# -*- 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("CHW")
megengine.data.transform.ToMode
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.equal(masks, sample_value)
megengine.functional.equal
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.minimum(num_mask, num_samples)
megengine.functional.minimum
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
rand.uniform(0, 1, sample_mask.shape)
megengine.random.uniform
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.ones([1, gt_boxes_perimg.shape[1]])
megengine.functional.ones
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.concat([batch_inds, gt_boxes_perimg[:, :4]], axis=1)
megengine.functional.concat
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.cond_take(batch_rois_mask, batch_rois_mask)
megengine.functional.cond_take
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.concat([gt_boxes_perimg, dummy_gt],axis=0)
megengine.functional.concat
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.argsort(overlaps_normal, descending=True)
megengine.functional.argsort
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.gather(overlaps_normal, 1, overlaps_normal_indices)
megengine.functional.gather
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.gather(overlaps_ignore, 1, overlaps_ignore_indices)
megengine.functional.gather
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.cond_take(keep_mask > 0, keep_mask)
megengine.functional.cond_take
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.concat(return_rois, axis=0)
megengine.functional.concat
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.concat(return_labels, axis=0)
megengine.functional.concat
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.concat(return_bbox_targets, axis=0)
megengine.functional.concat
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.ones((gt_boxes_perimg.shape[0], 1))
megengine.functional.ones
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.equal(rpn_rois[:, 0], bid)
megengine.functional.equal
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.concat([rpn_rois[batch_rois_index], gt_rois], axis=0)
megengine.functional.concat
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.equal(fg_mask[:, 0], 0)
megengine.functional.equal
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.equal(bg_mask[:, 0], 0)
megengine.functional.equal
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.equal(labels, config.ignore_label)
megengine.functional.equal
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
F.expand_dims(rois, 1)
megengine.functional.expand_dims
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
mge.tensor(config.bbox_normalize_stds[None, :])
megengine.tensor
# -*- coding: utf-8 -*- import megengine as mge import megengine.random as rand import megengine.functional as F import numpy as np from config import config from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr import pdb def fpn_roi_target(rpn_rois, im_info, gt_boxes, fg_threshold ...
mge.tensor(config.bbox_normalize_means[None, :])
megengine.tensor
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import copy from typing import Optional, Sequence import cv2 import megengine.data as data import megengine.data.transform as T import numpy as np from basecore.config import ConfigDict from loguru import logger from basecls.utils impor...
T.Compose(transforms=transforms, order=["image", "image_category"])
megengine.data.transform.Compose
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import copy from typing import Optional, Sequence import cv2 import megengine.data as data import megengine.data.transform as T import numpy as np from basecore.config import ConfigDict from loguru import logger from basecls.utils impor...
T.PseudoTransform()
megengine.data.transform.PseudoTransform
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import copy from typing import Optional, Sequence import cv2 import megengine.data as data import megengine.data.transform as T import numpy as np from basecore.config import ConfigDict from loguru import logger from basecls.utils impor...
T.RandomHorizontalFlip()
megengine.data.transform.RandomHorizontalFlip
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import copy from typing import Optional, Sequence import cv2 import megengine.data as data import megengine.data.transform as T import numpy as np from basecore.config import ConfigDict from loguru import logger from basecls.utils impor...
T.ToMode()
megengine.data.transform.ToMode
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import copy from typing import Optional, Sequence import cv2 import megengine.data as data import megengine.data.transform as T import numpy as np from basecore.config import ConfigDict from loguru import logger from basecls.utils impor...
T.CenterCrop(cfg.test.img_size)
megengine.data.transform.CenterCrop
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import copy from typing import Optional, Sequence import cv2 import megengine.data as data import megengine.data.transform as T import numpy as np from basecore.config import ConfigDict from loguru import logger from basecls.utils impor...
T.ToMode()
megengine.data.transform.ToMode
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import copy from typing import Optional, Sequence import cv2 import megengine.data as data import megengine.data.transform as T import numpy as np from basecore.config import ConfigDict from loguru import logger from basecls.utils impor...
T.ColorJitter(**aug_args)
megengine.data.transform.ColorJitter
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import copy from typing import Optional, Sequence import cv2 import megengine.data as data import megengine.data.transform as T import numpy as np from basecore.config import ConfigDict from loguru import logger from basecls.utils impor...
T.Lighting(lighting_scale)
megengine.data.transform.Lighting
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
R.gaussian(shape=[batch_size, self.nz])
megengine.random.gaussian
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
F.zero_grad(fake_images)
megengine.functional.zero_grad
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
F.sigmoid(output_real)
megengine.functional.sigmoid
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
F.sigmoid(output_fake)
megengine.functional.sigmoid
import numpy as np import megengine import megengine.module as M import megengine.functional as F import math from . import default_init_weights class ShuffleV2Block(M.Module): def __init__(self, inp, oup, mid_channels, *, ksize, stride): super().__init__() self.stride = stride assert strid...
M.Sequential(*branch_main)
megengine.module.Sequential
import numpy as np import megengine import megengine.module as M import megengine.functional as F import math from . import default_init_weights class ShuffleV2Block(M.Module): def __init__(self, inp, oup, mid_channels, *, ksize, stride): super().__init__() self.stride = stride assert strid...
F.transpose(x, (1, 0, 2))
megengine.functional.transpose
import numpy as np import megengine import megengine.module as M import megengine.functional as F import math from . import default_init_weights class ShuffleV2Block(M.Module): def __init__(self, inp, oup, mid_channels, *, ksize, stride): super().__init__() self.stride = stride assert strid...
M.Conv2d(inp, mid_channels, 1, 1, 0, bias=False)
megengine.module.Conv2d
import numpy as np import megengine import megengine.module as M import megengine.functional as F import math from . import default_init_weights class ShuffleV2Block(M.Module): def __init__(self, inp, oup, mid_channels, *, ksize, stride): super().__init__() self.stride = stride assert strid...
M.ReLU()
megengine.module.ReLU
import numpy as np import megengine import megengine.module as M import megengine.functional as F import math from . import default_init_weights class ShuffleV2Block(M.Module): def __init__(self, inp, oup, mid_channels, *, ksize, stride): super().__init__() self.stride = stride assert strid...
M.Conv2d(mid_channels, outputs, 1, 1, 0, bias=False)
megengine.module.Conv2d
import numpy as np import megengine import megengine.module as M import megengine.functional as F import math from . import default_init_weights class ShuffleV2Block(M.Module): def __init__(self, inp, oup, mid_channels, *, ksize, stride): super().__init__() self.stride = stride assert strid...
M.ReLU()
megengine.module.ReLU
import numpy as np import megengine import megengine.module as M import megengine.functional as F import math from . import default_init_weights class ShuffleV2Block(M.Module): def __init__(self, inp, oup, mid_channels, *, ksize, stride): super().__init__() self.stride = stride assert strid...
M.Sequential(*branch_proj)
megengine.module.Sequential
import numpy as np import megengine import megengine.module as M import megengine.functional as F import math from . import default_init_weights class ShuffleV2Block(M.Module): def __init__(self, inp, oup, mid_channels, *, ksize, stride): super().__init__() self.stride = stride assert strid...
M.Conv2d(inp, inp, ksize, stride, pad, groups=inp, bias=False)
megengine.module.Conv2d
import numpy as np import megengine import megengine.module as M import megengine.functional as F import math from . import default_init_weights class ShuffleV2Block(M.Module): def __init__(self, inp, oup, mid_channels, *, ksize, stride): super().__init__() self.stride = stride assert strid...
M.BatchNorm2d(inp)
megengine.module.BatchNorm2d
import numpy as np import megengine import megengine.module as M import megengine.functional as F import math from . import default_init_weights class ShuffleV2Block(M.Module): def __init__(self, inp, oup, mid_channels, *, ksize, stride): super().__init__() self.stride = stride assert strid...
M.Conv2d(inp, inp, 1, 1, 0, bias=False)
megengine.module.Conv2d
import numpy as np import megengine import megengine.module as M import megengine.functional as F import math from . import default_init_weights class ShuffleV2Block(M.Module): def __init__(self, inp, oup, mid_channels, *, ksize, stride): super().__init__() self.stride = stride assert strid...
M.BatchNorm2d(inp)
megengine.module.BatchNorm2d
import numpy as np import megengine import megengine.module as M import megengine.functional as F import math from . import default_init_weights class ShuffleV2Block(M.Module): def __init__(self, inp, oup, mid_channels, *, ksize, stride): super().__init__() self.stride = stride assert strid...
M.ReLU()
megengine.module.ReLU
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
hub.load("megengine/models", MODEL_NAME[model_name], pretrained=pretrained)
megengine.hub.load
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Embedding(config.vocab_size, config.hidden_size)
megengine.module.Embedding
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Dropout(config.hidden_dropout_prob)
megengine.module.Dropout
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Linear(config.hidden_size, self.all_head_size)
megengine.module.Linear
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Linear(config.hidden_size, self.all_head_size)
megengine.module.Linear
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Linear(config.hidden_size, self.all_head_size)
megengine.module.Linear
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Dropout(config.attention_probs_dropout_prob)
megengine.module.Dropout
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
mge.tensor(x.shape)
megengine.tensor
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
F.matmul(attention_probs, value_layer)
megengine.functional.matmul
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
mge.tensor(context_layer.shape)
megengine.tensor
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
F.concat([context_shape[:-2], self.all_head_size])
megengine.functional.concat
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Linear(config.hidden_size, config.hidden_size)
megengine.module.Linear
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Dropout(config.hidden_dropout_prob)
megengine.module.Dropout
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Linear(config.hidden_size, config.intermediate_size)
megengine.module.Linear
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Linear(config.intermediate_size, config.hidden_size)
megengine.module.Linear
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Dropout(config.hidden_dropout_prob)
megengine.module.Dropout
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Linear(config.hidden_size, config.hidden_size)
megengine.module.Linear
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
F.expand_dims(attention_mask, (1, 2))
megengine.functional.expand_dims
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Dropout(config.hidden_dropout_prob)
megengine.module.Dropout
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
Linear(config.hidden_size, num_labels)
megengine.module.Linear
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
F.zeros_like(input_ids)
megengine.functional.zeros_like
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
F.expand_dims(position_ids, 0)
megengine.functional.expand_dims
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
F.ones_like(input_ids)
megengine.functional.ones_like
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
F.zeros_like(input_ids)
megengine.functional.zeros_like
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
F.linspace(0, seq_length - 1, seq_length)
megengine.functional.linspace
# -*- coding: utf-8 -*- # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------------- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License"...
F.sqrt(2 / math.pi)
megengine.functional.sqrt
#!/usr/bin/env mdl # This file will seal the nms opr within a better way than lib_nms import ctypes import os import struct import numpy as np import megengine as mge import megengine.functional as F from megengine._internal.craniotome import CraniotomeBase from megengine.core.tensor import wrap_io_tensor _current_p...
mge.tensor([0, 0, 1, 1], device=boxes.device)
megengine.tensor
# -*- coding: utf-8 -*- # Copyright 2019 - present, Facebook, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
F.mean(output, axis=2, keepdims=True)
megengine.functional.mean
# -*- coding: utf-8 -*- # Copyright 2019 - present, Facebook, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
F.mean(output ** 2, axis=2, keepdims=True)
megengine.functional.mean
# -*- coding: utf-8 -*- # Copyright 2019 - present, Facebook, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
M.init.ones_(self.weight)
megengine.module.init.ones_
# -*- coding: utf-8 -*- # Copyright 2019 - present, Facebook, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
M.init.zeros_(self.bias)
megengine.module.init.zeros_
# -*- coding: utf-8 -*- # Copyright 2019 - present, Facebook, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
F.sqrt(var + self.eps)
megengine.functional.sqrt
# -*- coding: utf-8 -*- # Copyright 2019 - present, Facebook, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
F.sqrt(self.running_var + self.eps)
megengine.functional.sqrt
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.Sequential(*layers)
megengine.module.Sequential
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.Elemwise("ADD")
megengine.module.Elemwise
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.Sequential(*features)
megengine.module.Sequential
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.QuantStub()
megengine.module.QuantStub
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.DequantStub()
megengine.module.DequantStub
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
F.avg_pool2d(x, 7)
megengine.functional.avg_pool2d
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
F.flatten(x, 1)
megengine.functional.flatten
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.ConvBnRelu2d(3, input_channel, kernel_size=3, padding=1, stride=2, bias=False)
megengine.module.ConvBnRelu2d
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.ConvBnRelu2d(input_channel, self.last_channel, kernel_size=1, bias=False)
megengine.module.ConvBnRelu2d
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.Dropout(0.2)
megengine.module.Dropout
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.Linear(self.last_channel, num_classes)
megengine.module.Linear
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.ConvBnRelu2d(inp, hidden_dim, kernel_size=1, bias=False)
megengine.module.ConvBnRelu2d
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.ConvBn2d(hidden_dim, oup, kernel_size=1, bias=False)
megengine.module.ConvBn2d
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.init.msra_normal_(m.weight, mode='fan_out')
megengine.module.init.msra_normal_
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.init.zeros_(m.bias)
megengine.module.init.zeros_
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.init.ones_(m.weight)
megengine.module.init.ones_
# BSD 3-Clause License # Copyright (c) <NAME> 2016, # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of con...
M.init.zeros_(m.bias)
megengine.module.init.zeros_