code stringlengths 118 171k | apis list | extract_api stringlengths 145 164k |
|---|---|---|
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agreed... | [
"oneflow.nn.relu",
"oneflow.nn.avg_pool2d",
"oneflow.constant_initializer",
"oneflow.variance_scaling_initializer",
"oneflow.nn.max_pool2d",
"oneflow.reshape",
"oneflow.layers.batch_normalization",
"oneflow.random_normal_initializer",
"oneflow.nn.conv2d",
"oneflow.scope.namespace",
"oneflow.get_... | [((1076, 1129), 'oneflow.variance_scaling_initializer', 'flow.variance_scaling_initializer', ([], {'data_format': '"""NCHW"""'}), "(data_format='NCHW')\n", (1109, 1129), True, 'import oneflow as flow\n'), ((1147, 1322), 'oneflow.get_variable', 'flow.get_variable', (["(name + '-weight')"], {'shape': '(filters, input.sha... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.convert_oneflow_dtype_to_numpy_dtype"
] | [((1964, 2012), 'oneflow.convert_oneflow_dtype_to_numpy_dtype', 'flow.convert_oneflow_dtype_to_numpy_dtype', (['dtype'], {}), '(dtype)\n', (2005, 2012), True, 'import oneflow as flow\n'), ((2468, 2516), 'oneflow.convert_oneflow_dtype_to_numpy_dtype', 'flow.convert_oneflow_dtype_to_numpy_dtype', (['dtype'], {}), '(dtype... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.framework.docstr.utils.add_docstr"
] | [((661, 1733), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.amax', '"""\n oneflow.amax(input, dim=None, keepdim=False) -> Tensor\n\n This function is equivalent to PyTorch’s amax function. It returns the maximum along a dimension.\n\n Args:\n input (oneflow.Tensor): the input Te... |
# coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
#
# 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 require... | [
"oneflow.optim.lr_scheduler.PolynomialLR",
"oneflow.optim.lr_scheduler.ExponentialLR",
"oneflow.optim.lr_scheduler.MultiStepLR",
"oneflow.optim.lr_scheduler.WarmUpLR",
"oneflow.optim.lr_scheduler.CosineDecayLR",
"oneflow.optim.lr_scheduler.CosineAnnealingLR"
] | [((709, 736), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (726, 736), False, 'import logging\n'), ((1856, 1943), 'oneflow.optim.lr_scheduler.CosineDecayLR', 'flow.optim.lr_scheduler.CosineDecayLR', (['optimizer'], {'decay_steps': 'max_iter', 'alpha': 'alpha'}), '(optimizer, decay_steps... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.user_op_builder",
"oneflow.scope.namespace",
"oneflow.constant_initializer",
"oneflow.get_variable"
] | [((5487, 5515), 'oneflow.constant_initializer', 'flow.constant_initializer', (['(0)'], {}), '(0)\n', (5512, 5515), True, 'import oneflow as flow\n'), ((5525, 5551), 'oneflow.scope.namespace', 'flow.scope.namespace', (['name'], {}), '(name)\n', (5545, 5551), True, 'import oneflow as flow\n'), ((5569, 5773), 'oneflow.get... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.framework.docstr.utils.add_docstr"
] | [((660, 1430), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.nms', '"""\n Performs non-maximum suppression (NMS) on the boxes according\n to their intersection-over-union (IoU).\n\n NMS iteratively removes lower scoring boxes which have an\n IoU greater than iou_threshold with anothe... |
"""
Modified from https://github.com/tmp-iclr/convmixer/blob/main/convmixer.py
"""
import oneflow as flow
import oneflow.nn as nn
from .registry import ModelCreator
from .utils import load_state_dict_from_url
__all__ = [
"ConvMixer",
"convmixer_1536_20",
"convmixer_768_32_relu",
"convmixer_1024_20",
]... | [
"oneflow.nn.Linear",
"oneflow.nn.Conv2d",
"oneflow.nn.BatchNorm2d",
"oneflow.nn.AdaptiveAvgPool2d",
"oneflow.nn.Flatten"
] | [((1109, 1169), 'oneflow.nn.Conv2d', 'nn.Conv2d', (['(3)', 'dim'], {'kernel_size': 'patch_size', 'stride': 'patch_size'}), '(3, dim, kernel_size=patch_size, stride=patch_size)\n', (1118, 1169), True, 'import oneflow.nn as nn\n'), ((1201, 1220), 'oneflow.nn.BatchNorm2d', 'nn.BatchNorm2d', (['dim'], {}), '(dim)\n', (1215... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.unittest.skip_unless_1n1d"
] | [((711, 743), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (741, 743), True, 'import oneflow as flow\n'), ((1923, 1938), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1936, 1938), False, 'import unittest\n')] |
"""
Copyright 2020 Tianshu AI Platform. All Rights Reserved.
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 applicable law or agreed... | [
"oneflow.env.machine",
"oneflow.env.ctrl_port",
"oneflow.train.CheckPoint"
] | [((988, 1013), 'oneflow.env.ctrl_port', 'flow.env.ctrl_port', (['(12138)'], {}), '(12138)\n', (1006, 1013), True, 'import oneflow as flow\n'), ((1173, 1196), 'oneflow.env.machine', 'flow.env.machine', (['nodes'], {}), '(nodes)\n', (1189, 1196), True, 'import oneflow as flow\n'), ((8007, 8030), 'oneflow.train.CheckPoint... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.compatible.single_client.scope.mirrored_view",
"oneflow.compatible.single_client.matmul",
"oneflow.compatible.single_client.FunctionConfig",
"oneflow.compatible.single_client.config.gpu_device_num",
"oneflow.compatible.single_client.reshape",
"oneflow.compatible.single_client.cast_to_current_logi... | [((834, 920), 'unittest.skipIf', 'unittest.skipIf', (['(True)', '"""skip for now because of single-client tensor_list removed"""'], {}), "(True,\n 'skip for now because of single-client tensor_list removed')\n", (849, 920), False, 'import unittest\n'), ((2364, 2379), 'unittest.main', 'unittest.main', ([], {}), '()\n... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.optim.LAMB",
"oneflow.device",
"oneflow.unittest.skip_unless_1n1d"
] | [((4376, 4408), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (4406, 4408), True, 'import oneflow as flow\n'), ((1012, 1032), 'numpy.random.seed', 'np.random.seed', (['(1000)'], {}), '(1000)\n', (1026, 1032), True, 'import numpy as np\n'), ((2076, 2107), 'oneflow.optim.LAMB', ... |
"""
@author: <NAME> <<EMAIL>>
"""
import os
import sys
import numpy as np
import soundfile as sf
import oneflow as flow
import oneflow.nn as nn
import oneflow.optim as optim
from model.dnn_models import MLP
from model.SincNet import SincNet as CNN
from utils.data_utils import ReadList, read_conf, str_to_bool, create_... | [
"oneflow.argmax",
"oneflow.sum",
"oneflow.zeros",
"oneflow.Tensor",
"oneflow.nn.NLLLoss",
"oneflow.no_grad"
] | [((363, 374), 'utils.data_utils.read_conf', 'read_conf', ([], {}), '()\n', (372, 374), False, 'from utils.data_utils import ReadList, read_conf, str_to_bool, create_batches_rnd\n'), ((868, 908), 'utils.data_utils.str_to_bool', 'str_to_bool', (['options.cnn_use_laynorm_inp'], {}), '(options.cnn_use_laynorm_inp)\n', (879... |
import argparse
import os
import sys
import glob
import time
import math
import numpy as np
import psutil
import oneflow as flow
import oneflow.nn as nn
from petastorm.reader import make_batch_reader
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
num_dense_fields = 13
num_spa... | [
"oneflow.save",
"oneflow.nn.BCELoss",
"oneflow.one_embedding.make_device_mem_store_options",
"oneflow.boxing.nccl.enable_all_to_all",
"oneflow.sbp.broadcast",
"oneflow._C.binary_cross_entropy_loss",
"oneflow.env.all_device_placement",
"oneflow.amp.GradScaler",
"oneflow.nn.ReLU",
"oneflow.optim.lr_... | [((514, 539), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (537, 539), False, 'import argparse\n'), ((7464, 7489), 'oneflow.env.get_world_size', 'flow.env.get_world_size', ([], {}), '()\n', (7487, 7489), True, 'import oneflow as flow\n'), ((15591, 15648), 'math.ceil', 'math.ceil', (['(args.nu... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.compatible.single_client.clear_default_session",
"oneflow.compatible.single_client.nn.ctc_greedy_decoder",
"oneflow.compatible.single_client.FunctionConfig",
"oneflow.compatible.single_client.unittest.skip_unless_1n2d",
"oneflow.compatible.single_client.typing.Numpy.Placeholder",
"oneflow.compati... | [((4753, 4785), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (4783, 4785), True, 'from oneflow.compatible import single_client as flow\n'), ((4964, 4996), 'oneflow.compatible.single_client.unittest.skip_unless_1n2d', 'flow.unittest.skip_unless_1n2d', ... |
""" ELBO """
import oneflow.experimental as flow
class ELBO(flow.nn.Module):
def __init__(self, generator, variational):
super(ELBO, self).__init__()
self.generator = generator
self.variational = variational
def log_joint(self, nodes):
log_joint_ = None
for n_name in n... | [
"oneflow.experimental.mean"
] | [((918, 943), 'oneflow.experimental.mean', 'flow.mean', (['(logpxz - logqz)'], {}), '(logpxz - logqz)\n', (927, 943), True, 'import oneflow.experimental as flow\n')] |
import oneflow as flow
import os
import oneflow.nn as nn
import yaml
from model import AE
from data_utils import get_data_loader
from data_utils import PickleDataset
from utils import *
import time
import re
import shutil
class Solver(object):
def __init__(self, config, args):
# config store the value of ... | [
"oneflow.mul",
"oneflow.nn.L1Loss",
"oneflow.exp"
] | [((541, 595), 'os.makedirs', 'os.makedirs', (['self.args.store_model_path'], {'exist_ok': '(True)'}), '(self.args.store_model_path, exist_ok=True)\n', (552, 595), False, 'import os\n'), ((1367, 1601), 'data_utils.get_data_loader', 'get_data_loader', (['self.train_dataset'], {'frame_size': "self.config['data_loader']['f... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.nn.Linear",
"oneflow.nn.Flatten",
"oneflow.current_scope",
"oneflow.randn",
"oneflow.framework.graph_build_util.scope_to_proto",
"oneflow.unittest.skip_unless_1n1d",
"oneflow.nn.MSELoss"
] | [((860, 892), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (890, 892), True, 'import oneflow as flow\n'), ((800, 834), 'os.getenv', 'os.getenv', (['"""ONEFLOW_TEST_CPU_ONLY"""'], {}), "('ONEFLOW_TEST_CPU_ONLY')\n", (809, 834), False, 'import os\n'), ((4478, 4493), 'unittest.m... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.python.framework.id_util.UniqueStr",
"oneflow.transpose",
"oneflow.python.oneflow_export.oneflow_export"
] | [((1137, 1162), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""one_hot"""'], {}), "('one_hot')\n", (1151, 1162), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((4856, 4885), 'oneflow.transpose', 'flow.transpose', (['out', 'dim_list'], {}), '(out, dim_list)\n', (4870, 488... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.python.framework.distribute.assert_is_valid_distribute",
"oneflow.python.framework.distribute.auto",
"oneflow.python.framework.distribute.split",
"oneflow.python.framework.distribute.broadcast"
] | [((900, 922), 'oneflow.python.framework.distribute.auto', 'distribute_util.auto', ([], {}), '()\n', (920, 922), True, 'import oneflow.python.framework.distribute as distribute_util\n'), ((2616, 2676), 'oneflow.python.framework.distribute.assert_is_valid_distribute', 'distribute_util.assert_is_valid_distribute', (['self... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.compatible.single_client.python.lib.core.enable_if.unique",
"oneflow.compatible.single_client.python.lib.core.enable_if.condition",
"oneflow.compatible.single_client.advanced.distribute_split",
"oneflow.compatible.single_client.python.framework.id_util.UniqueStr",
"oneflow.compatible.single_client.... | [((1389, 1432), 'oneflow.compatible.single_client.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""math.two_stage_reduce_max"""'], {}), "('math.two_stage_reduce_max')\n", (1403, 1432), False, 'from oneflow.compatible.single_client.python.oneflow_export import oneflow_export\n'), ((1776, 1815), 'oneflow.co... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.experimental.nn.MaxPool1d",
"oneflow.experimental.device",
"oneflow.experimental.nn.MaxPool3d",
"oneflow.experimental.nn.MaxPool2d",
"oneflow.experimental.unittest.skip_unless_1n1d"
] | [((23252, 23284), 'oneflow.experimental.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (23282, 23284), True, 'import oneflow.experimental as flow\n'), ((6240, 6916), 'numpy.array', 'np.array', (['[[[-0.89042996, 2.33971243, -0.86660827, 0.80398747], [-1.46769364, -\n 0.78125064, 1.50... |
import oneflow as flow
from flowvision.data import Mixup
def test_mixup(x, target, switch_prob=0.5, mode="batch"):
mixup = Mixup(
mixup_alpha=1.0,
cutmix_alpha=1.0,
switch_prob=switch_prob,
label_smoothing=0.0,
mode=mode,
)
x, target = mixup(x, target)
return x... | [
"oneflow.arange",
"oneflow.randn"
] | [((130, 231), 'flowvision.data.Mixup', 'Mixup', ([], {'mixup_alpha': '(1.0)', 'cutmix_alpha': '(1.0)', 'switch_prob': 'switch_prob', 'label_smoothing': '(0.0)', 'mode': 'mode'}), '(mixup_alpha=1.0, cutmix_alpha=1.0, switch_prob=switch_prob,\n label_smoothing=0.0, mode=mode)\n', (135, 231), False, 'from flowvision.da... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.python.framework.scope_util.MakeScope",
"oneflow.python.framework.hob.is_trainable",
"oneflow.core.operator.op_conf_pb2.OperatorConf",
"oneflow.python.framework.remote_blob.RemoteBlob",
"oneflow.python.framework.id_util.UniqueStr",
"oneflow.python.lib.core.enable_if.condition",
"oneflow.python.... | [((2277, 2347), 'oneflow.python.lib.core.enable_if.condition', 'enable_if.condition', (['(hob.in_global_mode & ~hob.eager_execution_enabled)'], {}), '(hob.in_global_mode & ~hob.eager_execution_enabled)\n', (2296, 2347), True, 'import oneflow.python.lib.core.enable_if as enable_if\n'), ((2801, 2870), 'oneflow.python.lib... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.nn.MaxPool2d",
"oneflow.test_utils.test_util.GenArgList"
] | [((5672, 5790), 'oneflow.nn.MaxPool2d', 'flow.nn.MaxPool2d', ([], {'kernel_size': 'kernel_size', 'stride': 'stride', 'padding': 'padding', 'dilation': 'dilation', 'ceil_mode': 'ceil_mode'}), '(kernel_size=kernel_size, stride=stride, padding=padding,\n dilation=dilation, ceil_mode=ceil_mode)\n', (5689, 5790), True, '... |
import json
import os
import oneflow as flow
import oneflow.nn as nn
from models.CPT import CPT
class ClueAFQMCCPT(nn.Module):
def __init__(self, pretrain_dir, num_labels, is_train):
super(ClueAFQMCCPT, self).__init__()
kwargs_path = os.path.join(pretrain_dir, "parameters.json")
with open... | [
"oneflow.nn.Linear"
] | [((257, 302), 'os.path.join', 'os.path.join', (['pretrain_dir', '"""parameters.json"""'], {}), "(pretrain_dir, 'parameters.json')\n", (269, 302), False, 'import os\n'), ((395, 408), 'models.CPT.CPT', 'CPT', ([], {}), '(**kwargs)\n', (398, 408), False, 'from models.CPT import CPT\n'), ((573, 609), 'oneflow.nn.Linear', '... |
import itertools
import numpy as np
import os
import unittest
from collections import OrderedDict
from collections.abc import Iterable
from PIL import Image
import oneflow as flow
import flowvision.transforms as transforms
import flowvision.transforms.functional as F
import flowvision.transforms.functional_tensor as F... | [
"oneflow.rand",
"oneflow.manual_seed"
] | [((642, 666), 'itertools.product', 'itertools.product', (['*sets'], {}), '(*sets)\n', (659, 666), False, 'import itertools\n'), ((1096, 1129), 'PIL.Image.fromarray', 'Image.fromarray', (['x_np'], {'mode': '"""RGB"""'}), "(x_np, mode='RGB')\n", (1111, 1129), False, 'from PIL import Image\n'), ((1156, 1185), 'flowvision.... |
from logging import log
import os
import math
import oneflow as flow
import logging
import oneflow.nn as nn
from otrans.model.base import BaseModel
from otrans.frontend import BuildFrontEnd
from otrans.encoder import BuildEncoder
from otrans.decoder import BuildDecoder
from otrans.module.loss import LabelSmoothingLoss
... | [
"oneflow.load"
] | [((371, 398), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (388, 398), False, 'import logging\n'), ((984, 1076), 'otrans.module.loss.LabelSmoothingLoss', 'LabelSmoothingLoss', ([], {'size': "params['decoder']['vocab_size']", 'smoothing': "params['smoothing']"}), "(size=params['decoder']... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.Size"
] | [((4279, 4294), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4292, 4294), False, 'import unittest\n'), ((1100, 1166), 'numpy.array', 'np.array', (['[[[[0.0, -3.0], [2.0, 5.0]], [[4.0, 7.0], [6.0, 15.0]]]]'], {}), '([[[[0.0, -3.0], [2.0, 5.0]], [[4.0, 7.0], [6.0, 15.0]]]])\n', (1108, 1166), True, 'import numpy a... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.Tensor"
] | [((1001, 1029), 'oneflow.Tensor', 'flow.Tensor', (['*args'], {}), '(*args, **kwargs)\n', (1012, 1029), True, 'import oneflow as flow\n'), ((1227, 1255), 'oneflow.Tensor', 'flow.Tensor', (['*args'], {}), '(*args, **kwargs)\n', (1238, 1255), True, 'import oneflow as flow\n'), ((1454, 1482), 'oneflow.Tensor', 'flow.Tensor... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.FunctionConfig",
"oneflow.scope.consistent_view",
"oneflow.hierarchical_parallel_cast",
"oneflow.config.enable_legacy_model_io",
"oneflow.global_function",
"oneflow.unittest.skip_unless_1n4d",
"oneflow.unittest.skip_unless_2n4d",
"oneflow.data.megatron_gpt_mmap_data_loader",
"oneflow.train.... | [((1445, 1473), 'oneflow.clear_default_session', 'flow.clear_default_session', ([], {}), '()\n', (1471, 1473), True, 'import oneflow as flow\n'), ((1478, 1507), 'oneflow.config.cpu_device_num', 'flow.config.cpu_device_num', (['(4)'], {}), '(4)\n', (1504, 1507), True, 'import oneflow as flow\n'), ((1512, 1552), 'oneflow... |
#!/usr/bin/python3
import time
from functools import partial
from typing import Dict
import numpy as np
import oneflow as flow
from oneflow import nn
import sys
sys.path.append(".")
from modeling import BertForPreTraining
from utils.ofrecord_data_utils import OfRecordDataLoader
from utils.lr_scheduler import Polyno... | [
"oneflow.optim.lr_scheduler.WarmUpLR",
"oneflow.sum",
"oneflow.boxing.nccl.set_fusion_max_ops_num",
"oneflow.amp.GradScaler",
"oneflow.env.get_rank",
"oneflow.nn.CrossEntropyLoss",
"oneflow.reshape",
"oneflow.no_grad",
"oneflow.env.get_world_size",
"oneflow.nn.GELU",
"oneflow.boxing.nccl.set_fus... | [((165, 185), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (180, 185), False, 'import sys\n'), ((553, 572), 'config.get_parser', 'config.get_parser', ([], {}), '()\n', (570, 572), False, 'import config\n'), ((4163, 4199), 'utils.comm.ttol', 'ttol', (['next_sent_output', 'metric_local'], {}), '(ne... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.FunctionConfig",
"oneflow.tensor_buffer_to_tensor_list",
"oneflow.convert_oneflow_dtype_to_numpy_dtype",
"oneflow.tensor_list_to_tensor_buffer",
"oneflow.global_function",
"oneflow.typing.ListListNumpy.Placeholder",
"oneflow.clear_default_session",
"oneflow.scope.mirrored_view",
"oneflow.im... | [((10347, 10433), 'unittest.skipIf', 'unittest.skipIf', (['(True)', '"""skip for now because of single-client tensor_list removed"""'], {}), "(True,\n 'skip for now because of single-client tensor_list removed')\n", (10362, 10433), False, 'import unittest\n'), ((960, 1022), 'oneflow.global_function', 'flow.global_fu... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.math.multiply",
"oneflow.math.reduce_sum",
"oneflow.math.reduced_shape_elem_cnt"
] | [((2290, 2363), 'oneflow.math.reduce_sum', 'flow.math.reduce_sum', (['input_blob'], {'axis': 'axis', 'keepdims': 'keepdims', 'name': 'name'}), '(input_blob, axis=axis, keepdims=keepdims, name=name)\n', (2310, 2363), True, 'import oneflow as flow\n'), ((2431, 2510), 'oneflow.math.reduced_shape_elem_cnt', 'flow.math.redu... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.python.framework.id_util.UniqueStr",
"oneflow.user_op_builder",
"oneflow.python.oneflow_export.oneflow_export"
] | [((912, 953), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""tensor_buffer_to_tensor"""'], {}), "('tensor_buffer_to_tensor')\n", (926, 953), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((1737, 1778), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['... |
import oneflow as flow
class scloss(object):
def __init__(self,cnum = 3):
self.cnum = cnum
def ccmp(self,input, kernel_size, stride):
input = flow.transpose(input, perm=[0, 3, 2, 1])
input = flow.nn.max_pool2d(input, kernel_size, stride, padding="VALID")
input = flow.transpose(in... | [
"oneflow.nn.softmax",
"oneflow.transpose",
"oneflow.zeros_initializer",
"oneflow.variance_scaling_initializer",
"oneflow.reshape",
"oneflow.nn.max_pool2d",
"oneflow.math.reduce_sum",
"oneflow.nn.softmax_cross_entropy_with_logits"
] | [((166, 206), 'oneflow.transpose', 'flow.transpose', (['input'], {'perm': '[0, 3, 2, 1]'}), '(input, perm=[0, 3, 2, 1])\n', (180, 206), True, 'import oneflow as flow\n'), ((223, 286), 'oneflow.nn.max_pool2d', 'flow.nn.max_pool2d', (['input', 'kernel_size', 'stride'], {'padding': '"""VALID"""'}), "(input, kernel_size, s... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.python.framework.id_util.UniqueStr",
"oneflow.user_op_builder",
"oneflow.python.oneflow_export.oneflow_export"
] | [((1220, 1248), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""math.atan2"""'], {}), "('math.atan2')\n", (1234, 1248), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((2459, 2485), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""math.pow"""'], {}),... |
# coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
#
# 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 require... | [
"oneflow.no_grad",
"oneflow.cuda.is_available"
] | [((1021, 1057), 'logging.getLogger', 'logging.getLogger', (['"""libai.inference"""'], {}), "('libai.inference')\n", (1038, 1057), False, 'import logging\n'), ((995, 1010), 'libai.utils.distributed.get_rank', 'dist.get_rank', ([], {}), '()\n', (1008, 1010), True, 'from libai.utils import distributed as dist\n'), ((1359,... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.FunctionConfig",
"oneflow.dtypes",
"oneflow.global_function",
"oneflow.user_op_builder",
"oneflow.typing.Numpy.Placeholder",
"oneflow.clear_default_session"
] | [((1184, 1212), 'oneflow.clear_default_session', 'flow.clear_default_session', ([], {}), '()\n', (1210, 1212), True, 'import oneflow as flow\n'), ((1231, 1252), 'oneflow.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (1250, 1252), True, 'import oneflow as flow\n'), ((1305, 1354), 'oneflow.global_function', '... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.experimental.abs",
"oneflow.experimental.argwhere",
"oneflow.experimental.square",
"oneflow.experimental.min",
"oneflow.python.framework.tensor.register_tensor_op",
"oneflow.python.oneflow_export.oneflow_export",
"oneflow.experimental.max"
] | [((7357, 7386), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""linalg.norm"""'], {}), "('linalg.norm')\n", (7371, 7386), False, 'from oneflow.python.oneflow_export import oneflow_export, experimental_api\n'), ((12806, 12832), 'oneflow.python.framework.tensor.register_tensor_op', 'register_tenso... |
"""
Modified from https://github.com/z-x-yang/GCT/blob/master/PyTorch/GCT.py
"""
import oneflow as flow
import oneflow.nn as nn
import oneflow.nn.functional as F
class GCTModule(nn.Module):
def __init__(self, channels, epsilon=1e-5, mode="l2", after_relu=False):
super(GCTModule, self).__init__()
... | [
"oneflow.abs",
"oneflow.zeros",
"oneflow.tanh",
"oneflow.ones"
] | [((347, 375), 'oneflow.ones', 'flow.ones', (['(1)', 'channels', '(1)', '(1)'], {}), '(1, channels, 1, 1)\n', (356, 375), True, 'import oneflow as flow\n'), ((411, 440), 'oneflow.zeros', 'flow.zeros', (['(1)', 'channels', '(1)', '(1)'], {}), '(1, channels, 1, 1)\n', (421, 440), True, 'import oneflow as flow\n'), ((475, ... |
# !/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Copyright 2020 Tianshu AI Platform. All Rights Reserved.
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/LICEN... | [
"oneflow.function_config",
"oneflow.train.CheckPoint",
"oneflow.FixedTensorDef",
"oneflow.nn.softmax"
] | [((968, 993), 'codecs.getwriter', 'codecs.getwriter', (['"""utf-8"""'], {}), "('utf-8')\n", (984, 993), False, 'import codecs\n'), ((994, 1013), 'sys.stdout.detach', 'sys.stdout.detach', ([], {}), '()\n', (1011, 1013), False, 'import sys\n'), ((1169, 1198), 'os.path.isdir', 'os.path.isdir', (['model_load_dir'], {}), '(... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.zeros_like",
"oneflow.builtin_op",
"oneflow.no_grad"
] | [((5523, 5537), 'oneflow.no_grad', 'flow.no_grad', ([], {}), '()\n', (5535, 5537), True, 'import oneflow as flow\n'), ((5797, 5855), 'math.pow', 'math.pow', (["param_group['betas'][0]", "(self._state['step'] + 1)"], {}), "(param_group['betas'][0], self._state['step'] + 1)\n", (5805, 5855), False, 'import math\n'), ((59... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.FunctionConfig",
"oneflow.scope.consistent_view",
"oneflow.zeros_like",
"oneflow.optimizer.PiecewiseConstantScheduler",
"oneflow.global_function",
"oneflow.typing.Numpy.Placeholder",
"oneflow.nn.leaky_relu",
"oneflow.nn.compat_conv2d",
"oneflow.nn.bias_add",
"oneflow.reshape",
"oneflow.... | [((706, 740), 'os.getenv', 'os.getenv', (['"""ONEFLOW_TEST_CPU_ONLY"""'], {}), "('ONEFLOW_TEST_CPU_ONLY')\n", (715, 740), False, 'import os\n'), ((859, 893), 'os.getenv', 'os.getenv', (['"""ONEFLOW_TEST_CPU_ONLY"""'], {}), "('ONEFLOW_TEST_CPU_ONLY')\n", (868, 893), False, 'import os\n'), ((1197, 1232), 'oneflow.config.... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.unittest.skip_unless_1n1d",
"oneflow.placement",
"oneflow.device"
] | [((714, 746), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (744, 746), True, 'import oneflow as flow\n'), ((1094, 1109), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1107, 1109), False, 'import unittest\n'), ((847, 866), 'oneflow.device', 'flow.device', (['"""mock"""'... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.experimental.nn.CrossEntropyLoss",
"oneflow.experimental.unittest.env.eager_execution_enabled",
"oneflow.experimental.Tensor"
] | [((4904, 4919), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4917, 4919), False, 'import unittest\n'), ((775, 975), 'numpy.array', 'np.array', (['[[-0.6980871, 0.4765042, -1.969919, 0.28965086, -0.53548324], [-0.26332688,\n 0.27541, 0.30080616, 0.09914763, 0.53522176], [0.7332028, 0.38375184, -\n 0.283199... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.nn.Parameter",
"oneflow.randint",
"oneflow.Generator",
"oneflow.randn",
"oneflow._C.gather",
"oneflow.unittest.skip_unless_1n1d",
"oneflow.placement"
] | [((1552, 1584), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1582, 1584), True, 'import oneflow as flow\n'), ((1339, 1355), 'oneflow.Generator', 'flow.Generator', ([], {}), '()\n', (1353, 1355), True, 'import oneflow as flow\n'), ((1396, 1472), 'oneflow.randint', 'flow.randi... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.framework.docstr.utils.add_docstr"
] | [((660, 1657), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.chunk', '"""Splits a tensor into a specific number of chunks. Each chunk is a view of the input tensor. Last chunk will be bigger if the tensor size along the given dimension dim is not divisible by chunks.\n\n Args:\n input ... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.FunctionConfig",
"oneflow.scope.consistent_view",
"oneflow.eager_nccl_all_reduce",
"oneflow.global_function",
"oneflow.config.gpu_device_num",
"oneflow.typing.Numpy.Placeholder"
] | [((673, 702), 'oneflow.config.gpu_device_num', 'flow.config.gpu_device_num', (['(4)'], {}), '(4)\n', (699, 702), True, 'import oneflow as flow\n'), ((718, 739), 'oneflow.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (737, 739), True, 'import oneflow as flow\n'), ((815, 843), 'oneflow.scope.consistent_view',... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow._C.unfold",
"oneflow.nn.modules.utils._pair",
"oneflow._C.fold"
] | [((6737, 6773), 'doctest.testmod', 'doctest.testmod', ([], {'raise_on_error': '(True)'}), '(raise_on_error=True)\n', (6752, 6773), False, 'import doctest\n'), ((3087, 3105), 'oneflow.nn.modules.utils._pair', '_pair', (['kernel_size'], {}), '(kernel_size)\n', (3092, 3105), False, 'from oneflow.nn.modules.utils import _p... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agreed... | [
"oneflow.env.grpc_use_no_signal",
"oneflow.FunctionConfig",
"oneflow.train.CheckPoint",
"oneflow.global_function",
"oneflow.config.gpu_device_num",
"oneflow.typing.Numpy.Placeholder",
"oneflow.env.log_dir"
] | [((804, 859), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (827, 859), False, 'import warnings\n'), ((2244, 2265), 'oneflow.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (2263, 2265), True, 'import oneflow as flo... |
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import math
import time
import oneflow as flow
# refer to: https://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html
teacher_forcing_ratio = 0.5
SOS_token = 0
EOS_token = 1
device = "cuda"
MAX_LENGTH = 10
eng_prefixes... | [
"oneflow.tensor"
] | [((621, 633), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (631, 633), True, 'import matplotlib.pyplot as plt\n'), ((1051, 1061), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1059, 1061), True, 'import matplotlib.pyplot as plt\n'), ((1094, 1106), 'matplotlib.pyplot.figure', 'plt.figure', ([],... |
# coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
#
# 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 require... | [
"oneflow.cat"
] | [((1066, 1110), 'random.uniform', 'random.uniform', (['self.sigma[0]', 'self.sigma[1]'], {}), '(self.sigma[0], self.sigma[1])\n', (1080, 1110), False, 'import random\n'), ((1334, 1354), 'PIL.ImageOps.solarize', 'ImageOps.solarize', (['x'], {}), '(x)\n', (1351, 1354), False, 'from PIL import ImageFilter, ImageOps\n'), (... |
import oneflow as flow
import numpy as np
import cv2
from PIL import Image
import matplotlib.pyplot as plt
np.set_printoptions(threshold=np.inf)
def watch_handler(y: flow.typing.Numpy):
sub_img = y[0,0,:,:]
sub_img = 1.0 / (1+np.exp(-1 * sub_img))
sub_img = np.round(sub_img*255)
# cv2.imwrite('sub_imag... | [
"oneflow.nn.relu",
"oneflow.get_variable",
"oneflow.zeros_initializer",
"oneflow.variance_scaling_initializer",
"oneflow.nn.bias_add",
"oneflow.reshape",
"oneflow.concat",
"oneflow.nn.conv2d_transpose",
"oneflow.math.add",
"oneflow.nn.avg_pool2d",
"oneflow.constant_initializer",
"oneflow.layer... | [((108, 145), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (127, 145), True, 'import numpy as np\n'), ((271, 294), 'numpy.round', 'np.round', (['(sub_img * 255)'], {}), '(sub_img * 255)\n', (279, 294), True, 'import numpy as np\n'), ((12821, 12848), 'oneflow.re... |
#-*- coding:utf-8 -*-
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 a... | [
"oneflow.function_config",
"oneflow.train.CheckPoint"
] | [((1692, 1714), 'oneflow.function_config', 'flow.function_config', ([], {}), '()\n', (1712, 1714), True, 'import oneflow as flow\n'), ((1974, 1993), 'glob.glob', 'glob', (["(img_dir + '*')"], {}), "(img_dir + '*')\n", (1978, 1993), False, 'from glob import glob\n'), ((3040, 3051), 'time.time', 'time.time', ([], {}), '(... |
import os
import json
import oneflow as flow
from oneflow.utils.data import Dataset
def read_data(task_name, split):
fn = os.path.join(task_name, split, "{}.json".format(split))
input_ids = []
attention_mask = []
labels = []
with open(fn, "r") as f:
result = json.load(f)
for pack_... | [
"oneflow.tensor"
] | [((515, 555), 'oneflow.tensor', 'flow.tensor', (['input_ids'], {'dtype': 'flow.int32'}), '(input_ids, dtype=flow.int32)\n', (526, 555), True, 'import oneflow as flow\n'), ((577, 622), 'oneflow.tensor', 'flow.tensor', (['attention_mask'], {'dtype': 'flow.int32'}), '(attention_mask, dtype=flow.int32)\n', (588, 622), True... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.compatible.single_client.unittest.skip_unless_1n1d",
"oneflow.compatible.single_client.FunctionConfig",
"oneflow.compatible.single_client.scope.placement",
"oneflow.compatible.single_client.experimental.unique_with_counts",
"oneflow.compatible.single_client.typing.Numpy.Placeholder",
"oneflow.com... | [((762, 783), 'oneflow.compatible.single_client.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (781, 783), True, 'from oneflow.compatible import single_client as flow\n'), ((1865, 1897), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1895, 1... |
from models.seq_seq_oneflow import *
from utils.utils_oneflow import *
import oneflow.optim as optim
import oneflow.nn as nn
import time
import random
import argparse
# refer to: https://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html
def _parse_args():
parser = argparse.ArgumentParser("fla... | [
"oneflow.nn.NLLLoss"
] | [((292, 342), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""flags for train seq2seq"""'], {}), "('flags for train seq2seq')\n", (315, 342), False, 'import argparse\n'), ((3295, 3306), 'time.time', 'time.time', ([], {}), '()\n', (3304, 3306), False, 'import time\n'), ((3727, 3739), 'oneflow.nn.NLLLoss', 'n... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow._oneflow_internal.CudaGetDeviceCount",
"oneflow._oneflow_internal.GetCudaDeviceIndex"
] | [((969, 1012), 'oneflow._oneflow_internal.CudaGetDeviceCount', 'flow._oneflow_internal.CudaGetDeviceCount', ([], {}), '()\n', (1010, 1012), True, 'import oneflow as flow\n'), ((1102, 1145), 'oneflow._oneflow_internal.GetCudaDeviceIndex', 'flow._oneflow_internal.GetCudaDeviceIndex', ([], {}), '()\n', (1143, 1145), True,... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.framework.docstr.utils.add_docstr"
] | [((660, 1443), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.bmm', '"""\n Performs a batch matrix-matrix product of matrices stored in input and mat2.\n\n `input` and `mat2` must be 3-D tensors each containing the same number of matrices.\n\n If input is a (b x n x m) tensor, mat2 is a ... |
from .utils import get_dropout_mask
import math
from typing import Optional, List, Tuple
import oneflow as flow
class LstmCellWithProjection(flow.nn.Module):
def __init__(
self,
input_size: int,
hidden_size: int,
cell_size: int,
go_forward: bool = True,
recurrent_d... | [
"oneflow.nn.Linear",
"oneflow.tanh",
"oneflow.sigmoid",
"oneflow.clamp",
"oneflow.zeros"
] | [((928, 981), 'oneflow.nn.Linear', 'flow.nn.Linear', (['input_size', '(4 * cell_size)'], {'bias': '(False)'}), '(input_size, 4 * cell_size, bias=False)\n', (942, 981), True, 'import oneflow as flow\n'), ((1013, 1066), 'oneflow.nn.Linear', 'flow.nn.Linear', (['hidden_size', '(4 * cell_size)'], {'bias': '(True)'}), '(hid... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.framework.docstr.utils.add_docstr"
] | [((660, 1291), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.F.prelu', '"""\n prelu(x: Tensor, alpha: Tensor) -> Tensor \n\n Applies the element-wise function:\n\n .. math::\n prelu(x) = max(0,x) + alpha * min(0,x) \n\n For example:\n\n .. code-block:: python\n\n >>... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.framework.tensor.register_tensor_op",
"oneflow.F.broadcast_mul",
"oneflow.F.transpose",
"oneflow.F.cosh",
"oneflow.F.log",
"oneflow.F.add",
"oneflow.F.asinh",
"oneflow.F.rsqrt",
"oneflow.sum",
"oneflow.F.cast",
"oneflow.F.broadcast_add",
"oneflow.F.mul",
"oneflow.F.sqrt",
"oneflow... | [((1755, 1780), 'oneflow.framework.tensor.register_tensor_op', 'register_tensor_op', (['"""mul"""'], {}), "('mul')\n", (1773, 1780), False, 'from oneflow.framework.tensor import register_tensor_op\n'), ((3779, 3804), 'oneflow.framework.tensor.register_tensor_op', 'register_tensor_op', (['"""var"""'], {}), "('var')\n", ... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.device"
] | [((1355, 1370), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1368, 1370), False, 'import unittest\n'), ((818, 846), 'numpy.random.random', 'np.random.random', (['(1, 10, 2)'], {}), '((1, 10, 2))\n', (834, 846), True, 'import numpy as np\n'), ((924, 942), 'oneflow.device', 'flow.device', (['"""cpu"""'], {}), "('... |
from transformer import Transformer
import numpy as np
import math
import sys
import oneflow as flow
import oneflow.nn as nn
sys.path.append("../")
TO_CUDA = True
def to_cuda(tensor, flag=TO_CUDA, where="cuda"):
if flag:
return tensor.to(where)
else:
return tensor
class Embeddings(nn.Modu... | [
"oneflow.nn.Softmax",
"oneflow.nn.Parameter",
"oneflow.nn.Linear",
"oneflow.nn.Embedding",
"oneflow.cos",
"oneflow.zeros",
"oneflow.arange",
"oneflow.sin",
"oneflow.nn.Dropout",
"oneflow.tensor",
"oneflow.ones"
] | [((127, 149), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (142, 149), False, 'import sys\n'), ((427, 455), 'oneflow.nn.Embedding', 'nn.Embedding', (['vocab', 'd_model'], {}), '(vocab, d_model)\n', (439, 455), True, 'import oneflow.nn as nn\n'), ((740, 761), 'oneflow.nn.Dropout', 'nn.Dropout'... |
"""
Modified from https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/registry.py
"""
import sys
import re
import fnmatch
from collections import defaultdict
from copy import deepcopy
from tabulate import tabulate
import oneflow as flow
def _natural_key(string_):
return [int(s) if s.isdigit... | [
"oneflow.load"
] | [((424, 440), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (435, 440), False, 'from collections import defaultdict\n'), ((2929, 3006), 'tabulate.tabulate', 'tabulate', (['table_items'], {'headers': 'table_headers', 'tablefmt': '"""fancy_grid"""'}), "(table_items, headers=table_headers, tablefmt='... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.python.framework.c_api_util.GetMachine2DeviceIdListOFRecordFromParallelConf"
] | [((1415, 1473), 'functools.reduce', 'functools.reduce', (['(lambda a, b: a + b)', 'sub_parallel_nums', '(0)'], {}), '(lambda a, b: a + b, sub_parallel_nums, 0)\n', (1431, 1473), False, 'import functools\n'), ((2973, 3046), 'oneflow.python.framework.c_api_util.GetMachine2DeviceIdListOFRecordFromParallelConf', 'c_api_uti... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.core.job.sbp_parallel_pb2.SbpParallel",
"oneflow.python.framework.dtype.convert_proto_dtype_to_oneflow_dtype",
"oneflow.core.job.mirrored_parallel_pb2.OptMirroredParallel"
] | [((6939, 6968), 'oneflow.core.job.sbp_parallel_pb2.SbpParallel', 'sbp_parallel_pb.SbpParallel', ([], {}), '()\n', (6966, 6968), True, 'import oneflow.core.job.sbp_parallel_pb2 as sbp_parallel_pb\n'), ((6997, 7039), 'oneflow.core.job.mirrored_parallel_pb2.OptMirroredParallel', 'mirrored_parallel_pb.OptMirroredParallel',... |
import os
import pickle
import numpy as np
import soundfile as sf
import librosa
import oneflow as flow
from model.model import Generator, Discriminator
from utils.dataset import VCDataset
import utils.data_utils as preprocess
class MaskCycleGANVCTrainer(object):
"""Trainer for MaskCycleGAN-VC
"""
def ... | [
"oneflow.optim.Adam",
"oneflow.tensor",
"oneflow.mean",
"oneflow.utils.data.DataLoader",
"oneflow.cuda.is_available",
"oneflow.abs",
"oneflow.ones_like"
] | [((1021, 1074), 'os.path.join', 'os.path.join', (['args.origin_data_dir', 'args.speaker_A_id'], {}), '(args.origin_data_dir, args.speaker_A_id)\n', (1033, 1074), False, 'import os\n'), ((1103, 1156), 'os.path.join', 'os.path.join', (['args.output_data_dir', 'args.speaker_A_id'], {}), '(args.output_data_dir, args.speake... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.python.framework.c_api_util.CurJobBuildAndInferCtx_AddLbiAndDiffWatcherUuidPair",
"oneflow.python.lib.core.enable_if.condition",
"oneflow.python.framework.typing_util.TransformWatchedBlob",
"oneflow.python.framework.parallel_conf_util.GetDeviceTagAndMachineDeviceIds",
"oneflow.core.operator.op_conf... | [((1728, 1751), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""watch"""'], {}), "('watch')\n", (1742, 1751), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((2214, 2283), 'oneflow.python.lib.core.enable_if.condition', 'enable_if.condition', (['(hob.in_global_mode & hob.ea... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.experimental.nn.BCEWithLogitsLoss",
"oneflow.experimental.unittest.env.eager_execution_enabled",
"oneflow.experimental.device"
] | [((859, 880), 'numpy.negative', 'np.negative', (['np_input'], {}), '(np_input)\n', (870, 880), True, 'import numpy as np\n'), ((896, 924), 'numpy.clip', 'np.clip', (['_neg_input', '(0)', 'None'], {}), '(_neg_input, 0, None)\n', (903, 924), True, 'import numpy as np\n'), ((944, 965), 'numpy.negative', 'np.negative', (['... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.nn.relu",
"oneflow.image.crop_mirror_normalize",
"oneflow.scope.consistent_view",
"oneflow.model.TrainingConfig",
"oneflow.optimizer.PiecewiseConstantScheduler",
"oneflow.model.CheckpointConfig",
"oneflow.model.ValidationConfig",
"oneflow.get_variable",
"oneflow.random_uniform_initializer",... | [((5314, 5338), 'oneflow.env.ctrl_port', 'flow.env.ctrl_port', (['(9788)'], {}), '(9788)\n', (5332, 5338), True, 'import oneflow as flow\n'), ((5343, 5390), 'oneflow.config.machine_num', 'flow.config.machine_num', (['global_specs.num_nodes'], {}), '(global_specs.num_nodes)\n', (5366, 5390), True, 'import oneflow as flo... |
# wujian@2018
import random
import numpy as np
from oneflow.utils.data.dataloader import default_collate
import oneflow.utils.data as dat
from .audio import WaveReader
def make_dataloader(
train=True, data_kwargs=None, num_workers=4, chunk_size=32000, batch_size=16
):
dataset = Dataset(**data_kwargs)
ret... | [
"oneflow.utils.data.dataloader.default_collate",
"oneflow.utils.data.DataLoader"
] | [((2924, 3045), 'oneflow.utils.data.DataLoader', 'dat.DataLoader', (['dataset'], {'batch_size': '(batch_size // 2)', 'num_workers': 'num_workers', 'shuffle': 'train', 'collate_fn': 'self._collate'}), '(dataset, batch_size=batch_size // 2, num_workers=num_workers,\n shuffle=train, collate_fn=self._collate)\n', (2938,... |
import os
import sys
import argparse
import pickle
import struct
import oneflow.core.record.record_pb2 as of_record
def parse_arguement(argv):
parser = argparse.ArgumentParser()
parser.add_argument('--data_dir', type=str, default='/home/qiaojing/git_repo_out/insightface/datasets/faces_emore',
... | [
"oneflow.core.record.record_pb2.Int32List",
"oneflow.core.record.record_pb2.DoubleList",
"oneflow.core.record.record_pb2.BytesList",
"oneflow.core.record.record_pb2.FloatList"
] | [((160, 185), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (183, 185), False, 'import argparse\n'), ((708, 753), 'os.path.join', 'os.path.join', (['data_dir', "(dataset_name + '.bin')"], {}), "(data_dir, dataset_name + '.bin')\n", (720, 753), False, 'import os\n'), ((2749, 2783), 'os.path.joi... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"oneflow.no_grad",
"oneflow.nn.Tanh",
"oneflow.nn.Conv2d",
"oneflow.nn.PixelShuffle",
"oneflow.nn.BatchNorm2d",
"oneflow.load",
"oneflow.Tensor",
"oneflow.nn.Sequential",
"oneflow.nn.PReLU"
] | [((4644, 4702), 'tvm.contrib.download.download_testdata', 'download_testdata', (['model_url', 'model_file'], {'module': '"""oneflow"""'}), "(model_url, model_file, module='oneflow')\n", (4661, 4702), False, 'from tvm.contrib.download import download_testdata\n'), ((4842, 4863), 'oneflow.load', 'flow.load', (['model_pat... |
"""
Modified from https://github.com/facebookresearch/deit/blob/main/resmlp_models.py
"""
import oneflow as flow
import oneflow.nn as nn
import oneflow.nn.init as init
from flowvision.layers import DropPath, PatchEmbed, Mlp
from .utils import load_state_dict_from_url
from .registry import ModelCreator
model_urls = {... | [
"oneflow.nn.init.constant_",
"oneflow.nn.Linear",
"oneflow.nn.init.trunc_normal_",
"oneflow.nn.Identity",
"oneflow.zeros",
"oneflow.ones"
] | [((2443, 2478), 'oneflow.nn.Linear', 'nn.Linear', (['num_patches', 'num_patches'], {}), '(num_patches, num_patches)\n', (2452, 2478), True, 'import oneflow.nn as nn\n'), ((2013, 2027), 'oneflow.ones', 'flow.ones', (['dim'], {}), '(dim)\n', (2022, 2027), True, 'import oneflow as flow\n'), ((2062, 2077), 'oneflow.zeros',... |
import oneflow as flow
import cv2
import numpy as np
def conv2d_layer(
input, num_filters, kernel_size=3, strides=1, padding="SAME",
data_format="NCHW", dilation_rate=1, use_bias=True,
weight_initializer=flow.xavier_uniform_initializer(),
bias_initializer=flow.zeros_initializer(), name="conv2d",
tr... | [
"oneflow.nn.relu",
"oneflow.xavier_uniform_initializer",
"oneflow.nn.leaky_relu",
"oneflow.zeros_initializer",
"oneflow.nn.bias_add",
"oneflow.layers.batch_normalization",
"oneflow.nn.conv2d_transpose",
"oneflow.nn.conv2d",
"oneflow.scope.namespace",
"oneflow.get_variable"
] | [((217, 250), 'oneflow.xavier_uniform_initializer', 'flow.xavier_uniform_initializer', ([], {}), '()\n', (248, 250), True, 'import oneflow as flow\n'), ((273, 297), 'oneflow.zeros_initializer', 'flow.zeros_initializer', ([], {}), '()\n', (295, 297), True, 'import oneflow as flow\n'), ((671, 746), 'oneflow.nn.conv2d', '... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.flip",
"oneflow.device"
] | [((976, 1003), 'oneflow.flip', 'flow.flip', (['input', '[0, 1, 2]'], {}), '(input, [0, 1, 2])\n', (985, 1003), True, 'import oneflow as flow\n'), ((1287, 1307), 'numpy.ones_like', 'np.ones_like', (['np_arr'], {}), '(np_arr)\n', (1299, 1307), True, 'import numpy as np\n'), ((1591, 1610), 'oneflow.flip', 'flow.flip', (['... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.experimental.nn.Dropout",
"oneflow.experimental.unittest.env.eager_execution_enabled",
"oneflow.experimental.Tensor"
] | [((2380, 2395), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2393, 2395), False, 'import unittest\n'), ((1462, 1582), 'numpy.array', 'np.array', (['[[-0.7797, 0.2264, 0.2458, 0.4163], [0.4299, 0.3626, -0.4892, 0.4141], [-\n 1.4115, 1.2183, -0.5503, 0.652]]'], {}), '([[-0.7797, 0.2264, 0.2458, 0.4163], [0.429... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.compatible.single_client.framework.session_context.GetDefaultSession"
] | [((727, 758), 'oneflow.compatible.single_client.framework.session_context.GetDefaultSession', 'session_ctx.GetDefaultSession', ([], {}), '()\n', (756, 758), True, 'from oneflow.compatible.single_client.framework import session_context as session_ctx\n')] |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.unittest.env.eager_execution_enabled",
"oneflow.device",
"oneflow.experimental.stack"
] | [((784, 806), 'numpy.random.rand', 'np.random.rand', (['*shape'], {}), '(*shape)\n', (798, 806), True, 'import numpy as np\n'), ((815, 837), 'numpy.random.rand', 'np.random.rand', (['*shape'], {}), '(*shape)\n', (829, 837), True, 'import numpy as np\n'), ((1007, 1031), 'numpy.stack', 'np.stack', (['[x, y]'], {'axis': '... |
# coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
#
# 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 require... | [
"oneflow.matmul",
"oneflow.sbp.split"
] | [((4567, 4594), 'oneflow.matmul', 'flow.matmul', (['x', 'self.weight'], {}), '(x, self.weight)\n', (4578, 4594), True, 'import oneflow as flow\n'), ((2979, 3036), 'libai.utils.distributed.get_nd_sbp', 'dist.get_nd_sbp', (['[flow.sbp.broadcast, flow.sbp.broadcast]'], {}), '([flow.sbp.broadcast, flow.sbp.broadcast])\n', ... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.device",
"oneflow.fmod"
] | [((834, 844), 'numpy.sign', 'np.sign', (['x'], {}), '(x)\n', (841, 844), True, 'import numpy as np\n'), ((945, 960), 'numpy.ones_like', 'np.ones_like', (['x'], {}), '(x)\n', (957, 960), True, 'import numpy as np\n'), ((1358, 1381), 'oneflow.fmod', 'flow.fmod', (['input', 'other'], {}), '(input, other)\n', (1367, 1381),... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.experimental.nn.Hardswish",
"oneflow.experimental.nn.GELU",
"oneflow.experimental.nn.ReLU6",
"oneflow.experimental.nn.ReLU",
"oneflow.experimental.nn.LogSigmoid",
"oneflow.experimental.nn.Softmax",
"oneflow.experimental.unittest.env.eager_execution_enabled",
"oneflow.experimental.nn.Hardsigmo... | [((8153, 8866), 'numpy.array', 'np.array', (['[[[[2.0, 1.0, 9.0, 3.0, 4.0], [1.0, 6.0, 7.0, 1.0, 4.0], [4.0, 7.0, 5.0, \n 8.0, 1.0], [9.0, 5.0, 7.0, 8.0, 5.0]], [[1.0, 1.0, 5.0, 3.0, 5.0], [3.0,\n 6.0, 3.0, 7.0, 8.0], [8.0, 8.0, 1.0, 2.0, 6.0], [3.0, 5.0, 6.0, 1.0, \n 1.0]], [[8.0, 3.0, 6.0, 3.0, 7.0], [8.0, 5... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.matmul",
"oneflow.global_function",
"oneflow.random_uniform_initializer"
] | [((691, 713), 'oneflow.global_function', 'flow.global_function', ([], {}), '()\n', (711, 713), True, 'import oneflow as flow\n'), ((1126, 1159), 'util.convert_to_onnx_and_check', 'convert_to_onnx_and_check', (['matmul'], {}), '(matmul)\n', (1151, 1159), False, 'from util import convert_to_onnx_and_check\n'), ((1198, 12... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.arange",
"oneflow.unittest.skip_unless_1n1d"
] | [((1667, 1699), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1697, 1699), True, 'import oneflow as flow\n'), ((796, 827), 'numpy.arange', 'np.arange', (['(13)'], {'dtype': 'np.float32'}), '(13, dtype=np.float32)\n', (805, 827), True, 'import numpy as np\n'), ((841, 891), 'on... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.FunctionConfig",
"oneflow.scatter_nd",
"oneflow.scope.consistent_view",
"oneflow.tensor_scatter_nd_update",
"oneflow.optimizer.PiecewiseConstantScheduler",
"oneflow.global_function",
"oneflow.typing.Numpy.Placeholder",
"oneflow.scope.mirrored_view",
"oneflow.tensor_scatter_nd_add",
"onefl... | [((789, 840), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (833, 840), True, 'import tensorflow as tf\n'), ((17428, 17460), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (17458, 17460)... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.FunctionConfig",
"oneflow.gather_nd",
"oneflow.scope.consistent_view",
"oneflow.optimizer.PiecewiseConstantScheduler",
"oneflow.global_function",
"oneflow.typing.Numpy.Placeholder",
"oneflow.scope.mirrored_view",
"oneflow.clear_default_session",
"oneflow.cast_to_current_logical_view",
"on... | [((763, 814), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (807, 814), True, 'import tensorflow as tf\n'), ((836, 887), 'tensorflow.config.experimental.set_memory_growth', 'tf.config.experimental.set_memory_growth', (['gpu', '(... |
import math
import oneflow as flow
from oneflow_gpt import distribute as dist
from oneflow_gpt.config import get_args
from oneflow_gpt.logger import print_rank_0
class GPTModel(flow.nn.Module):
def __init__(self):
super().__init__()
args = get_args()
self.batch_size = args.global_batch_si... | [
"oneflow._C.amp_white_identity",
"oneflow._C.gelu",
"oneflow._C.fused_bias_add_dropout",
"oneflow._C.identity",
"oneflow._C.fused_self_attention_query_mul_key_and_value",
"oneflow.nn.init.ones_",
"oneflow._C.layer_norm_affine",
"oneflow._C.softmax",
"oneflow._C.matmul",
"oneflow._C.gather",
"one... | [((263, 273), 'oneflow_gpt.config.get_args', 'get_args', ([], {}), '()\n', (271, 273), False, 'from oneflow_gpt.config import get_args\n'), ((1773, 1811), 'oneflow._C.matmul', 'flow._C.matmul', (['h', 'w'], {'transpose_b': '(True)'}), '(h, w, transpose_b=True)\n', (1787, 1811), True, 'import oneflow as flow\n'), ((2083... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.unittest.skip_unless_1n1d",
"oneflow.tensor",
"oneflow.dot"
] | [((675, 707), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (705, 707), True, 'import oneflow as flow\n'), ((1672, 1687), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1685, 1687), False, 'import unittest\n'), ((866, 885), 'oneflow.tensor', 'flow.tensor', (['[2, 3]'], {... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.compatible.single_client.framework.c_api_util.JobBuildAndInferCtx_GetDataType",
"oneflow.compatible.single_client.framework.session_context.GetDefaultSession",
"oneflow.compatible.single_client.framework.c_api_util.JobBuildAndInferCtx_GetStaticShape",
"oneflow.compatible.single_client.framework.c_api... | [((11040, 11100), 'oneflow.compatible.single_client.framework.c_api_util.JobBuildAndInferCtx_GetStaticShape', 'c_api_util.JobBuildAndInferCtx_GetStaticShape', (['job_name', 'lbn'], {}), '(job_name, lbn)\n', (11085, 11100), True, 'from oneflow.compatible.single_client.framework import c_api_util as c_api_util\n'), ((111... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.FunctionConfig",
"oneflow.assign",
"oneflow.sysconfig.has_rpc_backend_grpc",
"oneflow.random_uniform_initializer",
"oneflow.constant_initializer",
"oneflow.unittest.skip_unless_1n4d",
"oneflow.global_function",
"oneflow.scope.placement",
"oneflow.config.gpu_device_num"
] | [((721, 753), 'oneflow.unittest.skip_unless_1n4d', 'flow.unittest.skip_unless_1n4d', ([], {}), '()\n', (751, 753), True, 'import oneflow as flow\n'), ((776, 815), 'os.getenv', 'os.getenv', (['"""ONEFLOW_TEST_GITHUB_HOSTED"""'], {}), "('ONEFLOW_TEST_GITHUB_HOSTED')\n", (785, 815), False, 'import os\n'), ((3650, 3665), '... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.experimental.lt",
"oneflow.experimental.unittest.env.eager_execution_enabled",
"oneflow.experimental.device"
] | [((1021, 1044), 'oneflow.experimental.lt', 'flow.lt', (['input1', 'input2'], {}), '(input1, input2)\n', (1028, 1044), True, 'import oneflow.experimental as flow\n'), ((1703, 1730), 'numpy.random.randn', 'np.random.randn', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (1718, 1730), True, 'import numpy as np\n'),... |
import random
import oneflow as flow
class PromptSpell(flow.nn.Module):
def __init__(self, spell_length, hidden_size, spell_func):
super(PromptSpell, self).__init__()
self.spell_length = spell_length
self.hidden_size = hidden_size
self.spell_embeddings = flow.nn.Embedding(self.spel... | [
"oneflow.nn.ReLU",
"oneflow.nn.Linear",
"oneflow.nn.LSTM",
"oneflow.nn.Embedding",
"oneflow.no_grad"
] | [((293, 347), 'oneflow.nn.Embedding', 'flow.nn.Embedding', (['self.spell_length', 'self.hidden_size'], {}), '(self.spell_length, self.hidden_size)\n', (310, 347), True, 'import oneflow as flow\n'), ((452, 579), 'oneflow.nn.LSTM', 'flow.nn.LSTM', ([], {'input_size': 'self.hidden_size', 'hidden_size': 'self.hidden_size',... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow._C.pad",
"oneflow._C.normalize",
"oneflow._C.normal",
"oneflow._C.bias_add",
"oneflow._C.matmul",
"oneflow._C.one_hot",
"oneflow._C.triplet_margin_loss",
"oneflow.zeros",
"oneflow._C.fused_mlp",
"oneflow._C.ctc_loss",
"oneflow._C.pixel_shuffle",
"oneflow.tensor",
"oneflow._C.mse_los... | [((14950, 14965), 'unittest.main', 'unittest.main', ([], {}), '()\n', (14963, 14965), False, 'import unittest\n'), ((895, 932), 'oneflow.ones', 'flow.ones', (['(4, 4)'], {'dtype': 'flow.float32'}), '((4, 4), dtype=flow.float32)\n', (904, 932), True, 'import oneflow as flow\n'), ((952, 987), 'oneflow.ones', 'flow.ones',... |
import os
import oneflow.experimental as flow
import argparse
import numpy as np
import time
from utils.data_utils import load_image
from utils.utils import to_numpy, to_tensor, save_images
from models.networks import Generator
def main(args):
test_x, test_y = load_image(args.image_path)
test_inp = to_tensor... | [
"oneflow.experimental.no_grad",
"oneflow.experimental.enable_eager_execution",
"oneflow.experimental.load"
] | [((267, 294), 'utils.data_utils.load_image', 'load_image', (['args.image_path'], {}), '(args.image_path)\n', (277, 294), False, 'from utils.data_utils import load_image\n'), ((458, 469), 'time.time', 'time.time', ([], {}), '()\n', (467, 469), False, 'import time\n'), ((491, 517), 'oneflow.experimental.load', 'flow.load... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow._oneflow_internal.SetCudaDeviceIndex",
"oneflow._oneflow_internal.manual_seed",
"oneflow._oneflow_internal.eager.Sync",
"oneflow.cuda._utils._get_device_index",
"oneflow.env.get_world_size",
"oneflow._oneflow_internal.GetCudaDeviceIndex",
"oneflow._oneflow_internal.CudaGetDeviceCount",
"onefl... | [((1050, 1093), 'oneflow._oneflow_internal.CudaGetDeviceCount', 'flow._oneflow_internal.CudaGetDeviceCount', ([], {}), '()\n', (1091, 1093), True, 'import oneflow as flow\n'), ((1183, 1226), 'oneflow._oneflow_internal.GetCudaDeviceIndex', 'flow._oneflow_internal.GetCudaDeviceIndex', ([], {}), '()\n', (1224, 1226), True... |
# coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
#
# 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 require... | [
"oneflow.unittest.skip_unless_1n4d",
"oneflow.cuda.is_available"
] | [((1598, 1630), 'oneflow.unittest.skip_unless_1n4d', 'flow.unittest.skip_unless_1n4d', ([], {}), '()\n', (1628, 1630), True, 'import oneflow as flow\n'), ((1890, 1922), 'oneflow.unittest.skip_unless_1n4d', 'flow.unittest.skip_unless_1n4d', ([], {}), '()\n', (1920, 1922), True, 'import oneflow as flow\n'), ((2198, 2213)... |
# !/usr/bin/env python
# -*- coding:utf-8 -*-
"""
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* 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... | [
"oneflow.nn.relu",
"oneflow.transpose",
"oneflow.nn.avg_pool2d",
"oneflow.zeros_initializer",
"oneflow.variance_scaling_initializer",
"oneflow.nn.max_pool2d",
"oneflow.ones_initializer",
"oneflow.reshape",
"oneflow.layers.batch_normalization",
"oneflow.deprecated.variable_scope",
"oneflow.nn.con... | [((1232, 1320), 'oneflow.variance_scaling_initializer', 'flow.variance_scaling_initializer', (['(2)', '"""fan_in"""', '"""random_normal"""'], {'data_format': '"""NCHW"""'}), "(2, 'fan_in', 'random_normal', data_format\n ='NCHW')\n", (1265, 1320), True, 'import oneflow as flow\n'), ((1665, 1913), 'oneflow.get_variabl... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
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 applicable law or agr... | [
"oneflow.unittest.skip_unless_1n1d"
] | [((846, 878), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (876, 878), True, 'import oneflow as flow\n'), ((2678, 2693), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2691, 2693), False, 'import unittest\n'), ((1408, 1429), 'random.shuffle', 'shuffle', (['permute_list'... |
import oneflow as flow
import oneflow.nn as nn
from typing import Union, List, Dict, Any, cast
from collections import namedtuple
__all__ = [
"vgg16",
"vgg16_bn",
"vgg19_bn",
"vgg19",
]
# 31 is the raw depth of vgg16, while 37 is the raw depth of vgg19
slice_pos = {31: [4, 9, 16, 23], 37: [4, 9, 18, 2... | [
"oneflow.nn.init.constant_",
"oneflow.nn.ReLU",
"oneflow.nn.Linear",
"oneflow.flatten",
"oneflow.nn.Conv2d",
"oneflow.nn.BatchNorm2d",
"oneflow.nn.init.kaiming_normal_",
"oneflow.load",
"oneflow.nn.Sequential",
"oneflow.nn.MaxPool2d",
"oneflow.nn.AdaptiveAvgPool2d",
"oneflow.nn.Dropout",
"on... | [((3634, 3656), 'oneflow.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (3647, 3656), True, 'import oneflow.nn as nn\n'), ((503, 523), 'oneflow.nn.Sequential', 'flow.nn.Sequential', ([], {}), '()\n', (521, 523), True, 'import oneflow as flow\n'), ((546, 566), 'oneflow.nn.Sequential', 'flow.nn.Sequen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.