repo
stringlengths
1
99
file
stringlengths
13
215
code
stringlengths
12
59.2M
file_length
int64
12
59.2M
avg_line_length
float64
3.82
1.48M
max_line_length
int64
12
2.51M
extension_type
stringclasses
1 value
pytorch
pytorch-main/caffe2/python/modeling/compute_statistics_for_blobs.py
from caffe2.python import core, schema from caffe2.python.modeling.net_modifier import NetModifier import numpy as np class ComputeStatisticsForBlobs(NetModifier): """ This class modifies the net passed in by adding ops to compute statistics for certain blobs. For each blob in the list, its min, max...
1,909
33.727273
134
py
pytorch
pytorch-main/caffe2/python/modeling/compute_histogram_for_blobs.py
from caffe2.python import core, schema from caffe2.python.modeling.net_modifier import NetModifier import numpy as np class ComputeHistogramForBlobs(NetModifier): """ This class modifies the net passed in by adding ops to compute histogram for certain blobs. Args: blobs: list of blobs t...
3,508
36.731183
134
py
pytorch
pytorch-main/caffe2/python/modeling/compute_statistics_for_blobs_test.py
import unittest from caffe2.python import workspace, brew, model_helper from caffe2.python.modeling.compute_statistics_for_blobs import ( ComputeStatisticsForBlobs ) import numpy as np class ComputeStatisticsForBlobsTest(unittest.TestCase): def test_compute_statistics_for_blobs(self): model = mo...
2,870
32.776471
76
py
pytorch
pytorch-main/caffe2/python/modeling/get_entry_from_blobs.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
3,130
36.27381
134
py
pytorch
pytorch-main/caffe2/python/modeling/gradient_clipping_test.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
10,016
35.827206
79
py
pytorch
pytorch-main/caffe2/python/modeling/compute_norm_for_blobs_test.py
import unittest from caffe2.python import workspace, brew, model_helper from caffe2.python.modeling.compute_norm_for_blobs import ComputeNormForBlobs import numpy as np class ComputeNormForBlobsTest(unittest.TestCase): def test_compute_norm_for_blobs(self): model = model_helper.ModelHelper(name="tes...
7,942
33.237069
90
py
pytorch
pytorch-main/caffe2/python/modeling/parameter_sharing.py
from caffe2.python import scope import contextlib import logging logger = logging.getLogger(__name__) class ParameterSharingContext: """ This class manages scope driven way of parameter sharing across different NameScopes. """ def __init__(self): self._scope_overrides = {} ...
3,840
31.277311
79
py
pytorch
pytorch-main/caffe2/python/modeling/compute_histogram_for_blobs_test.py
import unittest from caffe2.python import workspace, brew, model_helper from caffe2.python.modeling.compute_histogram_for_blobs import ( ComputeHistogramForBlobs ) import numpy as np class ComputeHistogramForBlobsTest(unittest.TestCase): def histogram(self, X, lower_bound=0.0, upper_bound=1.0, num_buck...
4,947
40.233333
86
py
pytorch
pytorch-main/caffe2/python/modeling/gradient_clipping.py
from caffe2.python import core from caffe2.proto import caffe2_pb2 from caffe2.python.optimizer import get_param_device from caffe2.python.modeling.net_modifier import NetModifier import logging logger = logging.getLogger(__name__) class GradientClipping(NetModifier): L1_NORM = 'l1_norm' L2_NORM = 'l2...
5,766
36.448052
86
py
pytorch
pytorch-main/caffe2/python/modeling/get_entry_from_blobs_test.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
3,538
35.864583
78
py
pytorch
pytorch-main/caffe2/python/modeling/compute_norm_for_blobs.py
from caffe2.python import core, schema, muji from caffe2.python.modeling.net_modifier import NetModifier import numpy as np class ComputeNormForBlobs(NetModifier): """ This class modifies the net passed in by adding ops to compute norms for certain blobs. Args: blobs: list of blobs to ...
3,642
36.556701
134
py
pytorch
pytorch-main/caffe2/proto/gen_proto_typestubs_helper.py
import ast with open("../python/__init__.py", "r") as f: tree = ast.parse(f.read()) print("\nDeviceType = int\n") print("# These are freedom-patched into caffe2_pb2 in caffe2/proto/__init__.py") for stmt in tree.body: if not isinstance(stmt, ast.Assign): continue target = stmt.targets[0] if no...
523
31.75
80
py
pytorch
pytorch-main/caffe2/proto/__init__.py
import warnings # NOTE: we have to import python protobuf here **before** we load cpp extension. # Otherwise it breaks under certain build conditions if cpp implementation of # protobuf is used. Presumably there's some registry in protobuf library and # python side has to initialize the dictionary first, before stati...
1,016
39.68
101
py
pytorch
pytorch-main/caffe2/distributed/redis_store_handler_op_test.py
import os import uuid from caffe2.distributed.python import StoreHandlerTimeoutError from caffe2.distributed.store_ops_test_util import StoreOpsTests from caffe2.python import core, workspace, dyndep from caffe2.python.test_util import TestCase dyndep.InitOpsLibrary("@/caffe2/caffe2/distributed:redis_store_handl...
1,197
28.219512
76
py
pytorch
pytorch-main/caffe2/distributed/file_store_handler_op_test.py
import errno import os import tempfile import shutil from caffe2.distributed.python import StoreHandlerTimeoutError from caffe2.distributed.store_ops_test_util import StoreOpsTests from caffe2.python import core, workspace, dyndep from caffe2.python.test_util import TestCase dyndep.InitOpsLibrary("@/caffe2/caffe...
1,690
25.84127
75
py
pytorch
pytorch-main/caffe2/distributed/store_ops_test_util.py
## @package store_ops_test_util # Module caffe2.distributed.store_ops_test_util from multiprocessing import Process, Queue import numpy as np from caffe2.python import core, workspace class StoreOpsTests: @classmethod def _test_set_get(cls, queue, create_store_handler_fn, index, num_procs): sto...
2,205
27.649351
78
py
pytorch
pytorch-main/caffe2/experiments/python/sparse_reshape_op_test.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
3,412
31.504762
78
py
pytorch
pytorch-main/caffe2/experiments/python/funhash_op_test.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
2,740
33.2625
78
py
pytorch
pytorch-main/caffe2/experiments/python/sparse_funhash_op_test.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
2,502
32.824324
78
py
pytorch
pytorch-main/caffe2/experiments/python/convnet_benchmarks.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
20,369
28.1
83
py
pytorch
pytorch-main/caffe2/experiments/python/tt_contraction_op_test.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
2,099
31.8125
78
py
pytorch
pytorch-main/caffe2/experiments/python/net_construct_bench.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
4,124
25.960784
78
py
pytorch
pytorch-main/caffe2/experiments/python/tt_pad_op_test.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
1,944
30.885246
78
py
pytorch
pytorch-main/caffe2/experiments/python/SparseTransformer.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
6,888
32.280193
79
py
pytorch
pytorch-main/caffe2/experiments/python/device_reduce_sum_bench.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
3,903
29.263566
79
py
pytorch
pytorch-main/caffe2/contrib/playground/checkpoint.py
import numpy as np import pickle from collections import OrderedDict from caffe2.proto import caffe2_pb2 from caffe2.python import workspace, core, scope import logging logging.basicConfig() log = logging.getLogger("AnyExpOnTerm") log.setLevel(logging.DEBUG) def initialize_params_from_file( model, wei...
6,881
38.325714
87
py
pytorch
pytorch-main/caffe2/contrib/playground/compute_loss.py
import caffe2.contrib.playground.meter as Meter from caffe2.python import workspace class ComputeLoss(Meter.Meter): def __init__(self, opts=None, blob_name=''): self.blob_name = blob_name self.opts = opts self.iter = 0 self.value = 0 def Reset(self): self.iter = 0...
965
25.833333
80
py
pytorch
pytorch-main/caffe2/contrib/playground/AnyExpOnTerm.py
import argparse import json import os import caffe2.contrib.playground.AnyExp as AnyExp import caffe2.contrib.playground.checkpoint as checkpoint import logging logging.basicConfig() log = logging.getLogger("AnyExpOnTerm") log.setLevel(logging.DEBUG) def runShardedTrainLoop(opts, myTrainFun): start_epoch =...
3,346
32.808081
80
py
pytorch
pytorch-main/caffe2/contrib/playground/output_generator.py
from caffe2.python import timeout_guard def fun_conclude_operator(self): # Ensure the program exists. This is to "fix" some unknown problems # causing the job sometimes get stuck. timeout_guard.EuthanizeIfNecessary(600.0) def assembleAllOutputs(self): output = {} output['train_model'] = self...
478
21.809524
71
py
pytorch
pytorch-main/caffe2/contrib/playground/compute_topk_accuracy.py
import caffe2.contrib.playground.meter as Meter from caffe2.python import workspace import numpy as np class ComputeTopKAccuracy(Meter.Meter): # Python default arguments are evaluated once when the function is # defined, not each time the function is called # This means that if you use a mutable defa...
2,189
35.5
77
py
pytorch
pytorch-main/caffe2/contrib/playground/AnyExp.py
from abc import abstractmethod from caffe2.python import workspace from caffe2.python import timeout_guard from caffe2.python import data_parallel_model from . import checkpoint as checkpoint from . import ModuleRegister as ModuleRegister from . import module_map as module_map # instantiate logger outside of di...
17,960
35.506098
85
py
pytorch
pytorch-main/caffe2/contrib/playground/module_map.py
# Input import caffe2.contrib.playground.resnetdemo.\ gfs_IN1k as gfs_IN1k # noqa # model import caffe2.contrib.playground.resnetdemo.\ IN1k_resnet as IN1k_resnet # noqa import caffe2.contrib.playground.resnetdemo.\ IN1k_resnet_no_test_model as IN1k_resnet_no_test_model # noqa # Additional override...
1,427
27.56
87
py
pytorch
pytorch-main/caffe2/contrib/playground/resnetdemo/IN1k_resnet_no_test_model.py
import numpy as np from caffe2.python import workspace, cnn, core from caffe2.python import timeout_guard from caffe2.proto import caffe2_pb2 def init_model(self): # if cudnn needs to be turned off, several other places # need to be modified: # 1. operators need to be constructed with engine option,...
1,880
28.857143
81
py
pytorch
pytorch-main/caffe2/contrib/playground/resnetdemo/gfs_IN1k.py
# # example1 using gfs as input source. def gen_input_builder_fun(self, model, dataset, is_train): if is_train: input_path = self.opts['input']['train_input_path'] else: input_path = self.opts['input']['test_input_path'] reader = model.CreateDB("reader", db...
1,406
24.581818
79
py
pytorch
pytorch-main/caffe2/contrib/playground/resnetdemo/IN1k_resnet.py
import numpy as np from caffe2.python import workspace, cnn, core from caffe2.python import timeout_guard from caffe2.proto import caffe2_pb2 def init_model(self): train_model = cnn.CNNModelHelper( order="NCHW", name="resnet", use_cudnn=True, cudnn_exhaustive_search=False ...
1,498
24.844828
75
py
pytorch
pytorch-main/caffe2/contrib/playground/resnetdemo/rendezvous_filestore.py
from caffe2.python import core, workspace from caffe2.python import dyndep dyndep.InitOpsLibrary('@/caffe2/caffe2/distributed:file_store_handler_ops') # rendezvous should NOT be unique for each operator. It should have # the same run_id on different operators. say we have two shards, # both shards created rend...
1,416
32.738095
77
py
pytorch
pytorch-main/caffe2/contrib/playground/resnetdemo/caffe2_resnet50_default_forward.py
import caffe2.python.models.resnet as resnet def gen_forward_pass_builder_fun(self, model, dataset, is_train): def create_resnet50_model_ops(model, loss_scale): [softmax, loss] = resnet.create_resnet50( model, "data", num_input_channels=3, num_labels=10...
653
23.222222
69
py
pytorch
pytorch-main/caffe2/contrib/playground/resnetdemo/explicit_resnet_param_update.py
from caffe2.python import workspace, core from caffe2.proto import caffe2_pb2 def gen_param_update_builder_fun(self, model, dataset, is_train): if not is_train: return None else: # from sherlok for idx in range(self.opts['distributed']['first_xpu_id'], sel...
2,268
33.378788
77
py
pytorch
pytorch-main/caffe2/contrib/warpctc/ctc_ops_test.py
import numpy as np from caffe2.proto import caffe2_pb2 from caffe2.python import core, workspace, dyndep, test_util dyndep.InitOpsLibrary('@/caffe2/caffe2/contrib/warpctc:ctc_ops') workspace.GlobalInit(["python"]) def softmax(w): maxes = np.amax(w, axis=-1, keepdims=True) e = np.exp(w - maxes) dist ...
3,915
34.926606
80
py
pytorch
pytorch-main/caffe2/contrib/nccl/nccl_ops_test.py
import unittest import hypothesis.strategies as st from hypothesis import given, assume import numpy as np import time import os from caffe2.proto import caffe2_pb2 from caffe2.python import core, workspace, muji, dyndep import caffe2.python.hypothesis_test_util as hu np.random.seed(1) dyndep.InitOpsLibrary('@/c...
8,138
41.170984
79
py
pytorch
pytorch-main/caffe2/contrib/nnpack/nnpack_ops_test.py
import unittest import hypothesis.strategies as st from hypothesis import given, assume, settings import numpy as np import time import os from caffe2.python import core, dyndep import caffe2.python.hypothesis_test_util as hu dyndep.InitOpsLibrary("@/caffe2/caffe2/contrib/nnpack:nnpack_ops") np.random.seed(1) ...
8,174
33.348739
80
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_layernorm_nnpi_fp16.py
import numpy as np import caffe2.python.fakelowp.init_shared_libs # noqa from caffe2.proto import caffe2_pb2 from caffe2.python import core from caffe2.python import workspace from caffe2.python.onnx.onnxifi import onnxifi_caffe2_net from caffe2.python.fakelowp.test_utils import print_test_debug_info from hypothesis i...
8,760
35.352697
90
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_int8_quant.py
# Must happen before importing caffe2.python.* import caffe2.python.fakelowp.init_shared_libs # noqa import datetime import numpy as np from caffe2.proto import caffe2_pb2 from caffe2.python import core, workspace from caffe2.python.onnx.onnxifi import onnxifi_caffe2_net import caffe2.python.serialized_test.serialized...
3,439
34.102041
77
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_chunking.py
# Must happen before importing caffe2.python.* import caffe2.python.fakelowp.init_shared_libs # noqa import datetime import numpy as np from hypothesis import given, settings, example from hypothesis import strategies as st from caffe2.python import core, workspace from caffe2.python.onnx.onnxifi import onnxifi_caffe2...
4,612
31.258741
75
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_batchmatmul_nnpi_fp16.py
import numpy as np import unittest import caffe2.python.fakelowp.init_shared_libs # noqa from caffe2.proto import caffe2_pb2 from caffe2.python import core, workspace from caffe2.python.onnx.onnxifi import onnxifi_caffe2_net from caffe2.python.fakelowp.test_utils import print_test_debug_info import datetime from hypo...
3,795
34.476636
87
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_int8_ops_nnpi.py
import caffe2.python.fakelowp.init_shared_libs # noqa import numpy as np from caffe2.python import core, workspace from caffe2.python.onnx.onnxifi import onnxifi_caffe2_net from hypothesis import given, strategies as st, settings from caffe2.python.fakelowp.test_utils import print_test_debug_info import caffe2.python....
10,478
31.442724
88
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_sls_8bit_nnpi_fp16.py
import unittest from typing import Dict, Any # Must happen before importing caffe2.python.* import caffe2.python.fakelowp.init_shared_libs # noqa import datetime import numpy as np from hypothesis import given, settings from hypothesis import strategies as st from caffe2.proto import caffe2_pb2 from caffe2.python imp...
18,862
32.268078
98
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_fusions.py
# Must happen before importing caffe2.python.* import caffe2.python.fakelowp.init_shared_libs # noqa import datetime import numpy as np from hypothesis import given, settings from hypothesis import strategies as st from caffe2.proto import caffe2_pb2 from caffe2.python import core, workspace from caffe2.python.onnx.on...
3,141
30.42
87
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_sls_8bit_nnpi_fp32.py
import unittest # Must happen before importing caffe2.python.* import caffe2.python.fakelowp.init_shared_libs # noqa import datetime import numpy as np from hypothesis import given, settings from hypothesis import strategies as st from caffe2.proto import caffe2_pb2 from caffe2.python import core, workspace from caff...
8,679
31.754717
87
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_op_nnpi_fp16.py
import numpy as np import caffe2.python.fakelowp.init_shared_libs # noqa import datetime from hypothesis import given, settings from hypothesis import strategies as st from caffe2.proto import caffe2_pb2 from caffe2.python import core from caffe2.python import workspace from caffe2.python.onnx.onnxifi import onnxifi_...
14,573
38.495935
87
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_deq_swish_quant_nnpi.py
import numpy as np import caffe2.python.fakelowp.init_shared_libs # noqa from caffe2.python import core, workspace from caffe2.python.onnx.onnxifi import onnxifi_caffe2_net from caffe2.python.fakelowp.test_utils import print_test_debug_info import caffe2.python.serialized_test.serialized_test_util as serial import dat...
5,269
31.9375
79
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_fc_nnpi_fp16.py
import numpy as np import unittest import caffe2.python.fakelowp.init_shared_libs # noqa from hypothesis import given, settings from hypothesis import strategies as st from caffe2.proto import caffe2_pb2 from caffe2.python import core from caffe2.python import workspace from caffe2.python.onnx.onnxifi import onnxifi_...
13,195
35.860335
84
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_batchnorm_nnpi_fp16.py
import numpy as np import unittest import caffe2.python.fakelowp.init_shared_libs # noqa from hypothesis import given, settings from hypothesis import strategies as st from caffe2.proto import caffe2_pb2 from caffe2.python import core from caffe2.python import workspace from caffe2.python.onnx.onnxifi import onnxifi_...
5,058
34.131944
86
py
pytorch
pytorch-main/caffe2/contrib/fakelowp/test/test_sls_4bit_nnpi_fp16.py
import numpy as np import unittest # Must happen before importing caffe2.python.* import caffe2.python.fakelowp.init_shared_libs # noqa from hypothesis import given, settings from hypothesis import strategies as st from caffe2.proto import caffe2_pb2 from caffe2.python import core, workspace from caffe2.python.onnx....
7,812
35.171296
98
py
pytorch
pytorch-main/caffe2/contrib/tensorboard/tensorboard_exporter.py
import copy import logging import os from caffe2.proto import caffe2_pb2 from caffe2.python import core, workspace try: # tensorboard>=1.14.0 from tensorboard.compat.proto import tensor_shape_pb2 from tensorboard.compat.proto.node_def_pb2 import NodeDef from tensorboard.compat.proto.graph_pb2 imp...
9,786
27.450581
79
py
pytorch
pytorch-main/caffe2/contrib/tensorboard/tensorboard_test.py
import click.testing import numpy as np import os import tempfile import unittest from caffe2.python import brew, core, model_helper import caffe2.contrib.tensorboard.tensorboard as tb import caffe2.contrib.tensorboard.tensorboard_exporter as tb_exporter try: # tensorboard>=1.14.0 from tensorboard.compat...
4,156
33.932773
76
py
pytorch
pytorch-main/caffe2/contrib/tensorboard/tensorboard.py
import click import collections import logging import numpy as np import os from caffe2.proto import caffe2_pb2 from caffe2.python import core import caffe2.contrib.tensorboard.tensorboard_exporter as tb_exporter try: # tensorboard>=1.14.0 from tensorboard.compat.proto.summary_pb2 import Summary, Histogr...
6,403
29.065728
90
py
pytorch
pytorch-main/caffe2/contrib/tensorboard/tensorboard_exporter_test.py
import unittest from caffe2.proto import caffe2_pb2 import caffe2.python.cnn as cnn import caffe2.python.core as core import caffe2.contrib.tensorboard.tensorboard_exporter as tb EXPECTED = """ node { name: "conv1/XavierFill" op: "XavierFill" device: "/gpu:0" attr { key: "_output_shapes" value { ...
13,851
18.620397
76
py
pytorch
pytorch-main/caffe2/contrib/gloo/gloo_test.py
#!/usr/bin/env python3 from hypothesis import given, settings import hypothesis.strategies as st from multiprocessing import Process, Queue import numpy as np import os import pickle import tempfile import shutil from caffe2.python import core, workspace, dyndep import caffe2.python.hypothesis_test_util as hu f...
25,321
34.816124
87
py
pytorch
pytorch-main/caffe2/contrib/aten/gen_op.py
#!/bin/env python3 # Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
12,507
36.78852
126
py
pytorch
pytorch-main/caffe2/contrib/aten/aten_test.py
from caffe2.python import core from hypothesis import given import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np class TestATen(hu.HypothesisTestCase): @given(inputs=hu.tensors(n=2), **hu.gcs) def test_add(self, inputs, gc, dc): op = core.CreateOperat...
3,740
27.340909
132
py
pytorch
pytorch-main/caffe2/contrib/aten/docs/sample.py
import tempfile import numpy as np from torch import nn from torch.autograd import Variable, Function import torch.onnx import onnx import caffe2.python.onnx.backend class MyFunction(Function): @staticmethod def forward(ctx, x, y): return x * x + y @staticmethod def symbolic(graph, x, y): ...
1,784
30.315789
102
py
pytorch
pytorch-main/caffe2/contrib/prof/cuda_profile_ops_test.py
import unittest from caffe2.proto import caffe2_pb2 from caffe2.python import core, dyndep, workspace dyndep.InitOpsLibrary("@/caffe2/caffe2/contrib/prof:cuda_profile_ops") class CudaProfileOpsTest(unittest.TestCase): @unittest.skipIf(workspace.NumCudaDevices() < 1, "Need at least 1 GPU") def test_run(s...
704
27.2
75
py
pytorch
pytorch-main/caffe2/quantization/server/gather_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_results_close from hypothesis import given dyndep.InitOpsLibrary("//ca...
2,790
33.036585
93
py
pytorch
pytorch-main/caffe2/quantization/server/relu_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_results_close from hypothesis import given dyndep.InitOpsLibrary("//ca...
2,418
33.070423
87
py
pytorch
pytorch-main/caffe2/quantization/server/fully_connected_rowwise_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server import utils as dnnlowp_utils from caffe2.quantization.server.dnnlowp_test_utils import ( avoid_vpmaddubsw_ove...
5,434
33.18239
88
py
pytorch
pytorch-main/caffe2/quantization/server/lstm_unit_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from hypothesis import given, settings dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops") workspace.GlobalInit(["caffe2", ...
3,975
36.509434
85
py
pytorch
pytorch-main/caffe2/quantization/server/int8_quant_scheme_blob_fill_test.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
1,838
38.12766
106
py
pytorch
pytorch-main/caffe2/quantization/server/resize_nearest_3d_dnnlowp_op_test.py
import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from hypothesis import given, settings dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops") workspace.GlobalInit(["caffe2", "--caffe2_omp_num_th...
2,289
34.78125
84
py
pytorch
pytorch-main/caffe2/quantization/server/dnnlowp_test_utils.py
import collections import numpy as np from caffe2.python import utils, workspace from caffe2.quantization.server import dnnlowp_pybind11 from hypothesis import assume # This function asserts quantized results (output[1:]) are close enough to # floating point results (output[0]). # The error bound is derived based ...
15,030
32.254425
88
py
pytorch
pytorch-main/caffe2/quantization/server/conv_groupwise_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st from caffe2.python import core, dyndep, workspace from caffe2.python.fb import hardcode_scale_zp # type: ignore[import] from caffe2.quantization.server import utils as dnnlowp_utils from caffe2.quantization.server....
9,537
32.00346
86
py
pytorch
pytorch-main/caffe2/quantization/server/group_norm_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, utils, workspace from caffe2.quantization.server import utils as dnnlowp_utils from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_res...
4,566
33.862595
100
py
pytorch
pytorch-main/caffe2/quantization/server/tanh_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from hypothesis import given, settings dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops") workspace.GlobalInit(["caffe2", ...
2,187
31.656716
85
py
pytorch
pytorch-main/caffe2/quantization/server/fully_connected_fp16_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from hypothesis import given dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops") workspace.GlobalInit(["caffe2", "--caffe2_...
2,519
33.520548
101
py
pytorch
pytorch-main/caffe2/quantization/server/quantize_dnnlowp_op_test.py
import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server import dnnlowp_pybind11 from hypothesis import given, settings dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_op...
2,668
36.069444
78
py
pytorch
pytorch-main/caffe2/quantization/server/observer_test.py
import numpy as np from caffe2.python import core, workspace from caffe2.quantization.server import dnnlowp_pybind11 # type: ignore[attr-defined] net = core.Net("test_net") X = np.array([[1, 2], [3, 4]]).astype(np.float32) W = np.array([[5, 6], [7, 8]]).astype(np.float32) b = np.array([0, 1]).astype(np.float32) ...
1,011
22
85
py
pytorch
pytorch-main/caffe2/quantization/server/channel_shuffle_dnnlowp_op_test.py
import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, utils, workspace from hypothesis import given, settings dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops") workspace.GlobalInit(["caffe2", "--caffe2_omp...
3,890
31.157025
88
py
pytorch
pytorch-main/caffe2/quantization/server/resize_nearest_dnnlowp_op_test.py
import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from hypothesis import given, settings dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops") workspace.GlobalInit(["caffe2", "--caffe2_omp_num_th...
2,116
33.145161
90
py
pytorch
pytorch-main/caffe2/quantization/server/spatial_batch_norm_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, utils, workspace from caffe2.quantization.server import utils as dnnlowp_utils from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_res...
4,094
32.292683
87
py
pytorch
pytorch-main/caffe2/quantization/server/utils.py
import copy import logging from collections import defaultdict import numpy as np from caffe2.python import core, utils from caffe2.python.fb import hardcode_scale_zp # type: ignore[import] logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) def pairwise(iterable): "s -> (s0,s1), (s1,s2), (s...
16,059
32.810526
113
py
pytorch
pytorch-main/caffe2/quantization/server/sigmoid_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from hypothesis import given dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops") workspace.GlobalInit(["caffe2", "--caffe2_...
2,203
30.485714
84
py
pytorch
pytorch-main/caffe2/quantization/server/concat_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_results_close from hypothesis import given dyndep.InitOpsLibrary("//ca...
3,265
32.326531
87
py
pytorch
pytorch-main/caffe2/quantization/server/elementwise_linear_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_results_close from hypothesis import given dyndep.InitOpsLibrary("//ca...
3,101
32
87
py
pytorch
pytorch-main/caffe2/quantization/server/fully_connected_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server import utils as dnnlowp_utils from caffe2.quantization.server.dnnlowp_test_utils import ( avoid_vpmaddubsw_ove...
10,748
35.938144
104
py
pytorch
pytorch-main/caffe2/quantization/server/conv_dnnlowp_acc16_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, utils, workspace from caffe2.quantization.server import utils as dnnlowp_utils from caffe2.quantization.server.dnnlowp_test_utils import ( check_quantiz...
14,202
35.048223
96
py
pytorch
pytorch-main/caffe2/quantization/server/compute_equalization_scale_test.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
3,154
37.47561
78
py
pytorch
pytorch-main/caffe2/quantization/server/batch_permutation_dnnlowp_op_test.py
import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from hypothesis import given, settings dyndep.InitOpsLibrary("//caffe2/caffe2/quantization/server:dnnlowp_ops") workspace.GlobalInit(["caffe2", "--caffe2_omp_num_th...
1,449
34.365854
84
py
pytorch
pytorch-main/caffe2/quantization/server/pool_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_results_close from hypothesis import assume, given dyndep.InitOpsLibra...
6,125
29.326733
87
py
pytorch
pytorch-main/caffe2/quantization/server/elementwise_sum_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_results_close from hypothesis import given dyndep.InitOpsLibrary("//ca...
9,682
32.975439
87
py
pytorch
pytorch-main/caffe2/quantization/server/fully_connected_dnnlowp_acc16_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server import utils as dnnlowp_utils from caffe2.quantization.server.dnnlowp_test_utils import ( check_quantized_resu...
8,324
34.425532
84
py
pytorch
pytorch-main/caffe2/quantization/server/conv_groupwise_dnnlowp_acc16_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, utils, workspace from caffe2.quantization.server import utils as dnnlowp_utils from caffe2.quantization.server.dnnlowp_test_utils import ( check_quantiz...
11,664
33.717262
88
py
pytorch
pytorch-main/caffe2/quantization/server/int8_gen_quant_params_min_max_test.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
3,491
40.571429
147
py
pytorch
pytorch-main/caffe2/quantization/server/elementwise_mul_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_results_close from hypothesis import given, settings dyndep.InitOpsLib...
6,315
32.417989
87
py
pytorch
pytorch-main/caffe2/quantization/server/elementwise_add_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_results_close from hypothesis import given dyndep.InitOpsLibrary("//ca...
6,662
33.169231
88
py
pytorch
pytorch-main/caffe2/quantization/server/dequantize_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_results_close from hypothesis import given dyndep.InitOpsLibrary("//ca...
1,743
31.296296
87
py
pytorch
pytorch-main/caffe2/quantization/server/batch_matmul_dnnlowp_op_test.py
import collections from itertools import product import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, dyndep, workspace from caffe2.quantization.server import utils as dnnlowp_utils from caffe2.quantization.server.dnnlowp_test_utils imp...
10,152
38.815686
100
py
pytorch
pytorch-main/caffe2/quantization/server/conv_depthwise_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st from caffe2.python import core, dyndep, workspace from caffe2.quantization.server import utils as dnnlowp_utils from caffe2.quantization.server.dnnlowp_test_utils import ( check_quantized_results_close, gene...
10,931
33.485804
86
py
pytorch
pytorch-main/caffe2/quantization/server/int8_gen_quant_params_test.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
3,550
38.021978
87
py
pytorch
pytorch-main/caffe2/quantization/server/conv_dnnlowp_op_test.py
import collections import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st from caffe2.python import core, dyndep, workspace from caffe2.quantization.server import utils as dnnlowp_utils from caffe2.quantization.server.dnnlowp_test_utils import ( check_quantized_results_close, gene...
17,919
32.432836
99
py
pytorch
pytorch-main/.github/scripts/run_torchbench.py
""" Generate a torchbench test report from a file containing the PR body. Currently, only supports running tests on specified model names Testing environment: - Intel Xeon 8259CL @ 2.50 GHz, 24 Cores with disabled Turbo and HT - Nvidia Tesla T4 - Nvidia Driver 470.82.01 - Python 3.8 - CUDA 11.3 """ import argparse # ...
11,195
33.238532
120
py