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.reshape_like",
"oneflow.function_config",
"oneflow.FixedTensorDef",
"oneflow.global_function",
"oneflow.clear_default_session"
] | [((659, 681), 'oneflow.function_config', 'flow.function_config', ([], {}), '()\n', (679, 681), True, 'import oneflow as flow\n'), ((806, 834), 'oneflow.global_function', 'flow.global_function', (['config'], {}), '(config)\n', (826, 834), True, 'import oneflow as flow\n'), ((1178, 1206), 'oneflow.global_function', 'flow... |
"""
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.unittest.skip_unless_1n1d",
"oneflow.experimental.nn.MarginRankingLoss",
"oneflow.experimental.device"
] | [((6121, 6153), 'oneflow.experimental.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (6151, 6153), True, 'import oneflow.experimental as flow\n'), ((877, 944), 'numpy.clip', 'np.clip', (['(margin + -targets * (input1 - input2))'], {'a_min': '(0)', 'a_max': 'None'}), '(margin + -targets ... |
"""
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.interpret_util.Forward",
"oneflow.core.operator.op_conf_pb2.OperatorConf",
"oneflow.python.framework.remote_blob.RemoteBlob",
"oneflow.math.subtract",
"oneflow.user_op_builder",
"oneflow.math.add_n",
"oneflow.core.register.logical_blob_id_pb2.LogicalBlobId",
"oneflow.python.o... | [((1268, 1294), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""math.add"""'], {}), "('math.add')\n", (1282, 1294), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((2673, 2701), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""math.add_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.convert_oneflow_dtype_to_numpy_dtype",
"oneflow.python.framework.dtype.convert_numpy_dtype_to_oneflow_dtype",
"oneflow.to",
"oneflow.empty_initializer",
"oneflow.experimental.sub",
"oneflow.kaiming_initializer",
"oneflow.xavier_normal_initializer",
"oneflow.xavier_uniform_initializer",
"one... | [((3729, 3753), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""tensor"""'], {}), "('tensor')\n", (3743, 3753), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((4650, 4674), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""Tensor"""'], {}), "('Tensor... |
# Copyright 2021 Fedlearn authors.
# 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 to in writi... | [
"oneflow.load_variables",
"oneflow.data.OFRecordRawDecoder",
"oneflow.get_all_variables",
"oneflow.env.log_dir",
"oneflow.losses.add_loss",
"oneflow.scope.placement",
"oneflow.config.gpu_device_num",
"oneflow.data.ofrecord_reader"
] | [((1006, 1026), 'config.get_config', 'configs.get_config', ([], {}), '()\n', (1024, 1026), True, 'import config as configs\n'), ((3580, 3604), 'config.print_args', 'configs.print_args', (['args'], {}), '(args)\n', (3598, 3604), True, 'import config as configs\n'), ((1347, 1362), 'omegaconf.open_dict', 'open_dict', (['a... |
# 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"
] | [((1079, 1108), 'libai.utils.distributed.get_data_parallel_size', 'dist.get_data_parallel_size', ([], {}), '()\n', (1106, 1108), True, 'from libai.utils import distributed as dist\n'), ((2444, 2471), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2461, 2471), False, 'import logging\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.experimental.nn.L1Loss",
"oneflow.experimental.unittest.env.eager_execution_enabled",
"oneflow.experimental.device"
] | [((783, 811), 'numpy.abs', 'np.abs', (['(np_target - np_input)'], {}), '(np_target - np_input)\n', (789, 811), True, 'import numpy as np\n'), ((828, 841), 'numpy.sum', 'np.sum', (['np_l1'], {}), '(np_l1)\n', (834, 841), True, 'import numpy as np\n'), ((859, 873), 'numpy.mean', 'np.mean', (['np_l1'], {}), '(np_l1)\n', (... |
import numpy as np
import oneflow as flow
import oneflow.nn as nn
import oneflow.nn.functional as F
from abc import ABCMeta
from typing import Any
from typing import Dict
from typing import List
from typing import Type
from typing import Union
from typing import Callable
from typing import Optional
from ...types impo... | [
"oneflow.nn.functional.l1_loss",
"oneflow.max",
"oneflow.sigmoid",
"oneflow.nn.functional.mse_loss",
"oneflow.nn.CrossEntropyLoss",
"oneflow.nn.functional.softmax",
"oneflow.tensor",
"oneflow.nn.BCEWithLogitsLoss",
"oneflow.nn.ModuleList"
] | [((943, 981), 'oneflow.nn.BCEWithLogitsLoss', 'nn.BCEWithLogitsLoss', ([], {'reduction': '"""none"""'}), "(reduction='none')\n", (963, 981), True, 'import oneflow.nn as nn\n'), ((1675, 1723), 'oneflow.nn.functional.l1_loss', 'F.l1_loss', (['predictions', 'labels'], {'reduction': '"""none"""'}), "(predictions, labels, r... |
"""
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"
] | [((729, 761), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (759, 761), True, 'import oneflow as flow\n'), ((1873, 1888), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1886, 1888), False, 'import unittest\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.skip_unless_1n1d"
] | [((710, 742), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (740, 742), True, 'import oneflow as flow\n'), ((4042, 4057), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4055, 4057), False, 'import unittest\n')] |
import backbones
import oneflow as flow
from utils.utils_callbacks import CallBackVerification
from backbones import get_model
from graph import TrainGraph, EvalGraph
import logging
import argparse
from utils.utils_config import get_config
from function import EvalGraph
def main(args):
cfg = get_config(args.conf... | [
"oneflow.load"
] | [((300, 323), 'utils.utils_config.get_config', 'get_config', (['args.config'], {}), '(args.config)\n', (310, 323), False, 'from utils.utils_config import get_config\n'), ((328, 369), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.NOTSET'}), '(level=logging.NOTSET)\n', (347, 369), False, 'import l... |
"""
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.builtin_op",
"oneflow.device",
"oneflow.python.oneflow_export.oneflow_export"
] | [((1885, 1909), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""arange"""'], {}), "('arange')\n", (1899, 1909), False, 'from oneflow.python.oneflow_export import oneflow_export, experimental_api\n'), ((3498, 3515), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (3513, 3515), False, 'imp... |
#-*- coding:utf-8 -*-
"""
@author: scorpio.lu
@datetime:2020-06-11 15:22
@software: PyCharm
@contact: <EMAIL>
----------
路有敬亭山
----------
"""
import os
import argparse
import sys
from datetime import datetime
import numpy as np
import math
import cv2
from scipy.spatial.dista... | [
"oneflow.FunctionConfig",
"oneflow.env.grpc_use_no_signal",
"oneflow.env.log_dir",
"oneflow.train.CheckPoint",
"oneflow.function",
"oneflow.FixedTensorDef",
"oneflow.config.gpu_device_num"
] | [((445, 518), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""flags for person re-identification"""'}), "(description='flags for person re-identification')\n", (468, 518), False, 'import argparse\n'), ((1584, 1605), 'oneflow.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (1603,... |
"""
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.python.oneflow_export.oneflow_export"
] | [((856, 888), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""smooth_l1_loss"""'], {}), "('smooth_l1_loss')\n", (870, 888), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((1157, 1191), 'oneflow.python.framework.id_util.UniqueStr', 'id_util.UniqueStr', (['"""SmoothL1Loss_"... |
"""
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.interpret_util.Forward",
"oneflow.constant",
"oneflow.python.framework.remote_blob.RemoteBlob",
"oneflow.user_op_builder",
"oneflow.python.oneflow_export.oneflow_export",
"oneflow.core.operator.op_conf_pb2.OperatorConf",
"oneflow.python.framework.id_util.UniqueStr",
"oneflow.... | [((1131, 1157), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""constant"""'], {}), "('constant')\n", (1145, 1157), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((3393, 3426), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""constant_scalar"""'], {... |
"""
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.nn.Linear",
"oneflow.utils.data.DataLoader",
"oneflow.nn.MSELoss",
"oneflow.utils.data.TensorDataset",
"oneflow.nn.init.constant_",
"oneflow.nn.init.normal_"
] | [((960, 992), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (990, 992), True, 'import oneflow as flow\n'), ((2317, 2332), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2330, 2332), False, 'import unittest\n'), ((862, 885), 'oneflow.nn.Linear', 'nn.Linear', (['n_feature'... |
"""
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.reduce_sum",
"oneflow.compatible.single_client.scope.placement",
"oneflow.compatible.single_client.unittest.skip_unless_1n1d",
"oneflow.compatible.single_client.global_function",
"oneflow.compatible.single_client.random_uniform_initializer",
"oneflow.compatible.singl... | [((831, 882), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (875, 882), True, 'import tensorflow as tf\n'), ((5292, 5324), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}),... |
"""
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",
"oneflow.test_utils.test_util.GenArgList"
] | [((909, 931), 'numpy.random.rand', 'np.random.rand', (['*shape'], {}), '(*shape)\n', (923, 931), True, 'import numpy as np\n'), ((1261, 1283), 'numpy.random.rand', 'np.random.rand', (['*shape'], {}), '(*shape)\n', (1275, 1283), True, 'import numpy as np\n'), ((6657, 6672), 'unittest.main', 'unittest.main', ([], {}), '(... |
"""
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.leaky_relu",
"oneflow.math.abs",
"oneflow.nn.dropout",
"oneflow.concat",
"oneflow.optimizer.PiecewiseConstantScheduler",
"oneflow.math.tanh",
"oneflow.nn.sigmoid_cross_entropy_with_logits",
"oneflow.train.CheckPoint",
"oneflow.optimizer.Adam",
"oneflow.global_function",
"oneflow.pad"... | [((20419, 20491), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""flags for multi-node and resource"""'}), "(description='flags for multi-node and resource')\n", (20442, 20491), False, 'import argparse\n'), ((1335, 1372), 'os.path.join', 'os.path.join', (['self.path', '"""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.global_function",
"oneflow.watch",
"oneflow.scope.mirrored_view",
"oneflow.typing.Numpy.Placeholder",
"oneflow.math.relu",
"oneflow.config.gpu_device_num",
"oneflow.FunctionConfig"
] | [((695, 724), 'oneflow.config.gpu_device_num', 'flow.config.gpu_device_num', (['(1)'], {}), '(1)\n', (721, 724), True, 'import oneflow as flow\n'), ((736, 768), 'numpy.ones', 'np.ones', (['(10,)'], {'dtype': 'np.float32'}), '((10,), dtype=np.float32)\n', (743, 768), True, 'import numpy as np\n'), ((854, 876), 'oneflow.... |
"""
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",
"oneflow.experimental.nn.functional.interpolate"
] | [((840, 869), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""nn.Upsample"""'], {}), "('nn.Upsample')\n", (854, 869), False, 'from oneflow.python.oneflow_export import oneflow_export, experimental_api\n'), ((5184, 5224), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""nn.... |
"""
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, 1959), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.tensor', '"""\n Constructs a tensor with data, return a consistent tensor if placement and sbp are in kwargs,\n otherwise return a local tensor. \n \n Arguments:\n data: Initial data for the tensor. Can be a li... |
"""
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.reduce_sum",
"oneflow.compatible.single_client.math.relu",
"oneflow.compatible.single_client.optimizer.PiecewiseConstantScheduler",
"oneflow.compatible.single_client.unittest.skip_unless_1n1d",
"oneflow.compatible.single_client.reshape",
"oneflow.compatible.single_cl... | [((1572, 1604), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1602, 1604), True, 'from oneflow.compatible import single_client as flow\n'), ((793, 814), 'oneflow.compatible.single_client.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (812, ... |
"""
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._C.dispatch_feed_input",
"oneflow._oneflow_internal.lazy_mode.guard",
"oneflow._oneflow_internal.one.FeedVariableOpExpr",
"oneflow._C.relu",
"oneflow._oneflow_internal.one.FetchOutputOpExpr",
"oneflow.framework.session_context.GetDefaultSession",
"oneflow.core.job.job_conf_pb2... | [((5462, 5494), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (5492, 5494), True, 'import oneflow as flow\n'), ((1790, 1821), 'oneflow.framework.session_context.GetDefaultSession', 'session_ctx.GetDefaultSession', ([], {}), '()\n', (1819, 1821), True, 'import oneflow.framework... |
"""
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.flags.has_rpc_backend_local",
"oneflow._oneflow_internal.flags.cmake_build_type",
"oneflow._oneflow_internal.flags.with_cuda",
"oneflow._oneflow_internal.flags.has_rpc_backend_grpc",
"oneflow._oneflow_internal.flags.with_rdma",
"oneflow._oneflow_internal.flags.cuda_version",
"... | [((839, 872), 'os.path.dirname', 'os.path.dirname', (['oneflow.__file__'], {}), '(oneflow.__file__)\n', (854, 872), False, 'import os\n'), ((1038, 1081), 'oneflow._oneflow_internal.flags.with_cuda', 'oneflow._oneflow_internal.flags.with_cuda', ([], {}), '()\n', (1079, 1081), False, 'import oneflow\n'), ((1126, 1173), '... |
"""
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.tensor",
"oneflow.ones"
] | [((2547, 2562), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2560, 2562), False, 'import unittest\n'), ((1182, 1225), 'oneflow.tensor', 'flow.tensor', (['[0, 1, 2, 3]'], {'dtype': 'flow.int32'}), '([0, 1, 2, 3], dtype=flow.int32)\n', (1193, 1225), True, 'import oneflow as flow\n'), ((1516, 1548), 'oneflow.tenso... |
import os
import math
import random
import logging
import warnings
import csv
import sys
warnings.filterwarnings('ignore')
sys.path.insert(0, "../../")
import glob
import numpy as np
import oneflow as of
from oneflow.utils.data import Dataset
import soundfile as sf
from scipy import signal
from libs.utils.utils impor... | [
"oneflow.tensor",
"oneflow.utils.data.DataLoader"
] | [((89, 122), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (112, 122), False, 'import warnings\n'), ((123, 151), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../"""'], {}), "(0, '../../')\n", (138, 151), False, 'import sys\n'), ((531, 548), 'soundfile.read', 'sf.... |
"""
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.MSELoss",
"oneflow.experimental.unittest.skip_unless_1n1d",
"oneflow.experimental.device"
] | [((1992, 2024), 'oneflow.experimental.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (2022, 2024), True, 'import oneflow.experimental as flow\n'), ((785, 816), 'numpy.square', 'np.square', (['(np_target - np_input)'], {}), '(np_target - np_input)\n', (794, 816), True, 'import numpy as 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.oneflow_export.oneflow_export",
"oneflow.python.framework.id_util.UniqueStr"
] | [((1250, 1288), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""combined_margin_loss"""'], {}), "('combined_margin_loss')\n", (1264, 1288), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((1647, 1687), 'oneflow.python.framework.id_util.UniqueStr', 'id_util.UniqueStr', (['"... |
"""
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.scope.mirrored_view",
"oneflow.typing.Numpy.Placeholder",
"oneflow.unittest.num_nodes_required",
"oneflow.user_op_builder",
"oneflow.config.gpu_device_num",
"oneflow.typing.ListNumpy.Placeholder",
"oneflow.FunctionConfig",
"oneflow.scope.consistent_view"
] | [((2684, 2719), 'oneflow.unittest.num_nodes_required', 'flow.unittest.num_nodes_required', (['(2)'], {}), '(2)\n', (2716, 2719), True, 'import oneflow as flow\n'), ((986, 1019), 'oneflow.global_function', 'flow.global_function', (['func_config'], {}), '(func_config)\n', (1006, 1019), 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.python.eager.vm_util.LogicalRun",
"oneflow.python.eager.vm_util.PhysicalRun",
"oneflow.identity",
"oneflow.python.eager.blob_register.GetDefaultBlobRegister",
"oneflow.python.framework.dtype.convert_oneflow_dtype_to_numpy_dtype",
"oneflow.current_scope",
"oneflow.core.operator.op_conf_pb2.Opera... | [((6181, 6222), 'oneflow.python.eager.vm_util.LogicalRun', 'vm_util.LogicalRun', (['BuildInputInstruction'], {}), '(BuildInputInstruction)\n', (6199, 6222), True, 'import oneflow.python.eager.vm_util as vm_util\n'), ((6344, 6387), 'oneflow.python.eager.blob_register.GetDefaultBlobRegister', 'blob_register_util.GetDefau... |
"""
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.lazy_mode.gard",
"oneflow.experimental.nn.init.uniform_",
"oneflow.python.framework.c_api_util.CurJobBuildAndInferCtx_SetJobConf",
"oneflow._oneflow_internal.one.FeedVariableOpExpr",
"oneflow._oneflow_internal.oneflow.core.operator.op_conf.FeedVariableOpConf",
"oneflow._oneflow_... | [((921, 953), 'oneflow.experimental.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (951, 953), True, 'import oneflow.experimental as flow\n'), ((5377, 5392), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5390, 5392), False, 'import unittest\n'), ((1230, 1249), 'oneflow.experiment... |
"""
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.constant_initializer",
"oneflow.scope.placement",
"oneflow.losses.add_loss",
"oneflow.enable_eager_execution",
"oneflow.config.gpu_device_num",
"oneflow.FunctionConfig"
] | [((656, 685), 'oneflow.enable_eager_execution', 'flow.enable_eager_execution', ([], {}), '()\n', (683, 685), True, 'import oneflow as flow\n'), ((690, 719), 'oneflow.config.gpu_device_num', 'flow.config.gpu_device_num', (['(2)'], {}), '(2)\n', (716, 719), True, 'import oneflow as flow\n'), ((742, 763), 'oneflow.Functio... |
"""
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",
"oneflow._oneflow_internal.deprecated.GetProtoDtype4OfDtype",
"oneflow.framework.dtype.convert_oneflow_dtype_to_numpy_dtype",
"oneflow.framework.dtype.convert_proto_dtype_to_oneflow_dtype",
"oneflow._oneflow_internal.cpu_broadcast",
"oneflow.placement",
"oneflow.core.framework.variable... | [((4205, 4241), 'oneflow.framework.distribute.get_rank', 'flow.framework.distribute.get_rank', ([], {}), '()\n', (4239, 4241), True, 'import oneflow as flow\n'), ((4581, 4600), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (4594, 4600), False, 'import os\n'), ((4656, 4692), 'oneflow.framework.distribute... |
"""
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.typing.Numpy.Placeholder",
"oneflow.constant_like",
"oneflow.FunctionConfig",
"oneflow.scope.consistent_view"
] | [((734, 757), 'numpy.full', 'np.full', (['x.shape', 'value'], {}), '(x.shape, value)\n', (741, 757), True, 'import numpy as np\n'), ((902, 923), 'oneflow.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (921, 923), True, 'import oneflow as flow\n'), ((1043, 1092), 'oneflow.global_function', 'flow.global_functi... |
"""
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.scope.consistent_view",
"oneflow.compatible.single_client.scope.placement",
"oneflow.compatible.single_client.watch_diff",
"oneflow.compatible.single_client.unittest.skip_unless_1n1d",
"oneflow.compatible.single_cli... | [((839, 890), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (883, 890), True, 'import tensorflow as tf\n'), ((3712, 3744), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}),... |
"""
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, 1112), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.abs', '"""Return the absolute value of each element in input tensor:math:`y = |x|` element-wise.\n\n Args:\n input (Tensor): the input tensor.\n\n For example:\n\n .. code-block:: python\n\n >>> import oneflow as... |
import numpy as np
import oneflow as flow
class Accuracy(flow.nn.Module):
def __init__(self):
super().__init__()
def forward(self, preds, labels):
top1_num = flow.zeros(1, dtype=flow.float32)
num_samples = 0
for pred, label in zip(preds, labels):
clsidxs = pred.arg... | [
"oneflow.zeros"
] | [((185, 218), 'oneflow.zeros', 'flow.zeros', (['(1)'], {'dtype': 'flow.float32'}), '(1, dtype=flow.float32)\n', (195, 218), True, 'import oneflow as flow\n'), ((528, 548), 'numpy.prod', 'np.prod', (['label.shape'], {}), '(label.shape)\n', (535, 548), True, 'import numpy as np\n')] |
# 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.tensor",
"oneflow.sin",
"oneflow.cat",
"oneflow.nn.init.xavier_uniform_",
"oneflow.nn.init.zeros_",
"oneflow.zeros",
"oneflow.meshgrid",
"oneflow.nn.init.normal_",
"oneflow.cos",
"oneflow.arange",
"oneflow.nn.init.uniform_"
] | [((3433, 3475), 'oneflow.nn.init.normal_', 'nn.init.normal_', (['self.cls_token'], {'std': '(1e-06)'}), '(self.cls_token, std=1e-06)\n', (3448, 3475), True, 'import oneflow.nn as nn\n'), ((4411, 4440), 'oneflow.meshgrid', 'flow.meshgrid', (['grid_w', 'grid_h'], {}), '(grid_w, grid_h)\n', (4424, 4440), True, 'import one... |
"""
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"
] | [((773, 805), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (803, 805), True, 'import oneflow as flow\n'), ((3632, 3664), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (3662, 3664), True, 'import oneflow as flow\n'), ((6712, 6744), '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.function_config",
"oneflow.compatible.single_client.FixedTensorDef",
"oneflow.compatible.single_client.concat",
"oneflow.compatible.single_client.global_function",
"oneflow.compatible.single_client.clear_default_session"
] | [((740, 762), 'oneflow.compatible.single_client.function_config', 'flow.function_config', ([], {}), '()\n', (760, 762), True, 'from oneflow.compatible import single_client as flow\n'), ((890, 918), 'oneflow.compatible.single_client.global_function', 'flow.global_function', (['config'], {}), '(config)\n', (910, 918), 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.framework.docstr.utils.add_docstr"
] | [((660, 3486), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow._C.triplet_margin_loss', '""" \n The documentation is referenced from: https://pytorch.org/docs/stable/generated/torch.nn.functional.triplet_margin_loss.html?highlight=triplet_margin_loss\n\n Creates a criterion that measures ... |
"""
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.util.MakeSure",
"oneflow.python.framework.id_util.UniqueStr"
] | [((1105, 1132), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1122, 1132), False, 'import logging\n'), ((4384, 4461), 'oneflow.python.onnx.util.MakeSure', 'util.MakeSure', (['(tensor is not None)', '"""input is required so it couldn\'t be None"""'], {}), '(tensor is not None, "input is ... |
"""
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.config.gpu_device_num",
"oneflow.compatible.single_client.scope.consistent_view",
"oneflow.compatible.single_client.math.relu",
"oneflow.compatible.single_client.scope.placement",
"oneflow.compatible.single_client.scope.mirrored_view",
"oneflow.compatible.single_client.us... | [((1022, 1108), '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", (1037, 1108), False, 'import unittest\n'), ((5360, 5375), 'unittest.main', 'unittest.main', ([], {}), '... |
"""
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.unittest.env.eager_execution_enabled",
"oneflow.experimental.Tensor",
"oneflow.experimental.lt"
] | [((2554, 2569), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2567, 2569), False, 'import unittest\n'), ((1025, 1048), 'oneflow.experimental.lt', 'flow.lt', (['input1', 'input2'], {}), '(input1, input2)\n', (1032, 1048), True, 'import oneflow.experimental as flow\n'), ((1964, 1991), 'numpy.random.randn', 'np.ran... |
"""
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.NewSessionId",
"oneflow.current_global_function_desc",
"oneflow._oneflow_internal.IsMultiClient",
"oneflow.framework.session_context.TryCloseDefaultSession",
"oneflow.support.enable_if.condition",
"oneflow._oneflow_internal.flags.with_cuda",
"oneflow.framework.session_context.... | [((2107, 2146), 'oneflow.support.enable_if.condition', 'enable_if.condition', (['hob.in_global_mode'], {}), '(hob.in_global_mode)\n', (2126, 2146), True, 'import oneflow.support.enable_if as enable_if\n'), ((3239, 3278), 'oneflow.support.enable_if.condition', 'enable_if.condition', (['hob.in_normal_mode'], {}), '(hob.i... |
"""
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.is_tensor",
"oneflow.from_numpy",
"oneflow.tensor"
] | [((944, 964), 'oneflow.is_tensor', 'flow.is_tensor', (['data'], {}), '(data)\n', (958, 964), True, 'import oneflow as flow\n'), ((2297, 2311), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (2305, 2311), True, 'import numpy as np\n'), ((2368, 2385), 'oneflow.tensor', 'flow.tensor', (['data'], {}), '(data)\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.nn.modules.utils._quadruple",
"oneflow.builtin_op",
"oneflow._C.pad"
] | [((20039, 20075), 'doctest.testmod', 'doctest.testmod', ([], {'raise_on_error': '(True)'}), '(raise_on_error=True)\n', (20054, 20075), False, 'import doctest\n'), ((3946, 3996), 'oneflow._C.pad', 'flow._C.pad', (['x'], {'pad': 'self.padding', 'mode': '"""replicate"""'}), "(x, pad=self.padding, mode='replicate')\n", (39... |
# Copyright TODO
""" BNN with VI.ELBO example code """
import sys
import os
import math
import numpy as np
import oneflow.experimental as flow
flow.enable_eager_execution()
sys.path.append('..')
sys.path.append('../..')
import conf
from zhusuan_of.framework.bn import BayesianNet
from zhusuan_of.variational.elbo i... | [
"oneflow.experimental.nn.ParameterList",
"oneflow.experimental.enable_eager_execution",
"oneflow.experimental.squeeze",
"oneflow.experimental.nn.init.uniform_",
"oneflow.experimental.zeros",
"oneflow.experimental.reshape",
"oneflow.experimental.unsqueeze",
"oneflow.experimental.mean",
"oneflow.exper... | [((147, 176), 'oneflow.experimental.enable_eager_execution', 'flow.enable_eager_execution', ([], {}), '()\n', (174, 176), True, 'import oneflow.experimental as flow\n'), ((178, 199), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (193, 199), False, 'import sys\n'), ((200, 224), 'sys.path.append',... |
# !/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.nn.dropout",
"oneflow.transpose",
"oneflow.gather",
"oneflow.scope.placement",
"oneflow.concat",
"oneflow.nn.max_pool2d",
"oneflow.train.CheckPoint",
"oneflow.typing.Numpy.Placeholder",
"oneflow.nn.softmax",
"oneflow.nn.relu",
"oneflow.layers.dense",
"onef... | [((3123, 3145), 'oneflow.function_config', 'flow.function_config', ([], {}), '()\n', (3143, 3145), True, 'import oneflow as flow\n'), ((5998, 6063), 'numpy.full', 'np.full', (['((num_samples, maxlen) + sample_shape)', 'value'], {'dtype': 'dtype'}), '((num_samples, maxlen) + sample_shape, value, dtype=dtype)\n', (6005, ... |
"""
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"
] | [((786, 837), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (830, 837), True, 'import tensorflow as tf\n'), ((1166, 1198), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1196, 1198), Tr... |
import tqdm
from typing import Optional
import oneflow as flow
import oneflow.nn as nn
from optimization import get_scheduler
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self, name, fmt=':f'):
self.name = name
self.fmt = fmt
self.re... | [
"oneflow.no_grad"
] | [((2040, 2152), 'optimization.get_scheduler', 'get_scheduler', (['"""linear"""', 'self.optimizer'], {'num_warmup_steps': 'warmup_steps', 'num_training_steps': 'total_train_steps'}), "('linear', self.optimizer, num_warmup_steps=warmup_steps,\n num_training_steps=total_train_steps)\n", (2053, 2152), False, 'from optim... |
"""
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",
"oneflow.compatible.single_client.scope.placement",
"oneflow.compatible.single_client.env.init",
"oneflow.compatible.single_client.FunctionConfig",
"oneflow.compatible.single_client.global_function",
"oneflow.compatible.single_client.clear_default_session"
] | [((939, 954), 'oneflow.compatible.single_client.env.init', 'flow.env.init', ([], {}), '()\n', (952, 954), True, 'from oneflow.compatible import single_client as flow\n'), ((973, 994), 'oneflow.compatible.single_client.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (992, 994), True, 'from oneflow.compatible i... |
"""
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.tensor_buffer_to_tensor_list",
"oneflow.compatible.single_client.tensor_list_to_tensor_buffer",
"oneflow.compatible.single_client.scope.mirrored_view",
"oneflow.compatible.single_client.typing.ListListNumpy.Placeholder",
"oneflow.compatible.single_client.FunctionConfig",
... | [((4757, 4843), '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", (4772, 4843), False, 'import unittest\n'), ((942, 970), 'oneflow.compatible.single_client.clear_default... |
# 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.tensor"
] | [((3556, 3581), 'random.shuffle', 'random.shuffle', (['self.data'], {}), '(self.data)\n', (3570, 3581), False, 'import random\n'), ((947, 972), 'jsonlines.open', 'jsonlines.open', (['path', '"""r"""'], {}), "(path, 'r')\n", (961, 972), False, 'import jsonlines\n'), ((1081, 1106), 'jsonlines.open', 'jsonlines.open', (['... |
"""
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.randn",
"oneflow.env.all_device_placement",
"oneflow.sbp.split",
"oneflow.distributed_partial_fc_sample",
"oneflow.Size"
] | [((1955, 1970), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1968, 1970), False, 'import unittest\n'), ((922, 959), 'oneflow.env.all_device_placement', 'flow.env.all_device_placement', (['"""cuda"""'], {}), "('cuda')\n", (951, 959), True, 'import oneflow as flow\n'), ((1189, 1245), 'oneflow.distributed_partial_... |
"""
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.blob_cache.TryDisableBlobCache",
"oneflow.python.ops.initializer_util.GetInitializer",
"oneflow.sync_default_session",
"oneflow.python.eager.op_infer_util.Infer",
"oneflow.core.operator.op_conf_pb2.OperatorConf",
"oneflow.python.ops.get_variable.CreateEagerVariableBlob",
"oneflow.p... | [((2117, 2160), 'oneflow.python.eager.blob_register.GetDefaultBlobRegister', 'blob_register_util.GetDefaultBlobRegister', ([], {}), '()\n', (2158, 2160), True, 'import oneflow.python.eager.blob_register as blob_register_util\n'), ((4542, 4577), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""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.unittest.skip_unless_1n1d",
"oneflow.tensor",
"oneflow.framework.tensor.TensorTuple"
] | [((831, 863), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (861, 863), True, 'import oneflow as flow\n'), ((771, 805), 'os.getenv', 'os.getenv', (['"""ONEFLOW_TEST_CPU_ONLY"""'], {}), "('ONEFLOW_TEST_CPU_ONLY')\n", (780, 805), False, 'import os\n'), ((2923, 2938), '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.nn.conv2d",
"oneflow.scope.namespace",
"oneflow.zeros_initializer",
"oneflow.layers.batch_normalization",
"oneflow.variance_scaling_initializer",
"oneflow.nn.max_pool2d",
"oneflow.nn.relu",
"oneflow.ones_initializer",
"oneflow.reshape",
"oneflow.transpose",
"oneflow.regularizers.l2",
... | [((960, 1058), 'oneflow.variance_scaling_initializer', 'flow.variance_scaling_initializer', (['(2)', '"""fan_in"""', '"""random_normal"""'], {'data_format': 'self.data_format'}), "(2, 'fan_in', 'random_normal', data_format\n =self.data_format)\n", (993, 1058), True, 'import oneflow as flow\n'), ((1610, 1807), 'onefl... |
import unittest
from collections import OrderedDict
import numpy as np
import oneflow as flow
from oneflow.test.modules.test_util import GenArgList
from ops import nms, lib_path
flow.config.load_library_now(lib_path())
def box_area(boxes):
return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])
def ... | [
"oneflow.device",
"oneflow.test.modules.test_util.GenArgList"
] | [((210, 220), 'ops.lib_path', 'lib_path', ([], {}), '()\n', (218, 220), False, 'from ops import nms, lib_path\n'), ((425, 477), 'numpy.maximum', 'np.maximum', (['boxes1[:, np.newaxis, :2]', 'boxes2[:, :2]'], {}), '(boxes1[:, np.newaxis, :2], boxes2[:, :2])\n', (435, 477), True, 'import numpy as np\n'), ((487, 539), '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.unittest.skip_unless_1n1d",
"oneflow.test_utils.automated_test_util.generators.random"
] | [((780, 812), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (810, 812), True, 'import oneflow as flow\n'), ((1814, 1829), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1827, 1829), False, 'import unittest\n'), ((1249, 1271), 'oneflow.test_utils.automated_test_util.gener... |
"""
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.tensor_list_to_tensor_buffer",
"oneflow.compatible.single_client.image_batch_align",
"oneflow.compatible.single_client.scope.mirrored_view",
"oneflow.compatible.single_client.typing.ListListNumpy.Placeholder",
"oneflow.compatible.single_client.FunctionConfig",
"oneflow.co... | [((3401, 3487), '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", (3416, 3487), False, 'import unittest\n'), ((827, 855), '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.compatible.single_client.zeros_initializer",
"oneflow.compatible.single_client.unittest.skip_unless_1n4d",
"oneflow.compatible.single_client.scope.consistent_view",
"oneflow.compatible.single_client.scope.placement",
"oneflow.compatible.single_client.global_function",
"oneflow.compatible.single_c... | [((2885, 2917), 'oneflow.compatible.single_client.unittest.skip_unless_1n4d', 'flow.unittest.skip_unless_1n4d', ([], {}), '()\n', (2915, 2917), True, 'from oneflow.compatible import single_client as flow\n'), ((1016, 1044), 'test_global_storage.Get', 'test_global_storage.Get', (['"""x"""'], {}), "('x')\n", (1039, 1044)... |
from collections import OrderedDict
import oneflow as flow
import oneflow.nn as nn
from typing import Any
__all__ = ["make_wide_and_deep_module"]
class Dense(nn.Module):
def __init__(
self, in_features: int, out_features: int, dropout_rate: float = 0.5
) -> None:
super(Dense, self).__init__(... | [
"oneflow.nn.Linear",
"oneflow.sum",
"oneflow.env.get_world_size",
"oneflow.env.all_device_placement",
"oneflow.sbp.split",
"oneflow.nn.Sigmoid",
"oneflow.nn.init.zeros_",
"oneflow.nn.init.xavier_uniform_",
"oneflow.nn.Dropout",
"oneflow.cat",
"oneflow.nn.ReLU",
"oneflow.nn.init.uniform_"
] | [((2687, 2712), 'oneflow.nn.Linear', 'nn.Linear', (['hidden_size', '(1)'], {}), '(hidden_size, 1)\n', (2696, 2712), True, 'import oneflow.nn as nn\n'), ((2852, 2864), 'oneflow.nn.Sigmoid', 'nn.Sigmoid', ([], {}), '()\n', (2862, 2864), True, 'import oneflow.nn as nn\n'), ((3377, 3422), 'oneflow.sum', 'flow.sum', (['wide... |
"""
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.sum",
"oneflow.device"
] | [((2234, 2266), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (2264, 2266), True, 'import oneflow as flow\n'), ((961, 983), 'oneflow.sum', 'flow.sum', (['input'], {'dim': '(0)'}), '(input, dim=0)\n', (969, 983), True, 'import oneflow as flow\n'), ((1225, 1247), 'oneflow.sum', ... |
"""
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.clear_default_session",
"oneflow.global_function",
"oneflow.scope.mirrored_view",
"oneflow.object_bbox_flip",
"oneflow.tensor_buffer_to_tensor_list",
"oneflow.typing.ListNumpy.Placeholder",
"oneflow.FunctionConfig",
"oneflow.tensor_list_to_tensor_buffer"
] | [((794, 822), 'oneflow.clear_default_session', 'flow.clear_default_session', ([], {}), '()\n', (820, 822), True, 'import oneflow as flow\n'), ((841, 862), 'oneflow.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (860, 862), True, 'import oneflow as flow\n'), ((980, 1013), 'oneflow.global_function', 'flow.glob... |
"""
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.support.enable_if.condition",
"oneflow.compatible.single_client.framework.c_api_util.CurJobBuildAndInferCtx_AddLossLogicalBlobName",
"oneflow.compatible.single_client.eager.gradient_util.GetDefaultBackwardBlobRegister",
"oneflow.compatible.single_client.support.enable_if.uniq... | [((1393, 1487), 'oneflow.compatible.single_client.support.enable_if.condition', 'enable_if.condition', (['(hob.in_global_mode & hob.is_trainable & ~hob.eager_execution_enabled)'], {}), '(hob.in_global_mode & hob.is_trainable & ~hob.\n eager_execution_enabled)\n', (1412, 1487), True, 'from oneflow.compatible.single_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.unittest.skip_unless_1n1d",
"oneflow.device",
"oneflow.nn.InstanceNorm2d",
"oneflow.nn.InstanceNorm1d",
"oneflow.nn.InstanceNorm3d"
] | [((14530, 14562), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (14560, 14562), True, 'import oneflow as flow\n'), ((861, 1120), 'numpy.array', 'np.array', (['[[[-0.1091, 2.0041, 0.885, -0.0412], [-1.2055, 0.7442, 2.33, 1.2411], [-\n 1.2466, 0.3667, 1.2267, 0.3043]], [[-0.2... |
import math
from functools import partial
import oneflow as flow
import oneflow.nn as nn
import oneflow.nn.init as init
from flowvision.layers import lecun_normal_, DropPath, PatchEmbed
from .helpers import named_apply
from .utils import load_state_dict_from_url
from .registry import ModelCreator
model_urls = {
... | [
"oneflow.nn.init.ones_",
"oneflow.nn.Linear",
"oneflow.split",
"oneflow.nn.init.constant_",
"oneflow.nn.init.zeros_",
"oneflow.nn.init.xavier_uniform_",
"oneflow.nn.Dropout",
"oneflow.nn.init.normal_",
"oneflow.nn.Identity"
] | [((2152, 2191), 'oneflow.nn.Linear', 'nn.Linear', (['in_features', 'hidden_features'], {}), '(in_features, hidden_features)\n', (2161, 2191), True, 'import oneflow.nn as nn\n'), ((2242, 2282), 'oneflow.nn.Linear', 'nn.Linear', (['hidden_features', 'out_features'], {}), '(hidden_features, out_features)\n', (2251, 2282),... |
"""
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.multiply",
"oneflow.compatible.single_client.math.divide",
"oneflow.compatible.single_client.math.add",
"oneflow.compatible.single_client.unittest.skip_unless_1n1d",
"oneflow.compatible.single_client.math.subtract",
"oneflow.compatible.single_client.typing.Numpy.Plac... | [((1996, 2028), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (2026, 2028), True, 'from oneflow.compatible import single_client as flow\n'), ((1289, 1310), 'oneflow.compatible.single_client.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (130... |
import math
import oneflow as flow
from oneflow import nn
def gelu_new(x):
return (
0.5
* x
* (
1.0
+ flow.tanh(math.sqrt(2.0 / math.pi) * (x + 0.044715 * flow.pow(x, 3.0)))
)
)
def gelu_fast(x):
return 0.5 * x * (1.0 + flow.tanh(x * 0.7978845608 ... | [
"oneflow.sigmoid",
"oneflow.pow",
"oneflow.tanh"
] | [((385, 408), 'oneflow.sigmoid', 'flow.sigmoid', (['(1.702 * x)'], {}), '(1.702 * x)\n', (397, 408), True, 'import oneflow as flow\n'), ((293, 347), 'oneflow.tanh', 'flow.tanh', (['(x * 0.7978845608 * (1.0 + 0.044715 * x * x))'], {}), '(x * 0.7978845608 * (1.0 + 0.044715 * x * x))\n', (302, 347), True, 'import oneflow ... |
"""
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",
"oneflow.F.acosh",
"oneflow.python.framework.tensor.register_tensor_op"
] | [((931, 954), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""acosh"""'], {}), "('acosh')\n", (945, 954), False, 'from oneflow.python.oneflow_export import oneflow_export, experimental_api\n'), ((1832, 1859), 'oneflow.python.framework.tensor.register_tensor_op', 'register_tensor_op', (['"""acosh... |
"""
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"
] | [((691, 723), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (721, 723), True, 'import oneflow as flow\n'), ((2524, 2539), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2537, 2539), False, 'import unittest\n')] |
"""
Modified from https://github.com/pytorch/vision/blob/main/torchvision/models/squeezenet.py
"""
from typing import Any
import oneflow as flow
import oneflow.nn as nn
import oneflow.nn.init as init
from .utils import load_state_dict_from_url
from .registry import ModelCreator
__all__ = ["SqueezeNet", "squeezenet1_... | [
"oneflow.nn.MaxPool2d",
"oneflow.nn.init.kaiming_uniform_",
"oneflow.nn.init.constant_",
"oneflow.flatten",
"oneflow.nn.Conv2d",
"oneflow.nn.Dropout",
"oneflow.nn.init.normal_",
"oneflow.nn.AdaptiveAvgPool2d",
"oneflow.nn.ReLU"
] | [((918, 968), 'oneflow.nn.Conv2d', 'nn.Conv2d', (['inplanes', 'squeeze_planes'], {'kernel_size': '(1)'}), '(inplanes, squeeze_planes, kernel_size=1)\n', (927, 968), True, 'import oneflow.nn as nn\n'), ((1003, 1024), 'oneflow.nn.ReLU', 'nn.ReLU', ([], {'inplace': '(True)'}), '(inplace=True)\n', (1010, 1024), True, 'impo... |
import oneflow as flow
import oneflow.nn as nn
from oneflow import Tensor
from typing import Type, Any, Callable, Union, List, Optional
class ccmp(nn.Module):
def __init__(self, kernel_size, stride=None, padding=0, ceil_mode=False,
count_include_pad=True):
super(ccmp, self).__init__()
... | [
"oneflow.nn.Linear",
"oneflow.sum",
"oneflow.nn.CrossEntropyLoss",
"oneflow.nn.AvgPool2d",
"oneflow.flatten",
"oneflow.softmax"
] | [((542, 595), 'oneflow.nn.AvgPool2d', 'nn.AvgPool2d', (['kernel_size', 'stride', 'padding', 'ceil_mode'], {}), '(kernel_size, stride, padding, ceil_mode)\n', (554, 595), True, 'import oneflow.nn as nn\n'), ((925, 945), 'oneflow.nn.AvgPool2d', 'nn.AvgPool2d', (['(7, 7)'], {}), '((7, 7))\n', (937, 945), True, 'import one... |
"""
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.squeeze",
"oneflow.experimental.sum",
"oneflow.experimental.mean",
"oneflow.python.oneflow_export.oneflow_export",
"oneflow.builtin_op",
"oneflow.experimental.reshape"
] | [((764, 801), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""nn.CrossEntropyLoss"""'], {}), "('nn.CrossEntropyLoss')\n", (778, 801), False, 'from oneflow.python.oneflow_export import oneflow_export, experimental_api\n'), ((5399, 5427), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_ex... |
"""
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.nn.graph.AddTensorAsGraphLoss",
"oneflow.F.constant",
"oneflow.tensor_buffer_to_list_of_tensors",
"oneflow.constant_initializer",
"oneflow.F.tensor_getitem",
"oneflow.framework.tensor_str._gen_tensor_meta_str",
"oneflow.framework.tensor_str._gen_tensor_str",
"oneflow.xavier_... | [((2912, 2951), 'oneflow.F.tensor_setitem', 'flow.F.tensor_setitem', (['self', 'key', 'value'], {}), '(self, key, value)\n', (2933, 2951), True, 'import oneflow as flow\n'), ((3043, 3080), 'oneflow.framework.tensor_str._gen_tensor_str', 'tensor_str_util._gen_tensor_str', (['self'], {}), '(self)\n', (3074, 3080), 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.python.oneflow_export.oneflow_export"
] | [((1130, 1154), 'oneflow.compatible.single_client.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""dtypes"""'], {}), "('dtypes')\n", (1144, 1154), False, 'from oneflow.compatible.single_client.python.oneflow_export import oneflow_export\n'), ((1678, 1732), 'oneflow.compatible.single_client.python.oneflow_... |
"""
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.unsqueeze",
"oneflow.test_utils.test_util.GenArgList",
"oneflow.device"
] | [((2169, 2201), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (2199, 2201), True, 'import oneflow as flow\n'), ((872, 898), 'numpy.random.rand', 'np.random.rand', (['(2)', '(6)', '(9)', '(3)'], {}), '(2, 6, 9, 3)\n', (886, 898), True, 'import numpy as np\n'), ((983, 1007), '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.python.eager.symbol_storage.GetSymbol4String",
"oneflow.python.eager.boxing_util.BoxingTo",
"oneflow.python.eager.symbol.Symbol",
"oneflow.python.eager.object.BlobObject",
"oneflow.python.vm.id_util.PhysicalIdGenerator",
"oneflow.core.register.blob_desc_pb2.BlobDescProto",
"oneflow.python.eager... | [((53169, 53194), 'oneflow.core.operator.op_conf_pb2.OperatorConf', 'op_conf_pb.OperatorConf', ([], {}), '()\n', (53192, 53194), True, 'import oneflow.core.operator.op_conf_pb2 as op_conf_pb\n'), ((53214, 53240), 'oneflow.python.framework.id_util.UniqueStr', 'id_util.UniqueStr', (['"""Input"""'], {}), "('Input')\n", (5... |
import oneflow.experimental as flow
import numpy as np
flow.enable_eager_execution()
class MyLayer(flow.nn.Module):
def __init__(self):
super(MyLayer, self).__init__()
self.p = flow.nn.Parameter(flow.Tensor(1, dtype=flow.float32))
flow.nn.init.normal_(self.p)
def forward(self, input):... | [
"oneflow.experimental.nn.init.normal_",
"oneflow.experimental.enable_eager_execution",
"oneflow.experimental.Tensor",
"oneflow.experimental.cat",
"oneflow.experimental.cast",
"oneflow.experimental.ones_like"
] | [((56, 85), 'oneflow.experimental.enable_eager_execution', 'flow.enable_eager_execution', ([], {}), '()\n', (83, 85), True, 'import oneflow.experimental as flow\n'), ((776, 798), 'numpy.random.randn', 'np.random.randn', (['(10)', '(1)'], {}), '(10, 1)\n', (791, 798), True, 'import numpy as np\n'), ((261, 289), 'oneflow... |
"""
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.nn.CropMirrorNormalize",
"oneflow.nn.OFRecordImageDecoder",
"oneflow.nn.CrossEntropyLoss",
"oneflow.nn.image.Resize",
"oneflow.load",
"oneflow.nn.OfrecordRawDecoder",
"oneflow.nn.OfrecordReader"
] | [((732, 764), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (762, 764), True, 'import oneflow as flow\n'), ((782, 816), 'os.getenv', 'os.getenv', (['"""ONEFLOW_TEST_CPU_ONLY"""'], {}), "('ONEFLOW_TEST_CPU_ONLY')\n", (791, 816), False, 'import os\n'), ((6464, 6479), '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.core.job.regularizer_conf_pb2.RegularizerConf",
"oneflow.python.oneflow_export.oneflow_export"
] | [((817, 853), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""regularizers.l1_l2"""'], {}), "('regularizers.l1_l2')\n", (831, 853), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((2353, 2386), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""regular... |
# 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.ones"
] | [((1108, 1139), 'oneflow.ones', 'flow.ones', (['(512)'], {'dtype': 'flow.long'}), '(512, dtype=flow.long)\n', (1117, 1139), True, 'import oneflow as flow\n'), ((1194, 1226), 'oneflow.ones', 'flow.ones', (['(1,)'], {'dtype': 'flow.long'}), '((1,), dtype=flow.long)\n', (1203, 1226), 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.device",
"oneflow._C.consistent_eye",
"oneflow._C.eye"
] | [((2761, 2797), 'doctest.testmod', 'doctest.testmod', ([], {'raise_on_error': '(True)'}), '(raise_on_error=True)\n', (2776, 2797), False, 'import doctest\n'), ((1949, 1994), 'oneflow._C.eye', 'flow._C.eye', (['n', 'm'], {'dtype': 'dtype', 'device': 'device'}), '(n, m, dtype=dtype, device=device)\n', (1960, 1994), 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.einsum",
"oneflow.chunk",
"oneflow.sbp.split",
"oneflow.no_grad",
"oneflow.nn.CrossEntropyLoss",
"oneflow.nn.BatchNorm1d",
"oneflow.nn.functional.normalize",
"oneflow.nn.Sequential",
"oneflow.env.get_rank",
"oneflow.arange",
"oneflow.nn.ReLU"
] | [((3005, 3019), 'oneflow.no_grad', 'flow.no_grad', ([], {}), '()\n', (3017, 3019), True, 'import oneflow as flow\n'), ((2900, 2919), 'oneflow.nn.Sequential', 'nn.Sequential', (['*mlp'], {}), '(*mlp)\n', (2913, 2919), True, 'import oneflow.nn as nn\n'), ((3387, 3420), 'oneflow.nn.functional.normalize', 'nn.functional.no... |
import random
import argparse
from tqdm import tqdm
from projects.optimization import get_schedule
from flowtext.models.bert import bert
from flowtext.models.bert.model_bert import BertForSequenceClassification
from projects.utils import (
accuracy,
convert_examples_to_features,
ColaProcessor,
MnliProc... | [
"oneflow.tensor",
"oneflow.no_grad",
"oneflow.device",
"oneflow.cuda.is_available",
"oneflow.utils.data.DataLoader",
"oneflow.optim.AdamW",
"oneflow.manual_seed",
"oneflow.utils.data.TensorDataset",
"oneflow.utils.data.SequentialSampler",
"oneflow.utils.data.RandomSampler"
] | [((549, 564), 'projects.utils.ColaProcessor', 'ColaProcessor', ([], {}), '()\n', (562, 564), False, 'from projects.utils import accuracy, convert_examples_to_features, ColaProcessor, MnliProcessor, MrpcProcessor\n'), ((582, 597), 'projects.utils.MnliProcessor', 'MnliProcessor', ([], {}), '()\n', (595, 597), False, 'fro... |
"""
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.clear_default_session",
"oneflow.global_function",
"oneflow.quantization.moving_average_min_max_observer",
"oneflow.scope.placement",
"oneflow.get_all_variables",
"oneflow.random_uniform_initializer"
] | [((1288, 1316), 'oneflow.clear_default_session', 'flow.clear_default_session', ([], {}), '()\n', (1314, 1316), True, 'import oneflow as flow\n'), ((1323, 1345), 'oneflow.global_function', 'flow.global_function', ([], {}), '()\n', (1343, 1345), True, 'import oneflow as flow\n'), ((1863, 1956), 'util.convert_to_onnx_and_... |
import os
from os import mkdir
from oneflow_onnx.oneflow2onnx.util import convert_to_onnx_and_check
import oneflow as flow
import logging
from backbones import get_model
from utils.utils_config import get_config
import argparse
import tempfile
class ModelGraph(flow.nn.Graph):
def __init__(self, model):
s... | [
"oneflow.randn",
"oneflow.load"
] | [((1508, 1549), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.NOTSET'}), '(level=logging.NOTSET)\n', (1527, 1549), False, 'import logging\n'), ((1554, 1583), 'logging.info', 'logging.info', (['args.model_path'], {}), '(args.model_path)\n', (1566, 1583), False, 'import logging\n'), ((1594, 1617),... |
"""
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.global_function",
"oneflow.train.CheckPoint",
"oneflow.constant_initializer",
"oneflow.config.enable_debug_mode",
"oneflow.scope.placement",
"oneflow.experimental.ssp_variable_proxy",
"oneflow.config.cpu_device_num",
"oneflow.eager_execution_enabled",
... | [((689, 721), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (719, 721), True, 'import oneflow as flow\n'), ((6499, 6514), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6512, 6514), False, 'import unittest\n'), ((847, 877), 'oneflow.eager_execution_enabled', 'flow.eager_... |
"""
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.LogSoftmax",
"oneflow.experimental.unittest.env.eager_execution_enabled",
"oneflow.experimental.nn.Hardtanh",
"oneflow.experimental.nn.ReLU6",
"oneflow.experimental.nn.ELU",
"oneflow.experimental.device",
"oneflow.experimental.nn.Sigmoid",
"oneflow.experimental.nn.GELU",
"on... | [((822, 845), 'numpy.random.randn', 'np.random.randn', (['*shape'], {}), '(*shape)\n', (837, 845), True, 'import numpy as np\n'), ((974, 988), 'oneflow.experimental.nn.ReLU', 'flow.nn.ReLU', ([], {}), '()\n', (986, 988), True, 'import oneflow.experimental as flow\n'), ((1027, 1050), 'numpy.maximum', 'np.maximum', (['(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... | [
"oneflow.nn.conv2d_transpose",
"oneflow.nn.compat_conv2d",
"oneflow.constant_initializer",
"oneflow.glorot_uniform_initializer",
"oneflow.layers.batch_normalization",
"oneflow.nn.bias_add",
"oneflow.reshape",
"oneflow.random_normal_initializer",
"oneflow.matmul"
] | [((1501, 1647), 'oneflow.nn.conv2d_transpose', 'flow.nn.conv2d_transpose', (['input', 'weight'], {'strides': '[strides, strides]', 'output_shape': 'output_shape', 'padding': '"""SAME"""', 'data_format': '"""NCHW"""', 'name': 'name_'}), "(input, weight, strides=[strides, strides],\n output_shape=output_shape, padding... |
"""
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.stateful_op",
"oneflow.compatible.single_client.no_grad",
"oneflow.compatible.single_client.experimental.zeros_like",
"oneflow.compatible.single_client._C.dispatch_sgd_update",
"oneflow.compatible.single_client._C.dispatch_momentum_update"
] | [((3292, 3306), 'oneflow.compatible.single_client.no_grad', 'flow.no_grad', ([], {}), '()\n', (3304, 3306), True, 'from oneflow.compatible import single_client as flow\n'), ((2830, 2865), 'oneflow.compatible.single_client.experimental.zeros_like', 'flow.experimental.zeros_like', (['param'], {}), '(param)\n', (2858, 286... |
"""
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.quantization.moving_average_min_max_observer",
"oneflow.scope.placement",
"oneflow.quantization.min_max_observer",
"oneflow.get_all_variables",
"oneflow.random_uniform_initializer"
] | [((1363, 1385), 'oneflow.global_function', 'flow.global_function', ([], {}), '()\n', (1383, 1385), True, 'import oneflow as flow\n'), ((1978, 2053), 'util.convert_to_onnx_and_check', 'convert_to_onnx_and_check', (['fake_quantization'], {'opset': '(10 if per_layer else 13)'}), '(fake_quantization, opset=10 if per_layer ... |
"""
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, 2302), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.topk', '"""Finds the values and indices of the k largest entries at specified axis.\n\n Args:\n input (oneflow.Tensor): Input Tensor\n k (int): the k in “top-k”\n dim (int, optional): the dimension to sort along... |
"""
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.framework.session_context.GetDefaultSession",
"oneflow.env.is_multi_client"
] | [((809, 841), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (839, 841), True, 'import oneflow as flow\n'), ((1489, 1504), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1502, 1504), False, 'import unittest\n'), ((984, 1015), 'oneflow.framework.session_context.GetDefaultS... |
"""
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.config.gpu_device_num",
"oneflow.compatible.single_client.unittest.skip_unless_1n4d",
"oneflow.compatible.single_client.scope.mirrored_view",
"oneflow.compatible.single_client.typing.ListNumpy.Placeholder",
"oneflow.compatible.single_client.typing.Numpy.Placeholder",
"one... | [((798, 830), 'oneflow.compatible.single_client.unittest.skip_unless_1n4d', 'flow.unittest.skip_unless_1n4d', ([], {}), '()\n', (828, 830), True, 'from oneflow.compatible import single_client as flow\n'), ((2284, 2299), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2297, 2299), False, 'import unittest\n'), ((935... |
"""
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.no_grad",
"oneflow.ops.initializer_util.CalcGain"
] | [((733, 762), 'oneflow.ops.initializer_util.CalcGain', 'CalcGain', (['nonlinearity', 'param'], {}), '(nonlinearity, param)\n', (741, 762), False, 'from oneflow.ops.initializer_util import CalcGain\n'), ((810, 824), 'oneflow.no_grad', 'flow.no_grad', ([], {}), '()\n', (822, 824), True, 'import oneflow as flow\n'), ((914... |
"""
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.conv2d",
"oneflow.scope.namespace",
"oneflow.current_global_function_desc",
"oneflow.python.framework.distribute.broadcast",
"oneflow.constant_initializer",
"oneflow.constant",
"oneflow.zeros_initializer",
"oneflow.python.framework.distribute.split",
"oneflow.user_op_builder",
"oneflow... | [((985, 1015), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""layers.dense"""'], {}), "('layers.dense')\n", (999, 1015), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((5286, 5317), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""layers.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.framework.docstr.utils.add_docstr"
] | [((660, 1875), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.max', '"""\n oneflow.max(input, dim=None, keepdim=False)\n\n Computes the maximum value of all elements in the input tensor.\n \n Args:\n input (oneflow.Tensor): the Input Tensor\n dim (int, optional): the dim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.