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 agr...
[ "oneflow.compatible.single_client.FunctionConfig", "oneflow.compatible.single_client.tensor_list_to_tensor_buffer", "oneflow.compatible.single_client.clear_default_session", "oneflow.compatible.single_client.global_function", "oneflow.compatible.single_client.image_normalize", "oneflow.compatible.single_c...
[((2924, 3010), '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", (2939, 3010), False, 'import unittest\n'), ((811, 839), 'oneflow.compatible.single_client.clear_default...
""" 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" ]
[((762, 794), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (792, 794), True, 'import oneflow as flow\n'), ((1654, 1686), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1684, 1686), True, 'import oneflow as flow\n'), ((2633, 2665), 'o...
""" Modified from https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/layers/eca.py """ import math import oneflow as flow import oneflow.nn as nn import oneflow.nn.functional as F class EcaModule(nn.Module): """ECA module """ # TODO: add docstring def __init__( self, ...
[ "oneflow.nn.Conv1d" ]
[((688, 757), 'oneflow.nn.Conv1d', 'nn.Conv1d', (['(1)', '(1)'], {'kernel_size': 'kernel_size', 'padding': 'padding', 'bias': '(False)'}), '(1, 1, kernel_size=kernel_size, padding=padding, bias=False)\n', (697, 757), True, 'import oneflow.nn as nn\n'), ((496, 517), 'math.log', 'math.log', (['channels', '(2)'], {}), '(c...
""" 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.Sequential", "oneflow.nn.ModuleList", "oneflow.nn.Linear", "oneflow.nn.ModuleDict", "oneflow.framework.graph_build_util.scope_to_proto", "oneflow.nn.init.constant_", "oneflow._C.matmul", "oneflow.framework.graph_build_util.lazy_mode.is_enabled", "oneflow.randn", "oneflow.nn.ParameterDi...
[((875, 907), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (905, 907), True, 'import oneflow as flow\n'), ((815, 849), 'os.getenv', 'os.getenv', (['"""ONEFLOW_TEST_CPU_ONLY"""'], {}), "('ONEFLOW_TEST_CPU_ONLY')\n", (824, 849), False, 'import os\n'), ((11701, 11716), 'unittest...
""" 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.reduce_mean", "oneflow.nn.modules.utils._check_axis", "oneflow._C.reduce_sum", "oneflow._C.reduce_prod", "oneflow._C.reduce_all", "oneflow._C.reduce_any" ]
[((885, 914), 'oneflow.nn.modules.utils._check_axis', '_check_axis', (['dim', 'input.shape'], {}), '(dim, input.shape)\n', (896, 914), False, 'from oneflow.nn.modules.utils import _check_axis\n'), ((978, 1040), 'oneflow._C.reduce_sum', 'flow._C.reduce_sum', (['input'], {'axis': 'axis_checked', 'keepdims': 'keepdim'}), ...
import json from oneflow import nn class BertConfig(object): def __init__( self, vocab_size=30522, hidden_size=768, num_hidden_layers=12, num_attention_heads=12, intermediate_size=3072, hidden_act=nn.GELU(), hidden_dropout_prob=0.1, attentio...
[ "oneflow.nn.GELU" ]
[((260, 269), 'oneflow.nn.GELU', 'nn.GELU', ([], {}), '()\n', (267, 269), False, 'from oneflow import nn\n'), ((1826, 1841), 'json.load', 'json.load', (['file'], {}), '(file)\n', (1835, 1841), False, 'import json\n')]
import math, os import argparse import numpy as np import oneflow as flow from config import config, default, generate_val_config import ofrecord_util import validation_util from symbols import fresnet100, fmobilefacenet def get_val_args(): val_parser = argparse.ArgumentParser(description="flags for validation") ...
[ "oneflow.typing.Numpy.Placeholder", "oneflow.scope.consistent_view", "oneflow.env.log_dir", "oneflow.config.gpu_device_num", "oneflow.function_config", "oneflow.checkpoint.get", "oneflow.global_function", "oneflow.scope.placement" ]
[((260, 319), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""flags for validation"""'}), "(description='flags for validation')\n", (283, 319), False, 'import argparse\n'), ((436, 469), 'config.generate_val_config', 'generate_val_config', (['args.network'], {}), '(args.network)\n', (455, ...
""" 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.function_config", "oneflow.compatible.single_client.FixedTensorDef", "oneflow.compatible.single_client.clear_default_session", "oneflow.compatible.single_client.matmul", "oneflow.compatible.single_client.global_function" ]
[((740, 762), 'oneflow.compatible.single_client.function_config', 'flow.function_config', ([], {}), '()\n', (760, 762), True, 'from oneflow.compatible import single_client as flow\n'), ((914, 942), 'oneflow.compatible.single_client.global_function', 'flow.global_function', (['config'], {}), '(config)\n', (934, 942), Tr...
""" 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.Quantization", "oneflow.device", "oneflow.nn.MinMaxObserver" ]
[((1178, 1192), 'numpy.max', 'np.max', (['weight'], {}), '(weight)\n', (1184, 1192), True, 'import numpy as np\n'), ((1210, 1224), 'numpy.min', 'np.min', (['weight'], {}), '(weight)\n', (1216, 1224), True, 'import numpy as np\n'), ((2755, 2777), 'numpy.zeros', 'np.zeros', (['(outer_num,)'], {}), '((outer_num,))\n', (27...
import sys import math sys.path.insert(0, '../../') import oneflow as of import oneflow.nn as nn import oneflow.nn.functional as F # from torch import nn # import torch.nn.functional as F # import torch from libs.components.conv import conv3x3 from libs.components.activation import ReLU20 from libs.components impo...
[ "oneflow.nn.Sequential", "oneflow.nn.BatchNorm2d", "oneflow.nn.Conv2d", "oneflow.nn.Linear" ]
[((23, 51), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../"""'], {}), "(0, '../../')\n", (38, 51), False, 'import sys\n'), ((5317, 5345), 'yaml.load', 'yaml.load', (['f'], {'Loader': 'CLoader'}), '(f, Loader=CLoader)\n', (5326, 5345), False, 'import yaml\n'), ((550, 588), 'libs.components.conv.conv3x3', 'con...
import os import sys sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)) ) import argparse import numpy as np import time import oneflow as flow from models.resnet50 import resnet50 from utils.imagenet1000_clsidx_to_labels import clsidx_2_labels from utils.numpy_data_utils ...
[ "oneflow.load", "oneflow.device", "oneflow.no_grad" ]
[((372, 422), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""flags for test resnet50"""'], {}), "('flags for test resnet50')\n", (395, 422), False, 'import argparse\n'), ((1197, 1216), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (1214, 1216), False, 'import time\n'), ((1266, 1276), 'models....
# 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.softmax", "oneflow.sigmoid" ]
[((1425, 1483), 'libai.config.instantiate', 'instantiate', (['self.cfg.dataloader.test[0].dataset.transform'], {}), '(self.cfg.dataloader.test[0].dataset.transform)\n', (1436, 1483), False, 'from libai.config import instantiate\n'), ((1821, 1843), 'os.path.exists', 'os.path.exists', (['inputs'], {}), '(inputs)\n', (183...
""" 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.comm.all_reduce", "oneflow.unittest.skip_unless_1n2d", "oneflow.tensor", "oneflow.unittest.skip_unless_2n2d" ]
[((725, 757), 'oneflow.unittest.skip_unless_1n2d', 'flow.unittest.skip_unless_1n2d', ([], {}), '()\n', (755, 757), True, 'import oneflow as flow\n'), ((1009, 1041), 'oneflow.unittest.skip_unless_2n2d', 'flow.unittest.skip_unless_2n2d', ([], {}), '()\n', (1039, 1041), True, 'import oneflow as flow\n'), ((1293, 1325), 'o...
""" 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.math.tanh", "oneflow.compatible.single_client.user_op_builder", "oneflow.compatible.single_client.framework.id_util.UniqueStr" ]
[((35709, 35732), 'oneflow.compatible.single_client.math.tanh', 'flow.math.tanh', (['x', 'name'], {}), '(x, name)\n', (35723, 35732), True, 'from oneflow.compatible import single_client as flow\n'), ((1300, 1332), 'oneflow.compatible.single_client.framework.id_util.UniqueStr', 'id_util.UniqueStr', (["(math_op + '_')"],...
import numpy as np import oneflow as flow import oneflow.nn as nn def _make_divisible(v, divisor, min_value=None): """ This function is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by 8 It can be seen here: https://github.com/tensorflow/models...
[ "oneflow.nn.Sequential", "oneflow.nn.init.kaiming_normal_", "oneflow.nn.init.normal_", "oneflow.nn.ReLU6", "oneflow.log", "oneflow.nn.MaxPool1d", "oneflow.nn.Conv1d", "oneflow.zeros", "oneflow.ones", "oneflow.nn.Dropout", "oneflow.nn.BatchNorm1d", "oneflow.nn.LogSoftmax", "oneflow.nn.init.ze...
[((2412, 2434), 'oneflow.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (2425, 2434), True, 'import oneflow.nn as nn\n'), ((4977, 5001), 'oneflow.nn.Sequential', 'nn.Sequential', (['*features'], {}), '(*features)\n', (4990, 5001), True, 'import oneflow.nn as nn\n'), ((5231, 5251), 'oneflow.nn.BatchN...
""" 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.typing.ListNumpy.Placeholder", "oneflow.compatible.single_client.constant_initializer", "oneflow.compatible.single_client.scope.placement", "oneflow.compatible.single_client.watch_diff", "oneflow.compatible.single_client.FunctionConfig", "oneflow.compatible.single_client....
[((3557, 3589), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (3587, 3589), True, 'from oneflow.compatible import single_client as flow\n'), ((1492, 1543), 'numpy.random.randint', 'np.random.randint', (['(0)', 'input_shape[dim]', 'index_shape'], {}), '...
import oneflow as flow import oneflow.nn as nn from quantization_ops import * __all__ = ["QuantizationAlexNet"] class QuantizationAlexNet(nn.Module): def __init__(self, num_classes: int = 1000) -> None: super(QuantizationAlexNet, self).__init__() self.features = nn.Sequential( nn.Conv...
[ "oneflow.nn.ReLU", "oneflow.nn.AdaptiveAvgPool2d", "oneflow.nn.Dropout", "oneflow.nn.MaxPool2d", "oneflow.nn.Conv2d", "oneflow.nn.Linear", "oneflow.flatten" ]
[((964, 992), 'oneflow.nn.AdaptiveAvgPool2d', 'nn.AdaptiveAvgPool2d', (['(6, 6)'], {}), '((6, 6))\n', (984, 992), True, 'import oneflow.nn as nn\n'), ((1409, 1427), 'oneflow.flatten', 'flow.flatten', (['x', '(1)'], {}), '(x, 1)\n', (1421, 1427), True, 'import oneflow as flow\n'), ((3228, 3256), 'oneflow.nn.AdaptiveAvgP...
import sys import time import logging import yaml import os sys.path.insert(0, "../../") import oneflow as of from oneflow.utils.data import DataLoader import oneflow.optim as optim from oneflow.optim import lr_scheduler import oneflow.distributed as dist import libs.dataio.dataset as dataset from libs.utils.utils im...
[ "oneflow.load", "oneflow.device" ]
[((60, 88), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../"""'], {}), "(0, '../../')\n", (75, 88), False, 'import sys\n'), ((795, 836), 'os.path.exists', 'os.path.exists', (["self.train_opts['resume']"], {}), "(self.train_opts['resume'])\n", (809, 836), False, 'import os\n'), ((2455, 2472), 'oneflow.device',...
""" 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.placement", "oneflow.compatible.single_client.zeros_initializer", "oneflow.compatible.single_client.FunctionConfig", "oneflow.compatible.single_client.global_function", "oneflow.compatible.single_client.cast", "oneflow.compatible.single_client.optimizer.PiecewiseCon...
[((966, 1017), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (1010, 1017), True, 'import tensorflow as tf\n'), ((3542, 3574), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {...
""" Modified from https://github.com/clovaai/rexnet/blob/master/rexnetv1_lite.py """ import oneflow as flow import oneflow.nn as nn from .utils import load_state_dict_from_url from .registry import ModelCreator from .helpers import make_divisible model_urls = { "rexnet_lite_1_0": "https://oneflow-public.oss-cn-b...
[ "oneflow.nn.Sequential", "oneflow.nn.ReLU6", "oneflow.nn.ReLU", "oneflow.nn.AdaptiveAvgPool2d", "oneflow.nn.BatchNorm2d", "oneflow.nn.Dropout", "oneflow.nn.Conv2d" ]
[((1038, 1125), 'oneflow.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'channels', 'kernel', 'stride', 'pad'], {'groups': 'num_group', 'bias': '(False)'}), '(in_channels, channels, kernel, stride, pad, groups=num_group,\n bias=False)\n', (1047, 1125), True, 'import oneflow.nn as nn\n'), ((1165, 1223), 'oneflow.nn.BatchN...
""" 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.oneflow_export.oneflow_export", "oneflow.compatible.single_client.builtin_op" ]
[((828, 866), 'oneflow.compatible.single_client.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""nn.AdaptiveAvgPool2d"""'], {}), "('nn.AdaptiveAvgPool2d')\n", (842, 866), False, 'from oneflow.compatible.single_client.python.oneflow_export import oneflow_export, experimental_api\n'), ((3649, 3685), 'doctes...
""" 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.stateful_op", "oneflow._C.dispatch_lamb_update", "oneflow.no_grad" ]
[((5580, 5594), 'oneflow.no_grad', 'flow.no_grad', ([], {}), '()\n', (5592, 5594), True, 'import oneflow as flow\n'), ((7460, 7553), 'oneflow._C.dispatch_lamb_update', 'flow._C.dispatch_lamb_update', (['self._op', '(param, param.grad, m_tensor, v_tensor)'], {}), '(self._op, (param, param.grad, m_tensor,\n v_tensor),...
# 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" ]
[((3457, 3489), 'oneflow.unittest.skip_unless_1n4d', 'flow.unittest.skip_unless_1n4d', ([], {}), '()\n', (3487, 3489), True, 'import oneflow as flow\n'), ((4004, 4036), 'oneflow.unittest.skip_unless_1n4d', 'flow.unittest.skip_unless_1n4d', ([], {}), '()\n', (4034, 4036), True, 'import oneflow as flow\n'), ((4535, 4567)...
# https://github.com/Kenneth111/TransformerDemo/blob/master/predict_odd_numbers.py import sys import argparse import os import shutil import numpy as np import oneflow as flow import oneflow.nn as nn sys.path.append("../") from model import TransformerModel TO_CUDA = True parser = argparse.ArgumentParser() parser....
[ "oneflow.load", "oneflow.Tensor", "oneflow.nn.CrossEntropyLoss", "oneflow.tensor", "oneflow.no_grad" ]
[((202, 224), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (217, 224), False, 'import sys\n'), ((286, 311), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (309, 311), False, 'import argparse\n'), ((1506, 1528), 'numpy.random.shuffle', 'np.random.shuffle', (['idx'], {}...
""" 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.placement", "oneflow.Generator", "oneflow.unittest.skip_unless_1n1d", "oneflow.randint", "oneflow.device" ]
[((2770, 2802), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (2800, 2802), True, 'import oneflow as flow\n'), ((1902, 1918), 'oneflow.Generator', 'flow.Generator', ([], {}), '()\n', (1916, 1918), True, 'import oneflow as flow\n'), ((5497, 5512), 'unittest.main', 'unittest.mai...
""" 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.Softmax", "oneflow.experimental.nn.ReLU", "oneflow.experimental.nn.LeakyReLU", "oneflow.experimental.unittest.env.eager_execution_enabled", "oneflow.experimental.nn.LogSoftmax", "oneflow.experimental.nn.GELU", "oneflow.experimental.gelu", "oneflow.experimental.tanh", "oneflo...
[((3816, 3825), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (3822, 3825), True, 'import numpy as np\n'), ((8676, 8691), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8689, 8691), False, 'import unittest\n'), ((866, 880), 'oneflow.experimental.nn.ReLU', 'flow.nn.ReLU', ([], {}), '()\n', (878, 880), True, 'import...
""" """ import os from os.path import abspath, expanduser from typing import Any, Callable, List, Dict, Optional, Tuple, Union import oneflow as flow from PIL import Image from .utils import ( download_file_from_google_drive, download_and_extract_archive, extract_archive, verify_str_arg, ) from .visio...
[ "oneflow.tensor" ]
[((3785, 3829), 'PIL.Image.open', 'Image.open', (["self.img_info[index]['img_path']"], {}), "(self.img_info[index]['img_path'])\n", (3795, 3829), False, 'from PIL import Image\n'), ((4542, 4595), 'os.path.join', 'os.path.join', (['self.root', '"""wider_face_split"""', 'filename'], {}), "(self.root, 'wider_face_split', ...
""" 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.reshape", "oneflow.device" ]
[((1425, 1440), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1438, 1440), False, 'import unittest\n'), ((1061, 1096), 'oneflow.reshape', 'flow.reshape', (['arg'], {'shape': '[2, 2, -1]'}), '(arg, shape=[2, 2, -1])\n', (1073, 1096), True, 'import oneflow as flow\n'), ((824, 852), 'numpy.random.random', 'np.rando...
""" 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.device" ]
[((7293, 7325), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (7323, 7325), True, 'import oneflow as flow\n'), ((8608, 8623), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8621, 8623), False, 'import unittest\n'), ((2685, 2701), 'numpy.zeros_like', 'np.zeros_like', (['x...
""" 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.oneflow_export.oneflow_export" ]
[((1077, 1114), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""is_valid_device_tag"""'], {}), "('is_valid_device_tag')\n", (1091, 1114), False, 'from oneflow.python.oneflow_export import oneflow_export\n')]
from .lstm_oneflow import LSTM import oneflow.nn as nn class lstm_ser(nn.Module): def __init__(self, input_dim, hidden_dim, output_dim, batch_size): super(lstm_ser, self).__init__() self.classifier = nn.Sequential( LSTM(input_dim, hidden_dim, batch_size), nn.Dropout(0.5), ...
[ "oneflow.nn.Linear", "oneflow.nn.Dropout", "oneflow.nn.ReLU" ]
[((302, 317), 'oneflow.nn.Dropout', 'nn.Dropout', (['(0.5)'], {}), '(0.5)\n', (312, 317), True, 'import oneflow.nn as nn\n'), ((331, 356), 'oneflow.nn.Linear', 'nn.Linear', (['hidden_dim', '(32)'], {}), '(hidden_dim, 32)\n', (340, 356), True, 'import oneflow.nn as nn\n'), ((370, 379), 'oneflow.nn.ReLU', 'nn.ReLU', ([],...
import os from os import mkdir import oneflow.typing as tp import onnx import onnxruntime as ort import numpy as np from oneflow_onnx.oneflow2onnx.util import convert_to_onnx_and_check import oneflow as flow import logging from easydict import EasyDict as edict from backbones import get_model from utils.utils_config i...
[ "oneflow.global_function", "oneflow.typing.Numpy.Placeholder" ]
[((405, 427), 'oneflow.global_function', 'flow.global_function', ([], {}), '()\n', (425, 427), True, 'import oneflow as flow\n'), ((705, 746), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.NOTSET'}), '(level=logging.NOTSET)\n', (724, 746), False, 'import logging\n'), ((751, 780), 'logging.info',...
""" 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.eager.boxing_middle.BoxingToMiddle", "oneflow._oneflow_internal.deprecated.ForeignBoxingUtil.__init__", "oneflow.eager.boxing_middle.ReplaceProducerDeviceTag", "oneflow.support.enable_if.condition", "oneflow.eager.boxing_hob.producer_sbp_parallel.HasField", "oneflow._oneflow_internal.deprecated.B...
[((8970, 9035), 'oneflow.eager.boxing_hob.producer_sbp_parallel.HasField', 'boxing_hob.producer_sbp_parallel.HasField', (['"""partial_sum_parallel"""'], {}), "('partial_sum_parallel')\n", (9011, 9035), True, 'import oneflow.eager.boxing_hob as boxing_hob\n'), ((9055, 9118), 'oneflow.eager.boxing_hob.consumer_sbp_parall...
""" 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.typing.Numpy.Placeholder", "oneflow.scope.consistent_view", "oneflow.constant_initializer", "oneflow.clear_default_session", "oneflow.config.cpu_device_num", "oneflow.unittest.skip_unless_1n1d", "oneflow.typing.ListNumpy.Placeholder", "oneflow.scope.mirrored_view", "oneflow.cast_to_current_...
[((6957, 6989), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (6987, 6989), True, 'import oneflow as flow\n'), ((10234, 10320), 'unittest.skipIf', 'unittest.skipIf', (['(True)', '"""skip for now because of single-client tensor_list removed"""'], {}), "(True,\n 'skip for now...
""" 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 l...
[ "oneflow.experimental.nn.NLLLoss", "oneflow.experimental.device", "oneflow.experimental.unittest.env.eager_execution_enabled" ]
[((2961, 2994), 'oneflow.experimental.nn.NLLLoss', 'flow.nn.NLLLoss', ([], {'reduction': '"""none"""'}), "(reduction='none')\n", (2976, 2994), True, 'import oneflow.experimental as flow\n'), ((3771, 3804), 'oneflow.experimental.nn.NLLLoss', 'flow.nn.NLLLoss', ([], {'reduction': '"""mean"""'}), "(reduction='mean')\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.python.framework.c_api_util.JobBuildAndInferCtx_MirroredBlobGetSubLbi", "oneflow._oneflow_internal.JobBuildAndInferCtx_GetCurrentJobName", "oneflow._oneflow_internal.distribute.auto", "oneflow.current_scope", "oneflow.python.framework.compile_context.CurJobAddMirroredOp", "oneflow.core.operator.i...
[((8929, 8961), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""FixedTensorDef"""'], {}), "('FixedTensorDef')\n", (8943, 8961), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((9730, 9765), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""MirroredTen...
""" 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.modules.utils._single", "oneflow.default_generator", "oneflow.F.consistent_randn", "oneflow.Generator", "oneflow.F.bernoulli", "oneflow.F.randn", "oneflow.device" ]
[((1781, 1829), 'oneflow.F.bernoulli', 'flow.F.bernoulli', (['input', 'flow.float32', 'generator'], {}), '(input, flow.float32, generator)\n', (1797, 1829), True, 'import oneflow as flow\n'), ((5795, 5831), 'doctest.testmod', 'doctest.testmod', ([], {'raise_on_error': '(True)'}), '(raise_on_error=True)\n', (5810, 5831)...
""" 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, 4474), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.searchsorted', '"""\n searchsorted() -> oneflow.Tensor\n\n The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.searchsorted.html?highlight=searchsorted\n\n Find the indices from the innermost di...
""" Modified from https://github.com/pytorch/vision/blob/main/torchvision/ops/stochastic_depth.py """ import oneflow as flow import oneflow.nn as nn from oneflow import Tensor def stochastic_depth( input: Tensor, p: float, mode: str, training: bool = True ) -> Tensor: """ Implements the Stochastic Depth f...
[ "oneflow.ones", "oneflow.bernoulli" ]
[((1692, 1726), 'oneflow.ones', 'flow.ones', (['size'], {'dtype': 'input.dtype'}), '(size, dtype=input.dtype)\n', (1701, 1726), True, 'import oneflow as flow\n'), ((1824, 1845), 'oneflow.bernoulli', 'flow.bernoulli', (['noise'], {}), '(noise)\n', (1838, 1845), True, 'import oneflow as flow\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.compatible.single_client.function_config", "oneflow.compatible.single_client.FixedTensorDef", "oneflow.compatible.single_client.clear_default_session", "oneflow.compatible.single_client.global_function", "oneflow.compatible.single_client.math.multiply", "oneflow.compatible.single_client.math.add"...
[((689, 711), 'oneflow.compatible.single_client.function_config', 'flow.function_config', ([], {}), '()\n', (709, 711), True, 'from oneflow.compatible import single_client as flow\n'), ((3370, 3385), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3383, 3385), False, 'import unittest\n'), ((1214, 1242), 'oneflow.c...
from typing import Sequence import oneflow.experimental as flow import argparse import numpy as np import os import time import sys import oneflow.experimental.nn as nn import json from tqdm import tqdm sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "model_compress/distil_new_api/src"))) curPath = os.path.ab...
[ "oneflow.experimental.InitEagerGlobalSession", "oneflow.experimental.nn.Softmax", "oneflow.experimental.no_grad", "oneflow.experimental.nn.Linear", "oneflow.experimental.load", "oneflow.experimental.enable_eager_execution", "oneflow.experimental.nn.CrossEntropyLoss" ]
[((326, 351), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (341, 351), False, 'import os\n'), ((364, 386), 'os.path.split', 'os.path.split', (['curPath'], {}), '(curPath)\n', (377, 386), False, 'import os\n'), ((1063, 1083), 'config.get_parser', 'configs.get_parser', ([], {}), '()\n', (1081...
""" 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.save", "oneflow.sysconfig.with_mlir", "oneflow.unittest.skip_unless_1n1d", "oneflow.core.job.job_pb2.Job", "oneflow.placement" ]
[((1571, 1603), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1601, 1603), True, 'import oneflow as flow\n'), ((2656, 2671), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2669, 2671), False, 'import unittest\n'), ((663, 688), 'os.path.dirname', 'os.path.dirname', (['__...
""" 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.ones_initializer", "oneflow.typing.Numpy.Placeholder", "oneflow.gather", "oneflow.clear_default_session", "oneflow.unittest.skip_unless_1n1d", "oneflow.unittest.env.eager_execution_enabled", "oneflow.math.relu", "oneflow.optimizer.PiecewiseConstantScheduler", "oneflow.FunctionConfig", "on...
[((788, 839), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (832, 839), True, 'import tensorflow as tf\n'), ((31375, 31407), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (31405, 31407)...
# 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.zeros", "oneflow.env.all_device_placement" ]
[((1129, 1156), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1146, 1156), False, 'import logging\n'), ((3042, 3049), 'libai.utils.timer.Timer', 'Timer', ([], {}), '()\n', (3047, 3049), False, 'from libai.utils.timer import Timer\n'), ((3106, 3125), 'time.perf_counter', 'time.perf_count...
""" Modified from https://github.com/facebookresearch/ConvNeXt/blob/main/models/convnext.py """ import oneflow as flow import oneflow.nn as nn import oneflow.nn.functional as F from flowvision.layers import trunc_normal_, DropPath from .registry import ModelCreator from .utils import load_state_dict_from_url model_...
[ "oneflow.nn.ModuleList", "oneflow.nn.LayerNorm", "oneflow.sqrt", "oneflow.nn.init.constant_", "oneflow.zeros", "oneflow.nn.GELU", "oneflow.ones", "oneflow.nn.Identity", "oneflow.linspace", "oneflow.nn.Conv2d", "oneflow.nn.Linear" ]
[((3857, 3914), 'oneflow.nn.Conv2d', 'nn.Conv2d', (['dim', 'dim'], {'kernel_size': '(7)', 'padding': '(3)', 'groups': 'dim'}), '(dim, dim, kernel_size=7, padding=3, groups=dim)\n', (3866, 3914), True, 'import oneflow.nn as nn\n'), ((4023, 4046), 'oneflow.nn.Linear', 'nn.Linear', (['dim', '(4 * dim)'], {}), '(dim, 4 * d...
""" 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.Softplus", "oneflow.unittest.skip_unless_1n1d", "oneflow.nn.LogSoftmax", "oneflow.device", "oneflow.nn.Softsign", "oneflow.nn.Softmax", "oneflow.nn.Hardtanh" ]
[((807, 839), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (837, 839), True, 'import oneflow as flow\n'), ((1440, 1472), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1470, 1472), True, 'import oneflow as flow\n'), ((2078, 2110), 'o...
import oneflow as flow import networks import itertools from image import ImagePool, ndarray2image import numpy as np import cv2 class CycleGANModel: def __init__(self, opt): self.opt = opt self.device = "cuda" self.netG_A = networks.ResnetGenerator(n_blocks=opt.n_blocks).to(self.device) ...
[ "oneflow.Tensor", "oneflow.nn.L1Loss", "oneflow.optim.lr_scheduler.CosineAnnealingLR" ]
[((572, 596), 'image.ImagePool', 'ImagePool', (['opt.pool_size'], {}), '(opt.pool_size)\n', (581, 596), False, 'from image import ImagePool, ndarray2image\n'), ((624, 648), 'image.ImagePool', 'ImagePool', (['opt.pool_size'], {}), '(opt.pool_size)\n', (633, 648), False, 'from image import ImagePool, ndarray2image\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.global_function", "oneflow.distribute.split", "oneflow.unittest.skip_unless_1n4d", "oneflow.unittest.skip_unless_1n2d", "oneflow.clear_default_session", "oneflow.config.gpu_device_num", "oneflow.experimental.logical_slice", "oneflow.random_uniform_initializer" ]
[((879, 907), 'oneflow.clear_default_session', 'flow.clear_default_session', ([], {}), '()\n', (905, 907), True, 'import oneflow as flow\n'), ((989, 1011), 'oneflow.global_function', 'flow.global_function', ([], {}), '()\n', (1009, 1011), True, 'import oneflow as flow\n'), ((1616, 1646), 'test_global_storage.Get', 'tes...
""" 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.rsqrt", "oneflow.experimental.pow", "oneflow.experimental.sin", "oneflow.experimental.unittest.env.eager_execution_enabled", "oneflow.experimental.cos", "oneflow.experimental.std", "oneflow.experimental.log", "oneflow.experimental.Tensor", "oneflow.experimental.square", "onef...
[((7824, 7839), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7837, 7839), False, 'import unittest\n'), ((946, 973), 'numpy.random.randn', 'np.random.randn', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (961, 973), True, 'import numpy as np\n'), ((1044, 1079), 'numpy.var', 'np.var', (['input_arr', '(1)'...
""" 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.placement", "oneflow.compatible.single_client.unittest.skip_unless_1n2d", "oneflow.compatible.single_client.FunctionConfig", "oneflow.compatible.single_client.global_function", "oneflow.compatible.single_client.clear_default_session", "oneflow.compatible.single_clie...
[((4623, 4655), 'oneflow.compatible.single_client.unittest.skip_unless_1n2d', 'flow.unittest.skip_unless_1n2d', ([], {}), '()\n', (4653, 4655), True, 'from oneflow.compatible import single_client as flow\n'), ((939, 967), 'oneflow.compatible.single_client.clear_default_session', 'flow.clear_default_session', ([], {}), ...
""" 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.GroupNorm", "oneflow.unittest.skip_unless_1n1d", "oneflow.device" ]
[((12595, 12627), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (12625, 12627), True, 'import oneflow as flow\n'), ((855, 1349), 'numpy.array', 'np.array', (['[[[[-0.8791, 0.2553, 0.7403, -0.2859], [0.8006, -1.7701, -0.9617, 0.1705],\n [0.2842, 1.7825, 0.3365, -0.8525]], [[...
""" 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._C.logical_slice", "oneflow.unittest.skip_unless_1n2d", "oneflow.sbp.split", "oneflow.env.all_device_placement" ]
[((687, 719), 'oneflow.unittest.skip_unless_1n2d', 'flow.unittest.skip_unless_1n2d', ([], {}), '()\n', (717, 719), True, 'import oneflow as flow\n'), ((737, 771), 'os.getenv', 'os.getenv', (['"""ONEFLOW_TEST_CPU_ONLY"""'], {}), "('ONEFLOW_TEST_CPU_ONLY')\n", (746, 771), False, 'import os\n'), ((1632, 1647), 'unittest.m...
import argparse import time import os import numpy as np from tsn.models.TSN import TSN from tsn.utils.checkpoint import load_checkpoint import oneflow as flow from tsn.datasets.transform import * from tsn.datasets.dataset import TSNDataSet import warnings warnings.filterwarnings("ignore", category=UserWarning) def...
[ "oneflow.load", "oneflow.no_grad", "oneflow.nn.CrossEntropyLoss", "oneflow.InitEagerGlobalSession", "oneflow.device" ]
[((259, 314), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (282, 314), False, 'import warnings\n'), ((348, 412), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Test an action recognizer"""'}),...
""" 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.onnx.handler.flow_op", "oneflow.python.framework.id_util.UniqueStr" ]
[((1044, 1071), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1061, 1071), False, 'import logging\n'), ((1129, 1171), 'oneflow.python.onnx.handler.flow_op', 'flow_op', (['"""reduce_min"""'], {'onnx_op': '"""ReduceMin"""'}), "('reduce_min', onnx_op='ReduceMin')\n", (1136, 1171), False, '...
""" 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.one_embedding_id_shuffle", "oneflow._C.identity", "oneflow.test_utils.test_util.GenArgDict", "oneflow.unittest.skip_unless_1n2d", "oneflow.tensor", "oneflow.sbp.split", "oneflow.sbp.broadcast", "oneflow._C.gather", "oneflow._C.one_embedding_embedding_gradient_shuffle", "oneflow.cast" ]
[((13125, 13157), 'oneflow.unittest.skip_unless_1n2d', 'flow.unittest.skip_unless_1n2d', ([], {}), '()\n', (13155, 13157), True, 'import oneflow as flow\n'), ((953, 1023), 'numpy.random.randint', 'np.random.randint', (['(0)', 'max_id', '(batch_size, num_tables)'], {'dtype': 'np.int64'}), '(0, max_id, (batch_size, num_t...
""" 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.as_tensor", "oneflow.randn", "oneflow.unittest.skip_unless_1n1d", "oneflow.device" ]
[((959, 991), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (989, 991), True, 'import oneflow as flow\n'), ((1009, 1043), 'os.getenv', 'os.getenv', (['"""ONEFLOW_TEST_CPU_ONLY"""'], {}), "('ONEFLOW_TEST_CPU_ONLY')\n", (1018, 1043), False, 'import os\n'), ((5210, 5225), 'unitte...
import math import oneflow as flow import oneflow.nn as nn class LSTMText(nn.Module): def __init__(self, emb_sz, emb_dim, hidden_size, nfc, n_classes, batch_size): super(LSTMText, self).__init__() self.emb_sz = emb_sz self.emb_dim = emb_dim self.n_classes = n_classes self....
[ "oneflow.Tensor", "oneflow.cat", "oneflow.nn.ModuleList", "oneflow.matmul", "oneflow.sigmoid", "oneflow.zeros", "oneflow.nn.Embedding", "oneflow.nn.Softmax", "oneflow.tanh", "oneflow.nn.Linear" ]
[((505, 544), 'oneflow.nn.Embedding', 'nn.Embedding', (['self.emb_sz', 'self.emb_dim'], {}), '(self.emb_sz, self.emb_dim)\n', (517, 544), True, 'import oneflow.nn as nn\n'), ((567, 610), 'oneflow.nn.Linear', 'nn.Linear', (['(hidden_size * 2 * nfc)', 'n_classes'], {}), '(hidden_size * 2 * nfc, n_classes)\n', (576, 610),...
import h5py import oneflow as flow import shutil import numpy as np import os def save_net(fname, net): with h5py.File(fname, "w") as h5f: for k, v in net.state_dict().items(): h5f.create_dataset(k, data=v.cpu().numpy()) def load_net(fname, net): with h5py.File(fname, "r") as h5f: ...
[ "oneflow.save" ]
[((564, 614), 'oneflow.save', 'flow.save', (["state['state_dict']", '(filename + task_id)'], {}), "(state['state_dict'], filename + task_id)\n", (573, 614), True, 'import oneflow as flow\n'), ((890, 914), 'os.path.exists', 'os.path.exists', (['filepath'], {}), '(filepath)\n', (904, 914), False, 'import os\n'), ((115, 1...
""" 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, 2482), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow._C.deconv1d', '"""\n conv_transpose1d(input, weight, bias=None, stride=1, padding=0, output_padding=0, groups=1, dilation=1) -> Tensor\n\n The documentation is referenced from: https://pytorch.org/docs/stable/generated/torch.nn.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.set_rng_state", "oneflow.ones", "oneflow.Generator", "oneflow.randn", "oneflow.get_rng_state" ]
[((6398, 6413), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6411, 6413), False, 'import unittest\n'), ((793, 822), 'oneflow.Generator', 'flow.Generator', ([], {'device': '"""auto"""'}), "(device='auto')\n", (807, 822), True, 'import oneflow as flow\n'), ((841, 869), 'oneflow.Generator', 'flow.Generator', ([], ...
""" 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.global_function", "oneflow.FunctionConfig", "oneflow.random_uniform_initializer", "oneflow.gather_nd" ]
[((671, 692), 'oneflow.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (690, 692), True, 'import oneflow as flow\n'), ((773, 806), 'oneflow.global_function', 'flow.global_function', (['func_config'], {}), '(func_config)\n', (793, 806), True, 'import oneflow as flow\n'), ((1244, 1290), 'util.convert_to_onnx_an...
""" 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.constant_initializer", "oneflow.compatible.single_client.math.unsorted_batch_segment_sum", "oneflow.compatible.single_client.scope.placement", "oneflow.compatible.single_client.FunctionConfig", "oneflow.compatible.single_client.global_function", "oneflow.compatible.single...
[((900, 921), 'oneflow.compatible.single_client.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (919, 921), True, 'from oneflow.compatible import single_client as flow\n'), ((4044, 4076), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (4074, 4...
""" 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.placement", "oneflow.compatible.single_client.zeros_initializer", "oneflow.compatible.single_client.FunctionConfig", "oneflow.compatible.single_client.global_function", "oneflow.compatible.single_client.random_uniform_initializer", "oneflow.compatible.single_client....
[((1751, 1783), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1781, 1783), True, 'import oneflow.compatible.single_client as flow\n'), ((1003, 1030), 'oneflow.compatible.single_client.regularizers.l2', 'flow.regularizers.l2', (['(4e-05)'], {}), '(4e-0...
""" 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.F.arange", "oneflow.F.consistent_arange", "oneflow.device" ]
[((3076, 3112), 'doctest.testmod', 'doctest.testmod', ([], {'raise_on_error': '(True)'}), '(raise_on_error=True)\n', (3091, 3112), False, 'import doctest\n'), ((2364, 2410), 'oneflow.F.arange', 'flow.F.arange', (['start', 'end', 'step', 'dtype', 'device'], {}), '(start, end, step, dtype, device)\n', (2377, 2410), True,...
import math import oneflow import oneflow as flow import oneflow.nn as nn import numpy as np class SparseDispatcher(object): """Helper for implementing a mixture of experts. The purpose of this class is to create input minibatches for the experts and to combine the results of the experts to form a unifie...
[ "oneflow.Tensor", "oneflow.nn.Softplus", "oneflow.cat", "oneflow.scatter", "oneflow.arange", "oneflow.matmul", "oneflow.gather", "oneflow.where", "oneflow.zeros", "oneflow.nn.Softmax", "oneflow.nonzero", "oneflow.gt", "oneflow.tensor", "oneflow.split" ]
[((5752, 5770), 'oneflow.tensor', 'flow.tensor', (['[0.0]'], {}), '([0.0])\n', (5763, 5770), True, 'import oneflow as flow\n'), ((5778, 5796), 'oneflow.tensor', 'flow.tensor', (['[1.0]'], {}), '([1.0])\n', (5789, 5796), True, 'import oneflow as flow\n'), ((2748, 2793), 'oneflow.gather', 'flow.gather', (['gates_exp', '(...
#!/usr/bin/env python import argparse import json import oneflow as flow import kaldi_io from transformer import Transformer from utils import add_results_to_json, process_dict from data import build_LFR_features from decoder import Decoder from encoder import Encoder parser = argparse.ArgumentParser("End-to-End Auto...
[ "oneflow.load", "oneflow.no_grad", "oneflow.tensor", "oneflow.device" ]
[((280, 356), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""End-to-End Automatic Speech Recognition Decoding."""'], {}), "('End-to-End Automatic Speech Recognition Decoding.')\n", (303, 356), False, 'import argparse\n'), ((2883, 2906), 'utils.process_dict', 'process_dict', (['args.dict'], {}), '(args.dict...
""" 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 l...
[ "oneflow.python.framework.tensor.register_tensor_op", "oneflow.builtin_op", "oneflow.python.ops.transpose_util.get_inversed_perm", "oneflow.python.ops.transpose_util.get_perm_when_transpose_axis_to_last_dim", "oneflow.experimental.unsqueeze", "oneflow.python.oneflow_export.oneflow_export" ]
[((2599, 2623), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""argmax"""'], {}), "('argmax')\n", (2613, 2623), False, 'from oneflow.python.oneflow_export import oneflow_export, experimental_api\n'), ((2626, 2654), 'oneflow.python.framework.tensor.register_tensor_op', 'register_tensor_op', (['""...
import numpy as np import sys import math import oneflow as flow import oneflow.nn as nn sys.path.append("../") from transformer import TransformerEncoder class Embeddings(nn.Module): def __init__(self, vocab, d_model): super(Embeddings, self).__init__() self.lut = nn.Embedding(vocab, d_model) ...
[ "oneflow.arange", "oneflow.sin", "oneflow.zeros", "oneflow.ones", "oneflow.nn.Dropout", "oneflow.tensor", "oneflow.nn.Embedding", "oneflow.max", "oneflow.nn.Linear", "oneflow.cos" ]
[((91, 113), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (106, 113), False, 'import sys\n'), ((289, 317), 'oneflow.nn.Embedding', 'nn.Embedding', (['vocab', 'd_model'], {}), '(vocab, d_model)\n', (301, 317), True, 'import oneflow.nn as nn\n'), ((603, 624), 'oneflow.nn.Dropout', 'nn.Dropout',...
""" 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.typing.ListNumpy.Placeholder", "oneflow.compatible.single_client.constant_initializer", "oneflow.compatible.single_client.watch_diff", "oneflow.compatible.single_client.FunctionConfig", "oneflow.compatible.single_client.broadcast_to_compatible_with", "oneflow.compatible.s...
[((4221, 4253), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (4251, 4253), True, 'from oneflow.compatible import single_client as flow\n'), ((973, 1001), 'oneflow.compatible.single_client.clear_default_session', 'flow.clear_default_session', ([], {}),...
# 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.placement", "oneflow.sbp.split", "oneflow.randn" ]
[((746, 766), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (761, 766), False, 'import sys\n'), ((1140, 1158), 'omegaconf.OmegaConf.create', 'OmegaConf.create', ([], {}), '()\n', (1156, 1158), False, 'from omegaconf import OmegaConf\n'), ((2512, 2536), 'libai.engine.default_setup', 'default_setup'...
""" 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.distribute.broadcast", "oneflow.current_global_function_desc", "oneflow.scope.namespace", "oneflow.matmul", "oneflow.ones_initializer", "oneflow.nn.compat_conv2d", "oneflow.nn.conv2d_transpose", "oneflow.constant_initializer", "oneflow.zeros_initializer", "oneflow.reshape", "oneflow.use...
[((827, 870), 'oneflow.random_normal_initializer', 'flow.random_normal_initializer', ([], {'stddev': '(0.02)'}), '(stddev=0.02)\n', (857, 870), True, 'import oneflow as flow\n'), ((912, 944), 'oneflow.constant_initializer', 'flow.constant_initializer', (['(2e-05)'], {}), '(2e-05)\n', (937, 944), True, 'import oneflow 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.framework.hob.eager_execution_enabled", "oneflow.framework.interpret_util.Forward", "oneflow.eager.boxing_util.BuildAssignInstruction", "oneflow._oneflow_internal.GetDeviceTagAndMachineDeviceIdsAndHierarchy", "oneflow.support.enable_if.unique", "oneflow.support.enable_if.condition", "oneflow.co...
[((1668, 1738), 'oneflow.support.enable_if.condition', 'enable_if.condition', (['(hob.in_global_mode & ~hob.eager_execution_enabled)'], {}), '(hob.in_global_mode & ~hob.eager_execution_enabled)\n', (1687, 1738), True, 'import oneflow.support.enable_if as enable_if\n'), ((2274, 2343), 'oneflow.support.enable_if.conditio...
""" 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.config.machine_num", "oneflow.serving.InferenceSession", "oneflow.typing.Numpy.Placeholder", "oneflow.clear_default_session", "oneflow.config.cpu_device_num", "oneflow.unittest.skip_unless_1n1d", "oneflow.transpose", "oneflow.config.gpu_device_num", "oneflow.saved_model.ModelBuilder", "on...
[((3159, 3191), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (3189, 3191), True, 'import oneflow as flow\n'), ((1221, 1236), 'oneflow.env.init', 'flow.env.init', ([], {}), '()\n', (1234, 1236), True, 'import oneflow as flow\n'), ((1241, 1267), 'oneflow.config.machine_num', '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.python.eager.boxing_util.BoxingTo", "oneflow.python.lib.core.enable_if.condition", "oneflow.python.eager.blob_register.GetDefaultBlobRegister", "oneflow.scope.mirrored_view_enabled", "oneflow.python.eager.vm_util.LogicalRun", "oneflow.parallel_cast", "oneflow.python.eager.blob_cache.FindOrCreat...
[((1670, 1713), 'oneflow.python.eager.blob_register.GetDefaultBlobRegister', 'blob_register_util.GetDefaultBlobRegister', ([], {}), '()\n', (1711, 1713), True, 'import oneflow.python.eager.blob_register as blob_register_util\n'), ((1835, 1904), 'oneflow.python.lib.core.enable_if.condition', 'enable_if.condition', (['(h...