code stringlengths 118 171k | apis list | extract_api stringlengths 145 164k |
|---|---|---|
# 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.nn.CrossEntropyLoss",
"oneflow.tensor",
"oneflow.index_select"
] | [((1058, 1071), 'projects.SimCSE.modeling.model_utils.MLPLayer', 'MLPLayer', (['cfg'], {}), '(cfg)\n', (1066, 1071), False, 'from projects.SimCSE.modeling.model_utils import MLPLayer, cosine_similarity\n'), ((2422, 2486), 'oneflow.tensor', 'flow.tensor', (['use_row'], {'sbp': 'labels.sbp', 'placement': 'labels.placemen... |
"""
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.session_context.GetDefaultSession",
"oneflow.python.lib.core.enable_if.unique",
"oneflow.python.framework.typing_util.TransformWatchedBlob",
"oneflow.python.framework.id_util.UniqueStr",
"oneflow.python.framework.compile_context.CurJobAddOp",
"oneflow.core.job.lbi_diff_watcher_in... | [((1696, 1719), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""watch"""'], {}), "('watch')\n", (1710, 1719), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((4034, 4103), 'oneflow.python.lib.core.enable_if.condition', 'enable_if.condition', (['(hob.in_global_mode & hob.ea... |
# import tensorflow as tf
import oneflow as flow
# from core.resnet_module import make_bottleneck_layer, make_basic_layer
from core.resnet_module import *
import datetime
# global time=0
class HighResolutionModule(object):
def __init__(self, num_branches, num_in_channels, num_channels, block, num_blocks, fusion_me... | [
"oneflow.layers.upsample_2d",
"oneflow.nn.relu"
] | [((15402, 15417), 'oneflow.nn.relu', 'flow.nn.relu', (['x'], {}), '(x)\n', (15414, 15417), True, 'import oneflow as flow\n'), ((15779, 15794), 'oneflow.nn.relu', 'flow.nn.relu', (['x'], {}), '(x)\n', (15791, 15794), True, 'import oneflow as flow\n'), ((2049, 2072), 'datetime.datetime.now', 'datetime.datetime.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 law or agr... | [
"oneflow.global_function",
"oneflow.FunctionConfig",
"oneflow.tensor_buffer_to_tensor_list",
"oneflow.typing.ListListNumpy.Placeholder",
"oneflow.clear_default_session",
"oneflow.tensor_list_to_tensor_buffer",
"oneflow.image_decode",
"oneflow.scope.mirrored_view"
] | [((955, 983), 'oneflow.clear_default_session', 'flow.clear_default_session', ([], {}), '()\n', (981, 983), True, 'import oneflow as flow\n'), ((1002, 1023), 'oneflow.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (1021, 1023), True, 'import oneflow as flow\n'), ((1141, 1190), '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.config.machine_num",
"oneflow.matmul",
"oneflow.scope.consistent_view",
"oneflow.image.crop_mirror_normalize",
"oneflow.constant_initializer",
"oneflow.env.ctrl_port",
"oneflow.nn.avg_pool2d",
"oneflow.deprecated.delete_worker",
"oneflow.nn.conv2d",
"oneflow.truncated_normal",
"oneflow.... | [((1526, 1598), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""flags for multi-node and resource"""'}), "(description='flags for multi-node and resource')\n", (1549, 1598), False, 'import argparse\n'), ((3062, 3095), 'oneflow.random_uniform_initializer', 'flow.random_uniform_initializer'... |
"""
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"
] | [((701, 792), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""python_bin"""', '"""python3"""', '"""python binary program name or filepath."""'], {}), "('python_bin', 'python3',\n 'python binary program name or filepath.')\n", (720, 792), False, 'from absl import app, flags\n'), ((789, 908), 'absl.flags.DEFI... |
"""
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_adam_update",
"oneflow.unittest.skip_unless_1n1d",
"oneflow.tensor",
"oneflow.test_utils.test_util.GenArgDict"
] | [((6290, 6322), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (6320, 6322), True, 'import oneflow as flow\n'), ((1163, 1206), 'numpy.random.randint', 'np.random.randint', (['(1)', 'num_rows', 'train_iters'], {}), '(1, num_rows, train_iters)\n', (1180, 1206), True, 'import nump... |
"""
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.repeat",
"oneflow.compatible.single_client.typing.Numpy.Placeholder",
"oneflow.compatible.single_client.cast",
"oneflow.compatible.single_client.clear_default_session",
"oneflow.compatible.single_client.global_function",
... | [((879, 900), 'oneflow.compatible.single_client.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (898, 900), True, 'from oneflow.compatible import single_client as flow\n'), ((1819, 1851), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1849, 1... |
import oneflow as flow
import oneflow.typing as tp
import numpy as np
def _get_regularizer(model_name):
#all decay
return flow.regularizers.l2(0.00004)
def _get_initializer(model_name):
if model_name == "weight":
return flow.variance_scaling_initializer(2.0, mode="fan_in", distribution="random_nor... | [
"oneflow.expand_dims",
"oneflow.variance_scaling_initializer",
"oneflow.nn.conv2d",
"oneflow.ones_initializer",
"oneflow.nn.relu6",
"oneflow.random_normal_initializer",
"oneflow.get_variable",
"oneflow.broadcast_like",
"oneflow.reshape",
"oneflow.zeros_initializer",
"oneflow.nn.avg_pool2d",
"o... | [((131, 158), 'oneflow.regularizers.l2', 'flow.regularizers.l2', (['(4e-05)'], {}), '(4e-05)\n', (151, 158), True, 'import oneflow as flow\n'), ((1021, 1197), 'oneflow.get_variable', 'flow.get_variable', (["(name + '-weight')"], {'shape': 'shape', 'dtype': 'x.dtype', 'initializer': 'weight_initializer', 'regularizer': ... |
"""
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.ofblob.OfBlob",
"oneflow.framework.session_context.GetDefaultSession",
"oneflow.framework.local_blob.LocalBlob",
"oneflow.framework.typing_util.TransformWatchedBlob"
] | [((1891, 1950), 'oneflow.framework.local_blob.LocalBlob', 'local_blob_util.LocalBlob', (['ndarray', 'blob_watched.is_dynamic'], {}), '(ndarray, blob_watched.is_dynamic)\n', (1916, 1950), True, 'import oneflow.framework.local_blob as local_blob_util\n'), ((1640, 1671), 'oneflow.framework.session_context.GetDefaultSessio... |
"""
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, 2358), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.clamp', '"""\n Clamp all elements in :attr:`input` into the range `[` :attr:`min`, :attr:`max` `]` and return\n a resulting tensor:\n\n .. math::\n y_i = \\\\begin{cases}\n \\\\text{min} & \\\\text{if } x_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.framework.docstr.utils.add_docstr"
] | [((660, 4033), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.nonzero', '"""nonzero(input, *, out=None, as_tuple=False) -> Tensor or tuple of Tensors\n\n .. note::\n When :attr:`as_tuple` is ``False`` (default): returns a\n 2-D tensor where each row is the index for a nonzero va... |
"""
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.ones_like",
"oneflow.experimental.zeros_like",
"oneflow.experimental.ones",
"oneflow.experimental.zeros"
] | [((2433, 2448), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2446, 2448), False, 'import unittest\n'), ((901, 918), 'oneflow.experimental.ones', 'flow.ones', (['shape1'], {}), '(shape1)\n', (910, 918), True, 'import oneflow.experimental as flow\n'), ((1006, 1019), 'oneflow.experimental.ones', 'flow.ones', (['(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.nn.functional.cosine_similarity",
"oneflow.randn",
"oneflow.unittest.skip_unless_1n1d"
] | [((657, 689), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (687, 689), True, 'import oneflow as flow\n'), ((1632, 1647), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1645, 1647), False, 'import unittest\n'), ((1249, 1265), 'oneflow.randn', 'flow.randn', (['(2)', '(5)'... |
from logging import log
import math
import random
from typing import Optional, Tuple
import oneflow as flow
import oneflow.nn as nn
from oneflow.nn import CrossEntropyLoss, MSELoss
from .bert import Bert
from .bart_utils import (
shift_tokens_right,
_make_causal_mask,
_expand_mask,
init_weights,
t... | [
"oneflow.arange",
"oneflow.cat",
"oneflow.nn.LayerNorm",
"oneflow.nn.functional.dropout",
"oneflow.nn.CrossEntropyLoss",
"oneflow.zeros",
"oneflow.nn.Dropout",
"oneflow.bmm",
"oneflow.nn.Embedding",
"oneflow.tanh",
"oneflow.nn.Linear",
"oneflow.ones_like"
] | [((1401, 1519), 'oneflow.arange', 'flow.arange', (['past_key_values_length', '(past_key_values_length + seq_len)'], {'dtype': 'flow.long', 'device': 'self.weight.device'}), '(past_key_values_length, past_key_values_length + seq_len, dtype\n =flow.long, device=self.weight.device)\n', (1412, 1519), True, 'import onefl... |
from typing import Optional, Dict
import oneflow as flow
from . import RearrangeMixin, ReduceMixin
from ._einmix import _EinmixMixin
__author__ = '<NAME> & <NAME>'
class Rearrange(RearrangeMixin, flow.nn.Module):
def forward(self, input):
return self._apply_recipe(input)
class Reduce(ReduceMixin, flo... | [
"oneflow.einsum",
"oneflow.zeros"
] | [((1772, 1824), 'oneflow.einsum', 'flow.einsum', (['self.einsum_pattern', 'input', 'self.weight'], {}), '(self.einsum_pattern, input, self.weight)\n', (1783, 1824), True, 'import oneflow as flow\n'), ((577, 601), 'oneflow.zeros', 'flow.zeros', (['weight_shape'], {}), '(weight_shape)\n', (587, 601), True, 'import oneflo... |
"""
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.less_equal",
"oneflow.compatible.single_client.math.divide",
"oneflow.compatible.single_client.math.less",
"oneflow.compatible.single_client.math.equal",
"oneflow.compatible.single_client.math.greater",
"oneflow.compatible.single_client.math.mod",
"oneflow.compatib... | [((680, 704), 'oneflow.compatible.single_client.math.add', 'flow.math.add', (['self', 'rhs'], {}), '(self, rhs)\n', (693, 704), True, 'from oneflow.compatible import single_client as flow\n'), ((743, 767), 'oneflow.compatible.single_client.math.add', 'flow.math.add', (['lhs', 'self'], {}), '(lhs, self)\n', (756, 767), ... |
"""
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, 1922), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow._C.one_hot', '"""\n one_hot(input, num_classes=-1, on_value=1, off_value=0)\n This operator generates a onehot Tensor from input Tensor.\n\n If input Tensor\'s rank is `N`, the corresponding onehot Tensor\'s rank is `N+1`.\n\n... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.framework.docstr.utils.add_docstr"
] | [((660, 2674), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.F.conv1d', '"""\n conv1d(input, weight, bias=None, stride=[1], padding=[0], dilation=[1], groups=1) -> Tensor\n\n The documentation is referenced from: https://pytorch.org/docs/stable/generated/torch.nn.functional.conv1d.html?hig... |
"""
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.functional.l2_normalize",
"oneflow.device"
] | [((3493, 3525), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (3523, 3525), True, 'import oneflow as flow\n'), ((1109, 1137), 'numpy.zeros', 'np.zeros', (['square_x_sum_shape'], {}), '(square_x_sum_shape)\n', (1117, 1137), True, 'import numpy as np\n'), ((1232, 1248), 'numpy.z... |
"""
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.flatten",
"oneflow.experimental.Tensor",
"oneflow.experimental.nn.Flatten",
"oneflow.experimental.nn.init.uniform_",
"oneflow.experimental.unittest.env.eager_execution_enabled",
"oneflow.experimental.Size"
] | [((1922, 1937), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1935, 1937), False, 'import unittest\n'), ((873, 890), 'oneflow.experimental.nn.Flatten', 'flow.nn.Flatten', ([], {}), '()\n', (888, 890), True, 'import oneflow.experimental as flow\n'), ((903, 927), 'oneflow.experimental.Tensor', 'flow.Tensor', (['(3... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.python.oneflow_export.oneflow_export"
] | [((1144, 1188), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""nn.Graph"""', '"""nn.graph.Graph"""'], {}), "('nn.Graph', 'nn.graph.Graph')\n", (1158, 1188), False, 'from oneflow.python.oneflow_export import oneflow_export, experimental_api\n'), ((6071, 6103), 'oneflow.python.oneflow_export.onef... |
"""
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.ops.transpose_util.get_perm_when_transpose_axis_to_last_dim",
"oneflow._C.transpose",
"oneflow._C.matmul",
"oneflow._C.top_k",
"oneflow.ops.transpose_util.get_inversed_perm",
"oneflow._C.asin",
"oneflow._C.fmod",
"oneflow.gather",
"oneflow.framework.tensor.register_tensor_op",
"oneflow._C... | [((3076, 3103), 'oneflow.framework.tensor.register_tensor_op', 'register_tensor_op', (['"""asinh"""'], {}), "('asinh')\n", (3094, 3103), False, 'from oneflow.framework.tensor import register_tensor_op\n'), ((3214, 3240), 'oneflow.framework.tensor.register_tensor_op', 'register_tensor_op', (['"""sin_"""'], {}), "('sin_'... |
"""
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.tensor.register_tensor_op",
"oneflow.builtin_op",
"oneflow.experimental.slice",
"oneflow.python.oneflow_export.oneflow_export"
] | [((1409, 1435), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""argwhere"""'], {}), "('argwhere')\n", (1423, 1435), False, 'from oneflow.python.oneflow_export import oneflow_export, experimental_api\n'), ((2423, 2453), 'oneflow.python.framework.tensor.register_tensor_op', 'register_tensor_op', (... |
"""
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.env.ctrl_port",
"oneflow.env.machine",
"oneflow.train.CheckPoint"
] | [((815, 849), 'oneflow.env.ctrl_port', 'flow.env.ctrl_port', (['args.ctrl_port'], {}), '(args.ctrl_port)\n', (833, 849), True, 'import oneflow as flow\n'), ((1026, 1049), 'oneflow.env.machine', 'flow.env.machine', (['nodes'], {}), '(nodes)\n', (1042, 1049), True, 'import oneflow as flow\n'), ((1206, 1229), 'oneflow.tra... |
"""
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, 1179), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow._C.swapaxes', '"""swapaxes(input, axis0, axis1) -> Tensor\n \n This function is equivalent to NumPy’s swapaxes function.\n\n For example:\n\n .. code-block:: python\n \n >>> 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._C.lstm",
"oneflow.nn.init.uniform_",
"oneflow._C.rnn_tanh_cell",
"oneflow._C.lstm_cell",
"oneflow._C.rnn_tanh",
"oneflow._C.gru_cell",
"oneflow.zeros",
"oneflow._C.rnn_relu",
"oneflow.nn.utils.rnn.PackedSequence",
"oneflow.empty",
"oneflow._C.rnn_relu_cell",
"oneflow._C.gru"
] | [((56153, 56189), 'doctest.testmod', 'doctest.testmod', ([], {'raise_on_error': '(True)'}), '(raise_on_error=True)\n', (56168, 56189), False, 'import doctest\n'), ((51904, 51996), 'oneflow._C.lstm_cell', 'flow._C.lstm_cell', (['input', 'hx', 'self.weight_ih', 'self.weight_hh', 'self.bias_ih', 'self.bias_hh'], {}), '(in... |
"""
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.oneflow.core.job.job_conf.JobConfigProto"
] | [((936, 965), 'oneflow._oneflow_internal.oneflow.core.job.job_conf.JobConfigProto', 'job_conf_cfg.JobConfigProto', ([], {}), '()\n', (963, 965), True, 'import oneflow._oneflow_internal.oneflow.core.job.job_conf as job_conf_cfg\n')] |
"""
Copyright 2020 Tianshu AI Platform. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | [
"oneflow.scope.namespace",
"oneflow.matmul",
"oneflow.math.reduce_sum",
"oneflow.gather",
"oneflow.nn.sparse_softmax_cross_entropy_with_logits",
"oneflow.constant_initializer",
"oneflow.reshape",
"oneflow.slice",
"oneflow.nn.bias_add",
"oneflow.math.tanh"
] | [((657, 682), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (672, 682), False, 'import os\n'), ((695, 717), 'os.path.split', 'os.path.split', (['curPath'], {}), '(curPath)\n', (708, 717), False, 'import os\n'), ((1411, 2003), 'bert.BertBackbone', 'bert_util.BertBackbone', ([], {'input_ids_bl... |
import oneflow as flow
from oneflow.utils.data import Dataset
import pickle
import json
import numpy as np
from oneflow.utils.data import DataLoader
class CollateFn(object):
def __init__(self, frame_size):
self.frame_size = frame_size
def make_frames(self, tensor):
out = tensor.view(
... | [
"oneflow.utils.data.DataLoader"
] | [((818, 931), 'oneflow.utils.data.DataLoader', 'DataLoader', (['dataset'], {'batch_size': 'batch_size', 'shuffle': 'shuffle', 'num_workers': 'num_workers', 'collate_fn': '_collate_fn'}), '(dataset, batch_size=batch_size, shuffle=shuffle, num_workers=\n num_workers, collate_fn=_collate_fn)\n', (828, 931), 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.python.oneflow_export.oneflow_export",
"oneflow.python.framework.id_util.UniqueStr"
] | [((866, 887), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""pad"""'], {}), "('pad')\n", (880, 887), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((2104, 2130), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""pad_grad"""'], {}), "('pad_grad')\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.env.all_device_placement",
"oneflow.unittest.skip_unless_1n2d"
] | [((2712, 2744), 'oneflow.unittest.skip_unless_1n2d', 'flow.unittest.skip_unless_1n2d', ([], {}), '()\n', (2742, 2744), True, 'import oneflow as flow\n'), ((3110, 3125), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3123, 3125), False, 'import unittest\n'), ((1202, 1238), 'oneflow.env.all_device_placement', 'flow... |
import os
import numpy as np
import argparse
from datetime import datetime
import cv2
import random
import oneflow as flow
import oneflow.typing as tp
import vgg16_model
import style_model
CONSOLE_ARGUMENTS = None
def float_list(x):
return list(map(float, x.split(',')))
def load_image(image_path):
im = cv2.... | [
"oneflow.typing.Numpy.Placeholder",
"oneflow.scope.consistent_view",
"oneflow.optimizer.PiecewiseConstantScheduler",
"oneflow.FunctionConfig",
"oneflow.scope.placement",
"oneflow.train.CheckPoint"
] | [((316, 338), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (326, 338), False, 'import cv2\n'), ((348, 441), 'cv2.resize', 'cv2.resize', (['im', '(CONSOLE_ARGUMENTS.train_image_size, CONSOLE_ARGUMENTS.train_image_size)'], {}), '(im, (CONSOLE_ARGUMENTS.train_image_size, CONSOLE_ARGUMENTS.\n trai... |
"""
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.unittest.skip_unless_1n1d",
"oneflow.nn.Conv2d",
"oneflow.device"
] | [((800, 1436), 'numpy.array', 'np.array', (['[[[[0.8586049675941467, -0.2279418259859085, 0.2013147622346878], [\n 0.35005471110343933, 0.5360521078109741, 1.5194443464279175], [\n 1.9040879011154175, -1.5734431743621826, -0.14007866382598877]]], [[[\n 0.29670074582099915, 1.3111951351165771, 0.503590404987335... |
# coding: utf-8
import os
import numpy as np
import pickle as pkl
from tqdm import tqdm
import time
from datetime import timedelta
import csv
import sys
import codecs
import logging_setup
import struct
from parse_args import parse_args
import oneflow.core.record.record_pb2 as of_record
MAX_VOCAB_SIZE = 10000 # 词表长度限制... | [
"oneflow.core.record.record_pb2.Int32List"
] | [((407, 443), 'logging_setup.setup_logger', 'logging_setup.setup_logger', (['__name__'], {}), '(__name__)\n', (433, 443), False, 'import logging_setup\n'), ((463, 507), 'logging_setup.setup_multiprocessing_logger', 'logging_setup.setup_multiprocessing_logger', ([], {}), '()\n', (505, 507), False, 'import logging_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 l... | [
"oneflow.experimental.exp",
"oneflow.experimental.unittest.env.eager_execution_enabled"
] | [((1383, 1398), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1396, 1398), False, 'import unittest\n'), ((969, 984), 'oneflow.experimental.exp', 'flow.exp', (['input'], {}), '(input)\n', (977, 984), True, 'import oneflow.experimental as flow\n'), ((712, 755), 'oneflow.experimental.unittest.env.eager_execution_en... |
"""
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.losses.add_loss",
"oneflow.python.framework.c_api_util.CurJobBuildAndInferCtx_SetTrainConf",
"oneflow.core.operator.op_conf_pb2.WarmupConf",
"oneflow.core.operator.op_conf_pb2.LearningRateDecayConf",
"oneflow.core.operator.op_conf_pb2.ClipConf",
"oneflow.core.job.job_conf_pb2.TrainConf",
"onefl... | [((1303, 1359), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""optimizer.grad_clipping.by_global_norm"""'], {}), "('optimizer.grad_clipping.by_global_norm')\n", (1317, 1359), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((3306, 3349), 'oneflow.python.oneflow_export.onef... |
import oneflow as flow
import oneflow.nn as nn
import oneflow.nn.functional as F
from typing import Tuple, Optional
from .padding import pad_same, get_padding_value
def conv2d_same(
x,
weight: flow.Tensor,
bias: Optional[flow.Tensor] = None,
stride: Tuple[int, int] = (1, 1),
padding: Tuple[int, ... | [
"oneflow.nn.functional.conv2d",
"oneflow.nn.Conv2d"
] | [((467, 526), 'oneflow.nn.functional.conv2d', 'F.conv2d', (['x', 'weight', 'bias', 'stride', '(0, 0)', 'dilation', 'groups'], {}), '(x, weight, bias, stride, (0, 0), dilation, groups)\n', (475, 526), True, 'import oneflow.nn.functional as F\n'), ((1532, 1598), 'oneflow.nn.Conv2d', 'nn.Conv2d', (['in_chs', 'out_chs', 'k... |
"""
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, 6388), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.einsum', '"""\n einsum(equation, *operands) -> oneflow.Tensor\n\n Sums the product of the elements of the input :attr:`operands` along dimensions specified using a notation\n based on the Einstein summation convention.\n\n ... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow._oneflow_internal.MutableCfgAttrMap",
"oneflow._oneflow_internal.JobBuildAndInferCtx_Open",
"oneflow.experimental.Tensor",
"oneflow.experimental.unittest.skip_unless_1n1d",
"oneflow._oneflow_internal.oneflow.core.operator.op_conf.FeedInputOpConf",
"oneflow._oneflow_internal.oneflow.core.operator.... | [((921, 953), 'oneflow.experimental.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (951, 953), True, 'import oneflow.experimental as flow\n'), ((3506, 3521), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3519, 3521), False, 'import unittest\n'), ((1241, 1266), 'oneflow.experiment... |
import oneflow
import oneflow.F as F
import oneflow.experimental as flow
from oneflow.experimental import nn
import random
# 开启oneflow的eager动态图模式
flow.enable_eager_execution()
import numpy as np
class Affine(nn.Module):
def __init__(self, dim):
super().__init__()
self.gamma = nn.Parameter(flow.ones... | [
"oneflow.experimental.nn.Conv2d",
"oneflow.experimental.nn.GELU",
"oneflow.experimental.nn.Parameter",
"oneflow.experimental.ones",
"oneflow.experimental.nn.Conv1d",
"oneflow.experimental.nn.Linear",
"oneflow.experimental.enable_eager_execution",
"oneflow.experimental.zeros"
] | [((146, 175), 'oneflow.experimental.enable_eager_execution', 'flow.enable_eager_execution', ([], {}), '()\n', (173, 175), True, 'import oneflow.experimental as flow\n'), ((886, 905), 'oneflow.experimental.nn.Parameter', 'nn.Parameter', (['scale'], {}), '(scale)\n', (898, 905), False, 'from oneflow.experimental import n... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.framework.docstr.utils.add_docstr"
] | [((660, 1958), '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.math.reduce_variance",
"oneflow.math.reduce_mean",
"oneflow.zeros_like",
"oneflow.user_op_builder",
"oneflow.constant_scalar",
"oneflow.python.framework.id_util.UniqueStr",
"oneflow.math.exp",
"oneflow.math.square",
"oneflow.python.oneflow_export.oneflow_export"
] | [((2000, 2033), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""math.reduce_sum"""'], {}), "('math.reduce_sum')\n", (2014, 2033), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((3759, 3792), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""math.redu... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.variance_scaling_initializer",
"oneflow.regularizers.l2",
"oneflow.nn.conv2d",
"oneflow.layers.batch_normalization",
"oneflow.scope.namespace",
"oneflow.layers.batch_normalization_relu",
"oneflow.ones_initializer",
"oneflow.get_variable",
"oneflow.zeros_initializer",
"oneflow.reshape",
... | [((988, 1086), '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", (1021, 1086), True, 'import oneflow as flow\n'), ((1862, 2059), 'onef... |
"""
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.env.machine",
"oneflow.compatible.single_client.global_function",
"oneflow.compatible.single_client.nn.sparse_softmax_cross_entropy_with_logits",
"oneflow.compatible.single_client.train.CheckPoint",
"oneflow.compatible.si... | [((822, 884), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""flags for cnn benchmark"""'}), "(description='flags for cnn benchmark')\n", (845, 884), False, 'import argparse\n'), ((3741, 3762), 'oneflow.compatible.single_client.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (37... |
import os
import oneflow as flow
from config import config
def train_dataset_reader(
data_dir, batch_size, data_part_num, part_name_suffix_length=1
):
if os.path.exists(data_dir):
print("Loading train data from {}".format(data_dir))
else:
raise Exception("Invalid train dataset dir", data_d... | [
"oneflow.image.Resize",
"oneflow.transpose",
"oneflow.data.decode_random",
"oneflow.data.ImagePreprocessor",
"oneflow.data.RawCodec",
"oneflow.data.ofrecord_reader",
"oneflow.data.decode_ofrecord",
"oneflow.data.NormByChannelPreprocessor",
"oneflow.image.CropMirrorNormalize",
"oneflow.zeros_initia... | [((164, 188), 'os.path.exists', 'os.path.exists', (['data_dir'], {}), '(data_dir)\n', (178, 188), False, 'import os\n'), ((962, 1240), 'oneflow.data.decode_ofrecord', 'flow.data.decode_ofrecord', (['data_dir', '(label_blob_conf, image_blob_conf)'], {'batch_size': 'batch_size', 'data_part_num': 'data_part_num', 'part_na... |
from collections import OrderedDict
from oneflow import nn, Tensor
from oneflow.nn import functional as F
from typing import Dict
from .. import mobilenet_v3
from .seg_utils import _SimpleSegmentationModel, IntermediateLayerGetter
from flowvision.models.utils import load_state_dict_from_url
from flowvision.models.reg... | [
"oneflow.nn.ReLU",
"oneflow.nn.AdaptiveAvgPool2d",
"oneflow.nn.BatchNorm2d",
"oneflow.nn.functional.interpolate",
"oneflow.nn.Conv2d",
"oneflow.nn.Sigmoid"
] | [((1746, 1825), 'oneflow.nn.functional.interpolate', 'F.interpolate', (['out'], {'size': 'input.shape[-2:]', 'mode': '"""bilinear"""', 'align_corners': '(False)'}), "(out, size=input.shape[-2:], mode='bilinear', align_corners=False)\n", (1759, 1825), True, 'from oneflow.nn import functional as F\n'), ((1866, 1879), 'co... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.user_op_builder",
"oneflow.python.oneflow_export.oneflow_export",
"oneflow.python.framework.id_util.UniqueStr"
] | [((926, 960), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""random.bernoulli"""'], {}), "('random.bernoulli')\n", (940, 960), False, 'from oneflow.python.oneflow_export import oneflow_export\n'), ((1186, 1217), 'oneflow.python.framework.id_util.UniqueStr', 'id_util.UniqueStr', (['"""Bernoulli_... |
"""
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.nn.bias_add",
"oneflow.compatible.single_client.function_config",
"oneflow.compatible.single_client.FixedTensorDef",
"oneflow.compatible.single_client.clear_default_session",
"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'), ((884, 912), 'oneflow.compatible.single_client.global_function', 'flow.global_function', (['config'], {}), '(config)\n', (904, 912), 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.python.framework.distribute_context.IsConsistentStrategyEnabled",
"oneflow.python.framework.distribute_context.IsMirroredStrategyEnabled",
"oneflow.python.oneflow_export.oneflow_deprecate",
"oneflow.python.oneflow_export.oneflow_export",
"oneflow.python.framework.distribute_context.DistributeStrate... | [((1280, 1326), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""distribute.mirrored_strategy"""'], {}), "('distribute.mirrored_strategy')\n", (1294, 1326), False, 'from oneflow.python.oneflow_export import oneflow_export, oneflow_deprecate\n'), ((1328, 1347), 'oneflow.python.oneflow_export.onefl... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.nn.Linear",
"oneflow.nn.init.constant_",
"oneflow.nn.ReLU",
"oneflow.unittest.skip_unless_1n1d",
"oneflow.tensor",
"oneflow.device"
] | [((762, 794), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (792, 794), True, 'import oneflow as flow\n'), ((702, 736), 'os.getenv', 'os.getenv', (['"""ONEFLOW_TEST_CPU_ONLY"""'], {}), "('ONEFLOW_TEST_CPU_ONLY')\n", (711, 736), False, 'import os\n'), ((3299, 3314), 'unittest.m... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.python.framework.local_blob.MakeLocalBlob4EagerBlob",
"oneflow.python.framework.local_blob.MergeLocalBlobs"
] | [((1353, 1374), 'threading.Condition', 'threading.Condition', ([], {}), '()\n', (1372, 1374), False, 'import threading\n'), ((7036, 7105), 'oneflow.python.framework.local_blob.MergeLocalBlobs', 'local_blob_util.MergeLocalBlobs', (['local_blob_list', 'self.mirrored_blob_'], {}), '(local_blob_list, self.mirrored_blob_)\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.Tensor",
"oneflow.nn.init.normal_",
"oneflow.unittest.skip_unless_1n4d",
"oneflow.sbp.split",
"oneflow.ones",
"oneflow.unittest.skip_unless_1n1d",
"oneflow.empty",
"oneflow.placement",
"oneflow.no_grad"
] | [((890, 922), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (920, 922), True, 'import oneflow as flow\n'), ((1623, 1655), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1653, 1655), True, 'import oneflow as flow\n'), ((2133, 2165), '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.cuda.current_device",
"oneflow.cuda.manual_seed_all",
"oneflow.set_rng_state",
"oneflow.ByteTensor",
"oneflow.unittest.skip_unless_1n2d",
"oneflow.cuda.manual_seed",
"oneflow.zeros",
"oneflow.randn",
"oneflow.manual_seed",
"oneflow.comm.all_gather",
"oneflow.get_rng_state"
] | [((764, 796), 'oneflow.unittest.skip_unless_1n2d', 'flow.unittest.skip_unless_1n2d', ([], {}), '()\n', (794, 796), True, 'import oneflow as flow\n'), ((704, 738), 'os.getenv', 'os.getenv', (['"""ONEFLOW_TEST_CPU_ONLY"""'], {}), "('ONEFLOW_TEST_CPU_ONLY')\n", (713, 738), False, 'import os\n'), ((1969, 1984), '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.unittest.skip_unless_1n1d"
] | [((732, 764), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (762, 764), True, 'import oneflow as flow\n'), ((2863, 2878), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2876, 2878), 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.math.reduce_all",
"oneflow.typing.Numpy.Placeholder",
"oneflow.scope.consistent_view",
"oneflow.clear_default_session",
"oneflow.math.reduce_sum",
"oneflow.config.gpu_device_num",
"oneflow.math.reduce_min",
"oneflow.math.reduce_std",
"oneflow.math.reduce_prod",
"oneflow.optimizer.Piecewis... | [((949, 977), 'oneflow.clear_default_session', 'flow.clear_default_session', ([], {}), '()\n', (975, 977), True, 'import oneflow as flow\n'), ((996, 1017), 'oneflow.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (1015, 1017), True, 'import oneflow as flow\n'), ((1069, 1118), '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.unittest.skip_unless_1n1d",
"oneflow.tensor"
] | [((2041, 2073), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (2071, 2073), True, 'import oneflow as flow\n'), ((2526, 2558), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (2556, 2558), True, 'import oneflow as flow\n'), ((3020, 3052)... |
"""
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, 2025), 'oneflow.framework.docstr.utils.add_docstr', 'add_docstr', (['oneflow.index_select', '"""\n input.index_select(dim, index) -> Tensor\n\n The interface is consistent with PyTorch. \n The documentation is referenced from: https://pytorch-cn.readthedocs.io/zh/latest/package_references/torch/#tor... |
"""
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.eye",
"oneflow.unittest.skip_unless_1n1d"
] | [((726, 758), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (756, 758), True, 'import oneflow as flow\n'), ((1160, 1175), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1173, 1175), False, 'import unittest\n'), ((853, 874), 'random.randint', 'random.randint', (['(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.global_function",
"oneflow.typing.Numpy.Placeholder",
"oneflow.scope.placement",
"oneflow.function_config",
"oneflow.unittest.skip_unless_1n1d",
"oneflow.config.enable_legacy_model_io",
"oneflow.layers.upsample_2d"
] | [((1311, 1351), 'oneflow.config.enable_legacy_model_io', 'flow.config.enable_legacy_model_io', (['(True)'], {}), '(True)\n', (1345, 1351), True, 'import oneflow as flow\n'), ((2361, 2393), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (2391, 2393), True, 'import oneflow as flo... |
"""
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.tensor.register_tensor_op",
"oneflow.builtin_op",
"oneflow.python.oneflow_export.oneflow_export"
] | [((1935, 1960), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""reshape"""'], {}), "('reshape')\n", (1949, 1960), False, 'from oneflow.python.oneflow_export import oneflow_export, experimental_api\n'), ((1962, 1991), 'oneflow.python.framework.tensor.register_tensor_op', 'register_tensor_op', (['... |
import numpy as np
import os
import random
from collections import deque
import oneflow as flow
import oneflow.typing as tp
from threading import Thread, Lock
import threading
# Hyper Parameters:
FRAME_PER_ACTION = 1
GAMMA = 0.99 # decay rate of past observations
OBSERVE = 100. # timesteps to observe before training
... | [
"oneflow.variance_scaling_initializer",
"oneflow.matmul",
"oneflow.typing.Numpy.Placeholder",
"oneflow.scope.consistent_view",
"oneflow.constant_initializer",
"oneflow.math.reduce_sum",
"oneflow.nn.compat_conv2d",
"oneflow.math.square",
"oneflow.assign",
"oneflow.optimizer.PiecewiseConstantSchedul... | [((1030, 1053), 'numpy.swapaxes', 'np.swapaxes', (['data', '(0)', '(2)'], {}), '(data, 0, 2)\n', (1041, 1053), True, 'import numpy as np\n'), ((1065, 1088), 'numpy.swapaxes', 'np.swapaxes', (['data', '(1)', '(2)'], {}), '(data, 1, 2)\n', (1076, 1088), True, 'import numpy as np\n'), ((1100, 1128), 'numpy.expand_dims', '... |
"""
Logic:
1. AudioDataLoader generate a minibatch from AudioDataset, the size of this
minibatch is AudioDataLoader's batchsize. For now, we always set
AudioDataLoader's batchsize as 1. The real minibatch size we care about is
set in AudioDataset's __init__(...). So actually, we generate the
information of... | [
"oneflow.utils.data.items",
"oneflow.tensor"
] | [((4378, 4412), 'numpy.array', 'np.array', (['[x.shape[0] for x in xs]'], {}), '([x.shape[0] for x in xs])\n', (4386, 4412), True, 'import numpy as np\n'), ((4548, 4566), 'oneflow.tensor', 'flow.tensor', (['ilens'], {}), '(ilens)\n', (4559, 4566), True, 'import oneflow as flow\n'), ((6587, 6608), 'numpy.vstack', 'np.vs... |
"""
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.init.normal_",
"oneflow.framework.tensor.Tensor",
"oneflow.nn.Parameter",
"oneflow._C.gather",
"oneflow.no_grad"
] | [((6209, 6246), 'oneflow._C.gather', 'flow._C.gather', (['weight', 'input'], {'axis': '(0)'}), '(weight, input, axis=0)\n', (6223, 6246), True, 'import oneflow as flow\n'), ((6315, 6351), 'doctest.testmod', 'doctest.testmod', ([], {'raise_on_error': '(True)'}), '(raise_on_error=True)\n', (6330, 6351), False, 'import do... |
"""
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.optimizer.PolynomialSchduler",
"oneflow.optimizer.AdamW",
"oneflow.optimizer.warmup.linear",
"oneflow.optimizer.CosineScheduler",
"oneflow.optimizer.loss_scale.dynamic_loss_scale",
"oneflow.optimizer.grad_clipping.by_global_norm",
"oneflow.optimizer.RMSProp",
"oneflow.optimizer.Adam",
"onef... | [((2109, 2156), 'math.ceil', 'math.ceil', (['(args.num_examples / train_batch_size)'], {}), '(args.num_examples / train_batch_size)\n', (2118, 2156), False, 'import math\n'), ((5656, 5676), 'config.get_parser', 'configs.get_parser', ([], {}), '()\n', (5674, 5676), True, 'import config as configs\n'), ((5712, 5736), 'co... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow._oneflow_internal.SetIsMultiClient",
"oneflow._oneflow_internal.deprecated.RegisterBoxingUtilOnlyOnce",
"oneflow._oneflow_internal.RegisterPyKernels",
"oneflow._oneflow_internal.MasterSendAbort",
"oneflow.compatible.single_client.python.framework.register_class_method_util.RegisterMethod4Class",
... | [((2091, 2129), 'oneflow._oneflow_internal.DestroyEnv', 'oneflow._oneflow_internal.DestroyEnv', ([], {}), '()\n', (2127, 2129), False, 'import oneflow\n'), ((2189, 2202), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (2199, 2202), False, 'import time\n'), ((2213, 2262), 'oneflow._oneflow_internal.SetIsMultiClient... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.framework.tensor.register_tensor_op",
"oneflow.F.sinh"
] | [((1691, 1717), 'oneflow.framework.tensor.register_tensor_op', 'register_tensor_op', (['"""sinh"""'], {}), "('sinh')\n", (1709, 1717), False, 'from oneflow.framework.tensor import register_tensor_op\n'), ((1884, 1920), 'doctest.testmod', 'doctest.testmod', ([], {'raise_on_error': '(True)'}), '(raise_on_error=True)\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.argwhere",
"oneflow._C.gather_nd",
"oneflow._C.mul"
] | [((1915, 1939), 'oneflow._C.mul', 'flow._C.mul', (['input', 'mask'], {}), '(input, mask)\n', (1926, 1939), True, 'import oneflow as flow\n'), ((1955, 1973), 'oneflow.argwhere', 'flow.argwhere', (['res'], {}), '(res)\n', (1968, 1973), True, 'import oneflow as flow\n'), ((1991, 2022), 'oneflow._C.gather_nd', 'flow._C.gat... |
"""
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.register.logical_blob_id_pb2.LogicalBlobId",
"oneflow.data.ofrecord_image_decoder",
"oneflow.eager_execution_enabled",
"oneflow.random.coin_flip",
"oneflow.python.framework.remote_blob.RemoteBlob",
"oneflow.data.ofrecord_raw_decoder",
"oneflow.data.ofrecord_reader",
"oneflow.python.onefl... | [((1221, 1261), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""data.ImagePreprocessor"""'], {}), "('data.ImagePreprocessor')\n", (1235, 1261), False, 'from oneflow.python.oneflow_export import oneflow_export, oneflow_deprecate\n'), ((1767, 1813), 'oneflow.python.oneflow_export.oneflow_export', ... |
"""
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_GetStaticShape",
"oneflow.core.job.placement_pb2.ParallelConf",
"oneflow.python.framework.c_api_util.JobBuildAndInferCtx_MirroredBlobIsTensorList",
"oneflow.python.framework.c_api_util.JobBuildAndInferCtx_MirroredBlobGetStaticShape",
"oneflow.python.f... | [((1614, 1657), 'oneflow.python.eager.blob_register.GetDefaultBlobRegister', 'blob_register_util.GetDefaultBlobRegister', ([], {}), '()\n', (1655, 1657), True, 'import oneflow.python.eager.blob_register as blob_register_util\n'), ((1779, 1848), 'oneflow.python.lib.core.enable_if.condition', 'enable_if.condition', (['(h... |
import oneflow as flow
import oneflow.nn as nn
class GLU(nn.Module):
def __init__(self):
super(GLU, self).__init__()
def forward(self, input):
return input * flow.sigmoid(input)
class PixelShuffle(nn.Module):
def __init__(self, upscale_factor):
super(PixelShuffle, self).__init__... | [
"oneflow.nn.InstanceNorm2d",
"oneflow.nn.InstanceNorm1d",
"oneflow.nn.Conv1d",
"oneflow.sigmoid",
"oneflow.nn.PixelShuffle",
"oneflow.nn.Conv2d"
] | [((3158, 3257), 'oneflow.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': '(1)', 'out_channels': '(128)', 'kernel_size': '(5, 15)', 'stride': '(1, 1)', 'padding': '(2, 7)'}), '(in_channels=1, out_channels=128, kernel_size=(5, 15), stride=(1, \n 1), padding=(2, 7))\n', (3167, 3257), True, 'import oneflow.nn as nn\n'), (... |
import oneflow as flow
from quantization_ops.q_module import QModule, QParam
__all__ = ["QConvBN"]
class QConvBN(QModule):
def __init__(self, conv_module, bn_module, qi=True, qo=True, quantization_bit=8, quantization_scheme='symmetric', quantization_formula='google', per_layer_quantization=True):
super(Q... | [
"oneflow.Tensor",
"oneflow.F.conv2d",
"oneflow.sqrt",
"oneflow.nn.Quantization"
] | [((875, 1056), 'quantization_ops.q_module.QParam', 'QParam', ([], {'quantization_bit': 'quantization_bit', 'quantization_scheme': 'quantization_scheme', 'quantization_formula': 'quantization_formula', 'per_layer_quantization': 'per_layer_quantization'}), '(quantization_bit=quantization_bit, quantization_scheme=\n qu... |
"""
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.global_function",
"oneflow.FunctionConfig",
"oneflow.experimental.dynamic_binary_split",
"oneflow.identity",
"oneflow.scope.placement",
"oneflow.experimental.dynamic_binary_concat",
"oneflow.config.gpu_device_num",
"oneflow.unittest.num_nodes_required",
"onef... | [((664, 699), 'oneflow.unittest.num_nodes_required', 'flow.unittest.num_nodes_required', (['(2)'], {}), '(2)\n', (696, 699), True, 'import oneflow as flow\n'), ((784, 805), 'oneflow.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (803, 805), True, 'import oneflow as flow\n'), ((997, 1023), 'oneflow.config.mac... |
"""
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.clear_default_session",
"oneflow.unittest.skip_unless_1n1d",
"oneflow.scope.mirrored_view",
"oneflow.cast_to_current_logical_view",
"oneflow.optimizer.PiecewiseConstantScheduler",
"oneflow.FunctionConfig",
"oneflow.zeros_initializer",
"oneflow.global_func... | [((4568, 4600), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (4598, 4600), True, 'import oneflow as flow\n'), ((1118, 1139), 'numpy.zeros', 'np.zeros', (['input_shape'], {}), '(input_shape)\n', (1126, 1139), True, 'import numpy as np\n'), ((2183, 2211), 'oneflow.clear_default... |
import sys
import math
import numpy as np
import oneflow as flow
import oneflow.nn as nn
import oneflow.nn.functional as F
from utils.data_utils import flip, sinc, act_fun
class SincConv_fast(nn.Module):
"""Sinc-based convolution
Parameters
----------
in_channels : `int`
Number of input chan... | [
"oneflow.cat",
"oneflow.matmul",
"oneflow.flip",
"oneflow.sin",
"oneflow.nn.functional.conv1d",
"oneflow.nn.BatchNorm1d",
"oneflow.nn.Linear",
"oneflow.cos",
"oneflow.abs",
"oneflow.zeros",
"oneflow.ones",
"oneflow.nn.Dropout",
"oneflow.Tensor",
"oneflow.nn.ModuleList"
] | [((3835, 3860), 'oneflow.matmul', 'flow.matmul', (['low', 'self.n_'], {}), '(low, self.n_)\n', (3846, 3860), True, 'import oneflow as flow\n'), ((3886, 3912), 'oneflow.matmul', 'flow.matmul', (['high', 'self.n_'], {}), '(high, self.n_)\n', (3897, 3912), True, 'import oneflow as flow\n'), ((4124, 4159), 'oneflow.flip', ... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.unittest.skip_unless_1n1d"
] | [((819, 851), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (849, 851), True, 'import oneflow as flow\n'), ((4029, 4044), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4042, 4044), 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.experimental.device",
"oneflow.experimental.nn.ReplicationPad2d",
"oneflow.experimental.unittest.env.eager_execution_enabled"
] | [((1180, 1208), 'numpy.ones', 'np.ones', (['src.shape', 'np.int32'], {}), '(src.shape, np.int32)\n', (1187, 1208), True, 'import numpy as np\n'), ((1226, 1256), 'numpy.zeros', 'np.zeros', (['dest.shape', 'np.int32'], {}), '(dest.shape, np.int32)\n', (1234, 1256), True, 'import numpy as np\n'), ((1273, 1296), 'test_util... |
import oneflow as flow
from oneflow import nn
import libai
def cosine_similarity(x, y, dim=-1):
return flow.sum(x * y, dim=dim) / (flow.linalg.norm(x, dim=dim) * flow.linalg.norm(y, dim=dim))
class MLPLayer(nn.Module):
def __init__(self, cfg):
super().__init__()
self.dense = libai.layers.Li... | [
"oneflow.sum",
"oneflow.linalg.norm"
] | [((110, 134), 'oneflow.sum', 'flow.sum', (['(x * y)'], {'dim': 'dim'}), '(x * y, dim=dim)\n', (118, 134), True, 'import oneflow as flow\n'), ((305, 404), 'libai.layers.Linear', 'libai.layers.Linear', (['cfg.hidden_size', 'cfg.hidden_size'], {'bias': '(True)', 'parallel': '"""row"""', 'layer_idx': '(-1)'}), "(cfg.hidden... |
import oneflow as flow
import numpy as np
def conv2d_layer(
name,
input,
out_channel,
kernel_size = 3,
strides = 1,
padding = "SAME", # or [[], [], [], []]
data_format = "NCHW",
dilation_rate = 1,
use_bias = True,
weight_initializer = flow.random_normal_initializer(mean = 0.0, s... | [
"oneflow.nn.dropout",
"oneflow.nn.avg_pool2d",
"oneflow.math.tanh",
"oneflow.nn.leaky_relu",
"oneflow.reflection_pad2d",
"oneflow.layers.upsample_2d",
"oneflow.nn.conv2d",
"oneflow.nn.BCELoss",
"oneflow.nn.MSELoss",
"oneflow.scope.namespace",
"oneflow.zeros_initializer",
"oneflow.nn.InstanceNo... | [((276, 329), 'oneflow.random_normal_initializer', 'flow.random_normal_initializer', ([], {'mean': '(0.0)', 'stddev': '(0.02)'}), '(mean=0.0, stddev=0.02)\n', (306, 329), True, 'import oneflow as flow\n'), ((358, 382), 'oneflow.zeros_initializer', 'flow.zeros_initializer', ([], {}), '()\n', (380, 382), True, 'import 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._C.stack",
"oneflow.tensor"
] | [((937, 957), 're.compile', 're.compile', (['"""[SaUO]"""'], {}), "('[SaUO]')\n", (947, 957), False, 'import re\n'), ((2714, 2741), 'oneflow._C.stack', 'flow._C.stack', (['batch'], {'dim': '(0)'}), '(batch, dim=0)\n', (2727, 2741), True, 'import oneflow as flow\n'), ((1539, 1556), 'oneflow.tensor', 'flow.tensor', (['da... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.global_function",
"oneflow.typing.Numpy.Placeholder",
"oneflow.FunctionConfig",
"oneflow.scope.placement",
"oneflow.clear_default_session",
"oneflow.user_op_builder",
"oneflow.unittest.skip_unless_1n1d"
] | [((743, 764), 'oneflow.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (762, 764), True, 'import oneflow as flow\n'), ((1720, 1752), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1750, 1752), True, 'import oneflow as flow\n'), ((1289, 1317), 'oneflow.clear_default_s... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.amax",
"oneflow.unittest.skip_unless_1n1d",
"oneflow.test_utils.test_util.GenArgList",
"oneflow.device"
] | [((2936, 2968), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (2966, 2968), True, 'import oneflow as flow\n'), ((859, 901), 'oneflow.amax', 'flow.amax', (['input'], {'dim': 'dim', 'keepdim': 'keepdim'}), '(input, dim=dim, keepdim=keepdim)\n', (868, 901), 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.Tensor",
"oneflow.unittest.skip_unless_1n1d",
"oneflow.nn.functional.embedding",
"oneflow.device"
] | [((4656, 4688), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (4686, 4688), True, 'import oneflow as flow\n'), ((804, 1234), 'numpy.array', 'np.array', (['[[0.68258786, 0.6957856, 1.1829041], [1.0154, -1.0616943, 0.50303376], [\n 0.29679507, 0.65562993, 1.0424724], [-0.4298... |
import oneflow as flow
import oneflow.nn as nn
import oneflow.nn.functional as F
from flowvision.layers.blocks import ConvBnAct
from flowvision.layers.helpers import make_divisible
class LinearBnAct(nn.Sequential):
def __init__(
self,
in_features: int,
out_features: int,
act_layer... | [
"oneflow.nn.Sequential",
"oneflow.nn.Conv2d",
"oneflow.nn.Linear"
] | [((1214, 1229), 'oneflow.nn.Sequential', 'nn.Sequential', ([], {}), '()\n', (1227, 1229), True, 'import oneflow.nn as nn\n'), ((2509, 2524), 'oneflow.nn.Sequential', 'nn.Sequential', ([], {}), '()\n', (2522, 2524), True, 'import oneflow.nn as nn\n'), ((1094, 1158), 'flowvision.layers.helpers.make_divisible', 'make_divi... |
"""
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.scope.placement",
"oneflow.compatible.single_client.watch_diff",
"oneflow.compatible.single_client.unittest.skip_unless_1n2d",
"oneflow.compatible.single_client.FunctionConfig",
"oneflow.compatible.single_client.config... | [((3274, 3306), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (3304, 3306), True, 'from oneflow.compatible import single_client as flow\n'), ((3989, 4021), 'oneflow.compatible.single_client.unittest.skip_unless_1n2d', 'flow.unittest.skip_unless_1n2d', ... |
"""
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.math.divide",
"oneflow.FixedTensorDef",
"oneflow.function_config",
"oneflow.clear_default_session",
"oneflow.math.add",
"oneflow.math.multiply"
] | [((659, 681), 'oneflow.function_config', 'flow.function_config', ([], {}), '()\n', (679, 681), True, 'import oneflow as flow\n'), ((4690, 4705), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4703, 4705), False, 'import unittest\n'), ((1190, 1218), 'oneflow.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.framework.session_context.GetDefaultSession",
"oneflow.nn.graph_optimizer.OptimizerConfig",
"oneflow.nn.graph_block.Block",
"oneflow.nn.graph.Graph._child_init_cnt.get",
"oneflow.framework.graph_build_util.graph_build_context",
"oneflow.framework.c_api_util.GetCurrentJob",
"oneflow.nn.graph_opt... | [((1679, 1692), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1690, 1692), False, 'from collections import OrderedDict\n'), ((1725, 1738), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1736, 1738), False, 'from collections import OrderedDict\n'), ((1770, 1783), 'collections.OrderedDict', '... |
"""
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.Tensor",
"oneflow.experimental.nn.Graph._child_init_cnt.clear",
"oneflow._oneflow_internal.JobBuildAndInferCtx_GetCurrentJobName",
"oneflow.current_scope",
"oneflow.experimental.nn.ReLU",
"oneflow.experimental.nn.Conv2d",
"oneflow... | [((1417, 1449), 'oneflow.experimental.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (1447, 1449), True, 'import oneflow.experimental as flow\n'), ((10868, 10883), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10881, 10883), False, 'import unittest\n'), ((864, 887), 'oneflow.expe... |
import oneflow as flow
flow.enable_eager_execution()
x = flow.tensor([0])
y = flow.tensor([1])
z = x + y
print(z)
| [
"oneflow.enable_eager_execution",
"oneflow.tensor"
] | [((24, 53), 'oneflow.enable_eager_execution', 'flow.enable_eager_execution', ([], {}), '()\n', (51, 53), True, 'import oneflow as flow\n'), ((59, 75), 'oneflow.tensor', 'flow.tensor', (['[0]'], {}), '([0])\n', (70, 75), True, 'import oneflow as flow\n'), ((80, 96), 'oneflow.tensor', 'flow.tensor', (['[1]'], {}), '([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._C.argwhere",
"oneflow._C.transpose",
"oneflow.slice"
] | [((885, 926), 'oneflow._C.argwhere', 'flow._C.argwhere', (['input'], {'dtype': 'flow.int64'}), '(input, dtype=flow.int64)\n', (901, 926), True, 'import oneflow as flow\n'), ((986, 1032), 'oneflow.slice', 'flow.slice', (['res'], {'slice_tup_list': 'slice_tup_list'}), '(res, slice_tup_list=slice_tup_list)\n', (996, 1032)... |
"""
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.device",
"oneflow.experimental.unittest.env.eager_execution_enabled"
] | [((798, 816), 'numpy.zeros', 'np.zeros', (['outshape'], {}), '(outshape)\n', (806, 816), True, 'import numpy as np\n'), ((1268, 1294), 'numpy.array', 'np.array', (['[[1, 2], [3, 4]]'], {}), '([[1, 2], [3, 4]])\n', (1276, 1294), True, 'import numpy as np\n'), ((1307, 1333), 'numpy.array', 'np.array', (['[[0, 0], [1, 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.python.oneflow_export.oneflow_export",
"oneflow.python.framework.tensor.register_tensor_op",
"oneflow.builtin_op"
] | [((798, 826), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""nn.Flatten"""'], {}), "('nn.Flatten')\n", (812, 826), False, 'from oneflow.python.oneflow_export import oneflow_export, experimental_api\n'), ((1711, 1736), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""flatt... |
import os
import time
import argparse
import numpy as np
import glob
import imageio
import matplotlib
matplotlib.use("agg")
import matplotlib.pyplot as plt
import oneflow as flow
from utils import (
make_dirs,
load_mnist,
download_mnist,
to_numpy,
to_tensor,
save_to_gif,
save_images,
)
fro... | [
"oneflow.cat",
"oneflow.load",
"oneflow.nn.BCELoss",
"oneflow.no_grad"
] | [((103, 124), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (117, 124), False, 'import matplotlib\n'), ((486, 538), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""oneflow DCGAN"""'}), "(description='oneflow DCGAN')\n", (509, 538), False, 'import argparse\n'), ((23... |
"""
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... | [((4417, 4449), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (4447, 4449), True, 'from oneflow.compatible import single_client as flow\n'), ((1173, 1212), 'numpy.broadcast_to', 'np.broadcast_to', (['mask', 'brocadcast_shape'], {}), '(mask, brocadcast_... |
"""
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.hardtanh",
"oneflow.current_global_function_desc",
"oneflow.math.negative",
"oneflow.ones_initializer",
"oneflow.math.log",
"oneflow.zeros_like",
"oneflow.nn.moments",
"oneflow.math.abs",
"oneflow.math.minimum",
"oneflow.expand_dims",
"oneflow.transpose",
"oneflow.nn.conv2d",
"on... | [((7847, 7874), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""nn.conv1d"""'], {}), "('nn.conv1d')\n", (7861, 7874), False, 'from oneflow.python.oneflow_export import oneflow_export, stable_api\n'), ((14878, 14905), 'oneflow.python.oneflow_export.oneflow_export', 'oneflow_export', (['"""nn.conv... |
from typing import Dict, List
import jsonlines
import random
import oneflow as flow
from oneflow.utils.data import Dataset
def load_data(name: str, path: str) -> List:
def load_snli_data_unsup(path):
with jsonlines.open(path, 'r') as f:
return [line.get('origin') for line in f]
def load_... | [
"oneflow.tensor"
] | [((220, 245), 'jsonlines.open', 'jsonlines.open', (['path', '"""r"""'], {}), "(path, 'r')\n", (234, 245), False, 'import jsonlines\n'), ((362, 387), 'jsonlines.open', 'jsonlines.open', (['path', '"""r"""'], {}), "(path, 'r')\n", (376, 387), False, 'import jsonlines\n'), ((1530, 1555), 'random.shuffle', 'random.shuffle'... |
"""
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.nn.softmax",
"oneflow.compatible.single_client.FunctionConfig",
"oneflow.compatible.single_client.optimizer.PiecewiseConstantScheduler",
"oneflow.compatible.single_client.profiler.nvtx_end",
"oneflow.compatible.single_client.global_function",
"oneflow.compatible.single_cl... | [((762, 783), 'oneflow.compatible.single_client.FunctionConfig', 'flow.FunctionConfig', ([], {}), '()\n', (781, 783), True, 'from oneflow.compatible import single_client as flow\n'), ((829, 861), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (859, 861)... |
import oneflow as flow
from oneflow import nn
def get_loss(name):
if name == "cosface":
return CosFace()
elif name == "arcface":
return ArcFace()
else:
raise ValueError()
class CrossEntropyLoss_sbp(nn.Module):
def __init__(self):
super(CrossEntropyLoss_sbp, self).__in... | [
"oneflow._C.sparse_softmax_cross_entropy",
"oneflow.where",
"oneflow.scatter",
"oneflow.mean"
] | [((381, 432), 'oneflow._C.sparse_softmax_cross_entropy', 'flow._C.sparse_softmax_cross_entropy', (['logits', 'label'], {}), '(logits, label)\n', (417, 432), True, 'import oneflow as flow\n'), ((461, 476), 'oneflow.mean', 'flow.mean', (['loss'], {}), '(loss)\n', (470, 476), True, 'import oneflow as flow\n'), ((1017, 106... |
import oneflow as flow
from .recurrent import rnn
def _FullyConnected(input_blob, weight_blob, bias_blob):
output_blob = flow.matmul(input_blob, weight_blob)
if bias_blob:
output_blob = flow.nn.bias_add(output_blob, bias_blob)
return output_blob
class LSTMCell:
def __init__(self, units... | [
"oneflow.glorot_uniform_initializer",
"oneflow.scope.namespace",
"oneflow.matmul",
"oneflow.ones_initializer",
"oneflow.nn.dropout",
"oneflow.glorot_normal_initializer",
"oneflow.zeros_initializer",
"oneflow.reverse",
"oneflow.get_variable",
"oneflow.nn.bias_add"
] | [((128, 164), 'oneflow.matmul', 'flow.matmul', (['input_blob', 'weight_blob'], {}), '(input_blob, weight_blob)\n', (139, 164), True, 'import oneflow as flow\n'), ((9226, 9259), 'oneflow.glorot_uniform_initializer', 'flow.glorot_uniform_initializer', ([], {}), '()\n', (9257, 9259), True, 'import oneflow as flow\n'), ((9... |
"""
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.gather",
"oneflow.constant_initializer",
"oneflow.clear_default_session",
"oneflow.unittest.skip_unless_1n1d",
"oneflow.typing.ListNumpy.Placeholder",
"oneflow.scope.mirrored_view",
"oneflow.watch_diff",
"oneflow.optimiz... | [((826, 877), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (870, 877), True, 'import tensorflow as tf\n'), ((4097, 4129), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (4127, 4129), Tr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.