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/operator_test/pad_test.py
from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np import unittest class TestPad(serial.SerializedTestCase): @serial.given(pad_t=st.integers(-5, 0), ...
1,377
26.56
73
py
pytorch
pytorch-main/caffe2/python/operator_test/reduce_ops_test.py
from caffe2.python import core, workspace from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np import itertools as it class TestReduceOps(serial.SerializedT...
17,341
37.537778
100
py
pytorch
pytorch-main/caffe2/python/operator_test/top_k_test.py
import hypothesis.strategies as st import numpy as np from caffe2.python import core from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial class TestTopK(serial.SerializedTestCase): def top_k_ref(self, X, k...
9,113
35.898785
78
py
pytorch
pytorch-main/caffe2/python/operator_test/layer_norm_op_test.py
from caffe2.python import brew, core, workspace from caffe2.python.model_helper import ModelHelper from functools import partial from hypothesis import given, settings from typing import Optional, Tuple import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as se...
14,782
35.056098
80
py
pytorch
pytorch-main/caffe2/python/operator_test/ensure_clipped_test.py
import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np import numpy.testing as npt from caffe2.python import core, workspace from hypothesis import given class TestEnsureClipped(hu.HypothesisTestCase): @given( X=hu.arrays(dims=[5, 10], elements=hu.floats(mi...
1,505
33.227273
88
py
pytorch
pytorch-main/caffe2/python/operator_test/thresholded_relu_op_test.py
from caffe2.python import core from hypothesis import given, settings import hypothesis.strategies as st import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import numpy as np import unittest class TestThresholdedRelu(serial.SerializedTestCase): ...
2,323
30.405405
68
py
pytorch
pytorch-main/caffe2/python/operator_test/assert_test.py
import numpy as np from hypothesis import given, settings import hypothesis.strategies as st from caffe2.python import core import caffe2.python.hypothesis_test_util as hu class TestAssert(hu.HypothesisTestCase): @given( dtype=st.sampled_from(['bool_', 'int32', 'int64']), shape=st.lists(elemen...
797
25.6
76
py
pytorch
pytorch-main/caffe2/python/operator_test/rowwise_counter_test.py
import unittest import caffe2.python.hypothesis_test_util as hu import numpy as np from caffe2.python import core, workspace def update_counter_ref(prev_iter, update_counter, indices, curr_iter, counter_halflife): prev_iter_out = prev_iter.copy() update_counter_out = update_counter.copy() counter_neg_...
2,205
30.514286
88
py
pytorch
pytorch-main/caffe2/python/operator_test/stats_ops_test.py
from caffe2.python import core, workspace from caffe2.python.test_util import TestCase import numpy as np class TestCounterOps(TestCase): def test_stats_ops(self): # The global StatRegistry isn't reset when the workspace is reset, # so there may be existing stats from a previous test ...
1,789
33.423077
74
py
pytorch
pytorch-main/caffe2/python/operator_test/normalize_op_test.py
import functools import numpy as np from hypothesis import given, settings from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import copy class TestNormalizeOp(hu.HypothesisTestCase): @given( X=hu.tensor( min_dim=1, max_dim=5, elements=hu.floats(min_value=0.5, ...
1,679
29.545455
86
py
pytorch
pytorch-main/caffe2/python/operator_test/prepend_dim_test.py
import numpy as np from caffe2.python import core, workspace from caffe2.python.test_util import TestCase from caffe2.proto import caffe2_pb2 class TestPrependDim(TestCase): def _test_fwd_bwd(self): old_shape = (128, 2, 4) new_shape = (8, 16, 2, 4) X = np.random.rand(*old_shape).astyp...
1,505
27.961538
73
py
pytorch
pytorch-main/caffe2/python/operator_test/mod_op_test.py
import numpy from caffe2.python import core from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np @st.composite def _data(draw): return draw( hu.tensor( dtype=np.int64, elements=st.integers( ...
1,459
22.548387
82
py
pytorch
pytorch-main/caffe2/python/operator_test/group_norm_op_test.py
from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial from hypothesis import given, settings import hypothesis.strategies as st import numpy as np import unittest class TestGroupNormOp(serial.SerializedTestCase): de...
5,252
33.11039
77
py
pytorch
pytorch-main/caffe2/python/operator_test/lengths_reducer_fused_nbit_rowwise_ops_test.py
import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, workspace from hypothesis import given class TestLengthsReducerOpsFusedNBitRowwise(hu.HypothesisTestCase): @given( num_rows=st.integers(1, 20), blocksize=st.sampl...
15,495
37.167488
88
py
pytorch
pytorch-main/caffe2/python/operator_test/ensure_cpu_output_op_test.py
from hypothesis import given import numpy as np import hypothesis.strategies as st from caffe2.python import core, workspace import caffe2.python.hypothesis_test_util as hu @st.composite def _dev_options(draw): op_dev = draw(st.sampled_from(hu.device_options)) if op_dev == hu.cpu_do: # the CPU o...
1,244
22.942308
65
py
pytorch
pytorch-main/caffe2/python/operator_test/expand_op_test.py
from caffe2.python import core from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np class TestExpandOp(serial.SerializedTestCase): def _rand_shape(self,...
2,109
30.969697
67
py
pytorch
pytorch-main/caffe2/python/operator_test/spatial_bn_op_test.py
from caffe2.python import brew, core, utils, workspace import caffe2.python.hip_test_util as hiputl import caffe2.python.hypothesis_test_util as hu from caffe2.python.model_helper import ModelHelper import caffe2.python.serialized_test.serialized_test_util as serial from hypothesis import given, assume, settings ...
20,182
39.446894
79
py
pytorch
pytorch-main/caffe2/python/operator_test/weighted_sum_test.py
from caffe2.python import core from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np class TestWeightedSumOp(serial.SerializedTestCase): @given( ...
3,052
28.931373
77
py
pytorch
pytorch-main/caffe2/python/operator_test/python_op_test.py
from caffe2.python import core, workspace from caffe2.python.core import CreatePythonOperator import caffe2.python.hypothesis_test_util as hu from hypothesis import given, settings import hypothesis.strategies as st import numpy as np import unittest class PythonOpTest(hu.HypothesisTestCase): @given(x=hu.tenso...
1,312
28.840909
74
py
pytorch
pytorch-main/caffe2/python/operator_test/rnn_cell_test.py
from caffe2.python import ( core, gradient_checker, rnn_cell, workspace, scope, utils ) from caffe2.python.attention import AttentionType from caffe2.python.model_helper import ModelHelper, ExtractPredictorNet from caffe2.python.rnn.rnn_cell_test_util import sigmoid, tanh, _prepare_rnn from caffe2.proto import...
59,707
32.60045
84
py
pytorch
pytorch-main/caffe2/python/operator_test/rmac_regions_op_test.py
from caffe2.python import core from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np class RMACRegionsOpTest(hu.HypothesisTestCase): @given( n=st.integers(500, 500), h=st.integers(1, 10), w=st.integ...
3,178
30.79
71
py
pytorch
pytorch-main/caffe2/python/operator_test/rms_norm_op_test.py
from caffe2.python import core from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np import unittest class TestRMSNormOp(hu.HypothesisTestCase): @given( M=st.integers(0, 8), N=st.integers(1, 16), eps...
1,325
26.625
69
py
pytorch
pytorch-main/caffe2/python/operator_test/flatten_op_test.py
from hypothesis import given import numpy as np from caffe2.python import core import caffe2.python.hypothesis_test_util as hu class TestFlatten(hu.HypothesisTestCase): @given(X=hu.tensor(min_dim=2, max_dim=4), **hu.gcs) def test_flatten(self, X, gc, dc): for axis in range(X.ndim + 1)...
922
22.666667
64
py
pytorch
pytorch-main/caffe2/python/operator_test/gather_ranges_op_test.py
import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import numpy as np from caffe2.python import core, workspace from hypothesis import given, settings, strategies as st def batched_boarders_and_data( data_min_size=5, data_max_size=10, exam...
9,125
31.827338
87
py
pytorch
pytorch-main/caffe2/python/operator_test/weight_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...
2,057
38.576923
116
py
pytorch
pytorch-main/caffe2/python/operator_test/conv_transpose_test.py
import numpy as np from hypothesis import assume, given, settings import hypothesis.strategies as st from caffe2.proto import caffe2_pb2 from caffe2.python import core, utils import caffe2.python.hypothesis_test_util as hu import caffe2.python.hip_test_util as hiputl class TestConvolutionTranspose(hu.HypothesisT...
15,945
36.083721
77
py
pytorch
pytorch-main/caffe2/python/operator_test/sparse_lengths_sum_benchmark.py
import argparse import datetime import numpy as np from caffe2.python import core, workspace DTYPES = { "uint8": np.uint8, "uint8_fused": np.uint8, "float": np.float32, "float16": np.float16, } def benchmark_sparse_lengths_sum( dtype_str, categorical_limit, embedding_size, average...
4,159
29.814815
88
py
pytorch
pytorch-main/caffe2/python/operator_test/fc_operator_test.py
from caffe2.proto import caffe2_pb2 from caffe2.python import core from hypothesis import assume, given, settings, HealthCheck import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np import unittest ...
3,720
33.137615
83
py
pytorch
pytorch-main/caffe2/python/operator_test/lpnorm_op_test.py
import numpy as np from caffe2.python import core, workspace import caffe2.python.hypothesis_test_util as hu from hypothesis import given, settings import hypothesis.strategies as st class LpnormTest(hu.HypothesisTestCase): def _test_Lp_Norm(self, inputs, gc, dc): X = inputs[0] # avoid kinks ...
3,148
29.872549
85
py
pytorch
pytorch-main/caffe2/python/operator_test/sinusoid_position_encoding_op_test.py
from caffe2.python import core from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np import math MAX_TEST_EMBEDDING_SIZE = 20 MAX_TEST_SEQUENCE_LENGTH = 10 MAX...
2,308
30.630137
81
py
pytorch
pytorch-main/caffe2/python/operator_test/channel_stats_op_test.py
from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial from hypothesis import given, settings import hypothesis.strategies as st import numpy as np import unittest class TestChannelStatsOp(serial.SerializedTestCase): ...
2,639
29
80
py
pytorch
pytorch-main/caffe2/python/operator_test/margin_ranking_criterion_op_test.py
from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial from hypothesis import given, settings import hypothesis.strategies as st import numpy as np class TestMarginRankingCriterion(serial.SerializedTestCase): @given(...
1,816
32.648148
78
py
pytorch
pytorch-main/caffe2/python/operator_test/negate_gradient_op_test.py
from caffe2.python import workspace, core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial from hypothesis import given, settings import hypothesis.strategies as st import numpy as np class TestNegateGradient(serial.SerializedTestCase): @giv...
1,518
32.755556
88
py
pytorch
pytorch-main/caffe2/python/operator_test/given_tensor_fill_op_test.py
from caffe2.python import core from hypothesis import given import hypothesis.strategies as st import caffe2.python.hypothesis_test_util as hu import numpy as np import unittest class TestGivenTensorFillOps(hu.HypothesisTestCase): @given(X=hu.tensor(min_dim=1, max_dim=4, dtype=np.int32), t=st.sam...
1,503
30.333333
74
py
pytorch
pytorch-main/caffe2/python/operator_test/stats_put_ops_test.py
from caffe2.python import core, workspace from caffe2.python.test_util import TestCase import numpy as np class TestPutOps(TestCase): def test_default_value(self): magnitude_expand = int(1e12) stat_name = "stat".encode('ascii') sum_postfix = "/stat_value/sum".encode("ascii") c...
6,585
32.602041
74
py
pytorch
pytorch-main/caffe2/python/operator_test/loss_ops_test.py
from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np class TestLossOps(serial.SerializedTestCase): @serial.given(n=st.integers(1, 8), **hu.gcs) def test_ave...
902
20.5
67
py
pytorch
pytorch-main/caffe2/python/operator_test/wngrad_test.py
import functools import logging import hypothesis from hypothesis import given, settings, HealthCheck import hypothesis.strategies as st import numpy as np from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial logger =...
8,279
36.808219
82
py
pytorch
pytorch-main/caffe2/python/operator_test/sparse_to_dense_mask_op_test.py
from caffe2.python import core from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np class TestFcOperator(hu.HypothesisTestCase): @given(n=st.integers(1, 10), k=st.integers(1, 5), use_length=st.booleans(), **hu...
3,693
31.690265
77
py
pytorch
pytorch-main/caffe2/python/operator_test/clip_op_test.py
import numpy as np from hypothesis import given, settings import hypothesis.strategies as st from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial class TestClip(serial.SerializedTestCase): @given(X=hu.tensor(min_d...
1,984
27.768116
67
py
pytorch
pytorch-main/caffe2/python/operator_test/ngram_ops_test.py
import hypothesis.strategies as st from caffe2.python import core, workspace from hypothesis import given import caffe2.python.hypothesis_test_util as hu import numpy as np class TestNGramOps(hu.HypothesisTestCase): @given( seed=st.integers(0, 2**32 - 1), N=st.integers(min_value=10, max_val...
2,327
29.631579
70
py
pytorch
pytorch-main/caffe2/python/operator_test/sparse_dropout_with_replacement_op_test.py
from caffe2.python import core from hypothesis import given import caffe2.python.hypothesis_test_util as hu import numpy as np class SparseDropoutWithReplacementTest(hu.HypothesisTestCase): @given(**hu.gcs_cpu_only) def test_no_dropout(self, gc, dc): X = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])....
2,885
40.826087
74
py
pytorch
pytorch-main/caffe2/python/operator_test/learning_rate_adaption_op_test.py
from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial from hypothesis import given, settings import hypothesis.strategies as st import numpy as np class TestLearningRateAdaption(serial.SerializedTestCase): @given(in...
2,837
33.609756
80
py
pytorch
pytorch-main/caffe2/python/operator_test/deform_conv_test.py
import unittest import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.proto import caffe2_pb2 from caffe2.python import core, utils, workspace from hypothesis import assume, given def _cudnn_supports(dilation=False, nhwc=False): """Return True if cuDN...
19,276
30.915563
88
py
pytorch
pytorch-main/caffe2/python/operator_test/transpose_op_test.py
from caffe2.python import core, workspace from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np import unittest class TestTransposeOp(serial.SerializedTestCa...
2,722
31.035294
77
py
pytorch
pytorch-main/caffe2/python/operator_test/index_hash_ops_test.py
from caffe2.python import core, workspace import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st from hypothesis import given, settings import numpy as np class TestIndexHashOps(serial.SerializedTestCase): @given(...
2,885
37.48
79
py
pytorch
pytorch-main/caffe2/python/operator_test/key_split_ops_test.py
import hypothesis.strategies as st from caffe2.python import core, workspace from hypothesis import given import caffe2.python.hypothesis_test_util as hu import numpy as np class TestKeySplitOps(hu.HypothesisTestCase): @given( X=hu.arrays( dims=[1000], dtype=np.int64, ...
1,289
27.043478
78
py
pytorch
pytorch-main/caffe2/python/operator_test/hsm_test.py
from hypothesis import given, settings import numpy as np import unittest from caffe2.proto import caffe2_pb2, hsm_pb2 from caffe2.python import workspace, core, gradient_checker import caffe2.python.hypothesis_test_util as hu import caffe2.python.hsm_util as hsmu # User inputs tree using protobuf file or, in thi...
9,455
36.375494
79
py
pytorch
pytorch-main/caffe2/python/operator_test/sparse_gradient_checker_test.py
import numpy as np from scipy.sparse import coo_matrix from hypothesis import given, settings import hypothesis.strategies as st from caffe2.python import core import caffe2.python.hypothesis_test_util as hu class TestSparseGradient(hu.HypothesisTestCase): @given(M=st.integers(min_value=5, max_value=20), ...
1,294
25.979167
62
py
pytorch
pytorch-main/caffe2/python/operator_test/quantile_test.py
import unittest import caffe2.python.hypothesis_test_util as hu import numpy as np from caffe2.python import core, workspace class TestQuantile(hu.HypothesisTestCase): def _test_quantile(self, inputs, quantile, abs, tol): net = core.Net("test_net") net.Proto().type = "dag" input_tensors...
3,276
36.666667
82
py
pytorch
pytorch-main/caffe2/python/operator_test/lengths_pad_op_test.py
from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np class TestLengthsPadOp(serial.SerializedTestCase): @serial.given( inputs=hu.lengths_tensor( ...
1,625
27.034483
79
py
pytorch
pytorch-main/caffe2/python/operator_test/recurrent_network_test.py
from caffe2.python import recurrent, workspace from caffe2.python.model_helper import ModelHelper from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np class R...
14,048
35.585938
80
py
pytorch
pytorch-main/caffe2/python/operator_test/video_input_op_test.py
import os import shutil import sys import tempfile import unittest import numpy as np from caffe2.proto import caffe2_pb2 from caffe2.python import model_helper, workspace try: import lmdb except ImportError as e: raise unittest.SkipTest("python-lmdb is not installed") from e class VideoInputOpTest(unitt...
10,515
34.647458
82
py
pytorch
pytorch-main/caffe2/python/operator_test/trigonometric_op_test.py
from caffe2.python import core from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import numpy as np import unittest class TestTrigonometricOp(serial.SerializedTestCase): @given( X=hu.tensor(eleme...
1,715
31.377358
84
py
pytorch
pytorch-main/caffe2/python/operator_test/sparse_ops_test.py
from caffe2.python import core from caffe2.python.test_util import rand_array import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial from hypothesis import given, settings import hypothesis.strategies as st import numpy as np class TestScatterOps(serial...
3,469
37.555556
110
py
pytorch
pytorch-main/caffe2/python/operator_test/lengths_tile_op_test.py
from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np class TestLengthsTileOp(serial.SerializedTestCase): @serial.given( inputs=st.integers(min_value=1, ...
1,332
24.634615
75
py
pytorch
pytorch-main/caffe2/python/operator_test/erf_op_test.py
import math from caffe2.python import core from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import numpy as np import unittest class TestErfOp(serial.SerializedTestCase): @given( X=hu.tensor(el...
749
23.193548
87
py
pytorch
pytorch-main/caffe2/python/operator_test/elementwise_op_broadcast_test.py
import unittest from hypothesis import given, assume, settings import hypothesis.strategies as st import numpy as np import operator from caffe2.proto import caffe2_pb2 from caffe2.python import core, workspace import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_u...
17,462
39.801402
100
py
pytorch
pytorch-main/caffe2/python/operator_test/percentile_op_test.py
from caffe2.python import core, workspace import caffe2.python.hypothesis_test_util as hu import numpy as np class TestPercentileOp(hu.HypothesisTestCase): def _test_percentile_op( self, original_inp, value_to_pct_map, dist_lengths, expected_values ): op = ...
4,427
32.801527
88
py
pytorch
pytorch-main/caffe2/python/operator_test/mkl_packed_fc_op_test.py
import unittest import hypothesis.strategies as st from hypothesis import given import numpy as np from caffe2.python import core import caffe2.python.hypothesis_test_util as hu @unittest.skipIf(not core.IsOperator("PackedFC"), "PackedFC is not supported in this caffe2 build.") class PackedFCTes...
2,647
33.38961
85
py
pytorch
pytorch-main/caffe2/python/operator_test/moments_op_test.py
from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import itertools as it import numpy as np class TestMomentsOp(serial.SerializedTestCase): def run_moments_test(self, X, axes, ...
1,722
30.907407
72
py
pytorch
pytorch-main/caffe2/python/operator_test/instance_norm_test.py
import numpy as np from hypothesis import given, assume, settings import hypothesis.strategies as st from caffe2.python import core, model_helper, brew, utils import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import unittest class TestInstanceNor...
9,917
34.805054
80
py
pytorch
pytorch-main/caffe2/python/operator_test/data_couple_op_test.py
from caffe2.python import core, workspace from caffe2.python.test_util import TestCase import numpy as np class TestDataCoupleOp(TestCase): def test_data_couple_op(self): param_array = np.random.rand(10, 10) gradient_array = np.random.rand(10, 10) extra_array = np.random.rand(10, 10)...
858
26.709677
58
py
pytorch
pytorch-main/caffe2/python/operator_test/rank_loss_operator_test.py
from caffe2.python import core, workspace from hypothesis import given import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np class TestPairWiseLossOps(serial.SerializedTestCase): @given(X=hu.ar...
5,752
37.871622
80
py
pytorch
pytorch-main/caffe2/python/operator_test/weighted_sample_test.py
import numpy as np from hypothesis import given import hypothesis.strategies as st from caffe2.python import core from caffe2.python import workspace import caffe2.python.hypothesis_test_util as hu class TestWeightedSample(hu.HypothesisTestCase): @given( batch=st.integers(min_value=0, max_value=128...
2,739
32.82716
78
py
pytorch
pytorch-main/caffe2/python/operator_test/boolean_mask_test.py
from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial from hypothesis import assume, given, settings import hypothesis.strategies as st import numpy as np class TestBooleanMaskOp(serial.SerializedTestCase): @given(x=h...
16,389
39.469136
79
py
pytorch
pytorch-main/caffe2/python/operator_test/cross_entropy_ops_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 import unittest def sigmoid(x): return 1.0 / (1.0 + np.exp(-x)) def sigmoid_cross_entropy_with_logits(x, z): return np.maximum(x, 0) - x * z +...
10,085
34.020833
83
py
pytorch
pytorch-main/caffe2/python/operator_test/bisect_percentile_op_test.py
from typing import List import hypothesis.strategies as st from caffe2.python import core, workspace from hypothesis import given import caffe2.python.hypothesis_test_util as hu import bisect import numpy as np class TestBisectPercentileOp(hu.HypothesisTestCase): def compare_reference( self, ...
6,290
33.95
93
py
pytorch
pytorch-main/caffe2/python/operator_test/gru_test.py
from caffe2.python import workspace, core, scope, gru_cell from caffe2.python.model_helper import ModelHelper from caffe2.python.rnn.rnn_cell_test_util import sigmoid, tanh, _prepare_rnn import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial from caffe2....
12,932
32.161538
83
py
pytorch
pytorch-main/caffe2/python/operator_test/locally_connected_op_test.py
import numpy as np from hypothesis import given, settings, assume import hypothesis.strategies as st from caffe2.python import core, utils, workspace import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial class TestLocallyConnectedOp(serial.Serialized...
7,761
32.895197
78
py
pytorch
pytorch-main/caffe2/python/operator_test/elementwise_ops_test.py
from caffe2.python import core, workspace from hypothesis import given, assume, settings import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np import unittest class TestElementwiseOps(hu.HypothesisTestCase): @given(X=hu.tensor(dtype=np.float32), **hu.gcs) ...
33,354
30.796949
92
py
pytorch
pytorch-main/caffe2/python/operator_test/resize_op_test.py
import numpy as np import hypothesis.strategies as st import unittest import caffe2.python.hypothesis_test_util as hu from caffe2.python import core from caffe2.proto import caffe2_pb2 from hypothesis import assume, given, settings class TestResize(hu.HypothesisTestCase): @given(height_scale=st.floats(0.25, 4...
9,417
35.933333
87
py
pytorch
pytorch-main/caffe2/python/operator_test/channel_shuffle_test.py
import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np from caffe2.python import core class ChannelShuffleOpsTest(serial.SerializedTestCase): def _channel_shuffle_nchw_ref(self, X, group): ...
1,794
29.948276
86
py
pytorch
pytorch-main/caffe2/python/operator_test/rand_quantization_op_speed_test.py
import time import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np from caffe2.python import core, workspace from hypothesis import given, settings np.set_printoptions(precision=6) class TestSpeedFloatToFusedRandRowwiseQuantized(hu.HypothesisTestCase): @given( ...
3,128
29.086538
87
py
pytorch
pytorch-main/caffe2/python/operator_test/image_input_op_test.py
import unittest try: import cv2 import lmdb except ImportError: pass # Handled below from PIL import Image import numpy as np import shutil import io import sys import tempfile # TODO: This test does not test scaling because # the algorithms used by OpenCV in the C and Python # version seem to diffe...
17,345
38.967742
86
py
pytorch
pytorch-main/caffe2/python/operator_test/dense_vector_to_id_list_op_test.py
from caffe2.python import core from hypothesis import given import caffe2.python.hypothesis_test_util as hu import hypothesis.extra.numpy as hnp import hypothesis.strategies as st import numpy as np @st.composite def id_list_batch(draw): batch_size = draw(st.integers(2, 2)) values_dtype = np.float32 ...
2,044
29.522388
80
py
pytorch
pytorch-main/caffe2/python/operator_test/arg_ops_test.py
import hypothesis.strategies as st import numpy as np from caffe2.python import core from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial class TestArgOps(serial.SerializedTestCase): @given( X=hu.te...
1,917
28.96875
71
py
pytorch
pytorch-main/caffe2/python/operator_test/mul_gradient_benchmark.py
import argparse import numpy as np from caffe2.python import core, workspace def benchmark_mul_gradient(args): workspace.FeedBlob("dC", np.random.rand(args.m, args.n).astype(np.float32)) workspace.FeedBlob("A", np.random.rand(args.m, args.n).astype(np.float32)) workspace.FeedBlob("B", np.random.rand...
1,509
28.607843
79
py
pytorch
pytorch-main/caffe2/python/operator_test/atomic_ops_test.py
from caffe2.python import core, workspace from caffe2.python.test_util import TestCase import unittest class TestAtomicOps(TestCase): @unittest.skip("Test is flaky: https://github.com/pytorch/pytorch/issues/28179") def test_atomic_ops(self): """ Test that both countdown and checksum are u...
4,102
43.597826
84
py
pytorch
pytorch-main/caffe2/python/operator_test/blobs_queue_db_test.py
import numpy as np import caffe2.proto.caffe2_pb2 as caffe2_pb2 from caffe2.python import core, workspace, timeout_guard, test_util class BlobsQueueDBTest(test_util.TestCase): def test_create_blobs_queue_db_string(self): def add_blobs(queue, num_samples): blob = core.BlobReference("blob"...
3,240
33.478723
78
py
pytorch
pytorch-main/caffe2/python/operator_test/utility_ops_test.py
from caffe2.python import core, workspace from hypothesis import assume, given, settings from caffe2.proto import caffe2_pb2 import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np import random clas...
15,054
30.169772
97
py
pytorch
pytorch-main/caffe2/python/operator_test/crf_test.py
from caffe2.python import workspace, crf, brew from caffe2.python.model_helper import ModelHelper import numpy as np from scipy.special import logsumexp import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st from hypothesis import given, settings class TestCRFOp(hu.HypothesisTestCase):...
5,315
36.702128
84
py
pytorch
pytorch-main/caffe2/python/operator_test/bbox_transform_test.py
from caffe2.python import core from hypothesis import given, settings import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np # Reference implementation from detectron/lib/utils/boxes.py def bbox_tra...
12,258
33.147632
86
py
pytorch
pytorch-main/caffe2/python/operator_test/reshape_ops_test.py
import numpy as np from numpy.testing import assert_array_equal from caffe2.python import core, workspace from caffe2.python.test_util import TestCase from caffe2.proto import caffe2_pb2 class TestLengthsToShapeOps(TestCase): def test_lengths_to_shape_ops(self): workspace.FeedBlob('l', np.array([200,...
8,211
37.735849
118
py
pytorch
pytorch-main/caffe2/python/operator_test/ceil_op_test.py
from caffe2.python import core import caffe2.python.hypothesis_test_util as hu from hypothesis import given, settings import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np import unittest class TestCeil(serial.SerializedTestCase): @given(X...
888
21.225
69
py
pytorch
pytorch-main/caffe2/python/operator_test/jsd_ops_test.py
from caffe2.python import core import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np def entropy(p): q = 1. - p return -p * np.log(p) - q * np.log(q) def jsd(p, q): return [entropy(p ...
1,044
23.880952
73
py
pytorch
pytorch-main/caffe2/python/operator_test/dataset_ops_test.py
import functools import operator import string import hypothesis.strategies as st import numpy as np import numpy.testing as npt from caffe2.python import core, dataset, workspace from caffe2.python.dataset import Const from caffe2.python.schema import ( FeedRecord, FetchRecord, Field, List, Map, ...
23,841
33.06
91
py
pytorch
pytorch-main/caffe2/python/operator_test/scale_op_test.py
from caffe2.python import core, workspace import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import hypothesis.strategies as st import numpy as np class TestScaleOps(serial.SerializedTestCase): @serial.given(dim=st.sampled_from([[1, 386, 1], [...
2,177
31.507463
68
py
pytorch
pytorch-main/caffe2/python/operator_test/mkl_conv_op_test.py
import unittest import hypothesis.strategies as st from hypothesis import given, settings import numpy as np from caffe2.python import core, workspace import caffe2.python.hypothesis_test_util as hu import caffe2.python.mkl_test_util as mu @unittest.skipIf(not workspace.C.has_mkldnn, "Skipping a...
1,547
28.769231
76
py
pytorch
pytorch-main/caffe2/python/operator_test/math_ops_test.py
from caffe2.python import core from hypothesis import given, settings from hypothesis import strategies as st import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial import numpy as np import unittest class TestMathOps(serial.SerializedTestCase): ...
1,603
27.642857
75
py
pytorch
pytorch-main/caffe2/python/operator_test/rebatching_queue_test.py
from caffe2.python import core, workspace from caffe2.python.test_util import TestCase import numpy as np import numpy.testing as npt from hypothesis import given, settings import hypothesis.strategies as st import functools def primefac(n): ret = [] divisor = 2 while divisor * divisor <= n: ...
9,045
30.301038
84
py
pytorch
pytorch-main/caffe2/python/operator_test/copy_ops_test.py
import numpy as np import unittest from caffe2.proto import caffe2_pb2 from caffe2.python import workspace, core, model_helper, brew, test_util class CopyOpsTest(test_util.TestCase): def tearDown(self): # Reset workspace after each test # Otherwise, the multi-GPU test will use previously cr...
7,374
38.021164
82
py
pytorch
pytorch-main/caffe2/python/operator_test/collect_and_distribute_fpn_rpn_proposals_op_test.py
import numpy as np import unittest from hypothesis import given, settings import hypothesis.strategies as st from caffe2.python import core, utils import caffe2.python.hypothesis_test_util as hu import caffe2.python.serialized_test.serialized_test_util as serial # # Should match original Detectron code at # htt...
11,269
34.329154
111
py
pytorch
pytorch-main/caffe2/python/operator_test/weighted_multi_sample_test.py
import numpy as np from hypothesis import given import hypothesis.strategies as st from caffe2.python import core from caffe2.python import workspace import caffe2.python.hypothesis_test_util as hu class TestWeightedMultiSample(hu.HypothesisTestCase): @given( num_samples=st.integers(min_value=0, ma...
1,997
27.542857
82
py
pytorch
pytorch-main/caffe2/python/operator_test/im2col_col2im_test.py
from caffe2.python import core from hypothesis import assume, given, settings import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np class TestReduceFrontSum(hu.HypothesisTestCase): @given(batch_size=st.integers(1, 3), stride=st.integers(1, 3), ...
4,311
30.021583
79
py
pytorch
pytorch-main/caffe2/python/test/gpu_context_test.py
import unittest import torch from caffe2.python import core, workspace # This is a standalone test that doesn't use test_util as we're testing # initialization and thus we should be the ones calling GlobalInit @unittest.skipIf(not workspace.has_cuda_support, "THC pool testing is obscure and does...
1,121
34.0625
75
py
pytorch
pytorch-main/caffe2/python/test/executor_test.py
from caffe2.python import core, workspace from caffe2.python.test.executor_test_util import ( build_conv_model, build_resnet50_dataparallel_model, run_resnet50_epoch, ExecutorTestBase, executor_test_settings, executor_test_model_names) from caffe2.python.test_util import TestCase from hypo...
3,039
28.230769
78
py
pytorch
pytorch-main/caffe2/python/test/fakefp16_transform_test.py
import unittest from caffe2.python.fakefp16_transform_lib import fakeFp16FuseOps from caffe2.python import core class Transformer(unittest.TestCase): def test_fuse(self): net_swish = core.Net("test_swish") net_swish_init = core.Net("test_swish_init") deq = core.CreateOperator("Int8Dequ...
723
27.96
71
py
pytorch
pytorch-main/caffe2/python/test/inference_lstm_op_test.py
#!/usr/bin/env python3 import hypothesis.strategies as st import numpy as np import torch from caffe2.python import core from caffe2.python.test_util import TestCase from hypothesis import given, settings from torch import nn class TestC2LSTM(TestCase): @given( bsz=st.integers(1, 5), seq_lens=st....
2,190
29.013699
88
py
pytorch
pytorch-main/caffe2/python/test/executor_test_util.py
from caffe2.python import ( brew, cnn, core, workspace, data_parallel_model, timeout_guard, model_helper, optimizer) from caffe2.python.test_util import TestCase import caffe2.python.models.resnet as resnet from caffe2.python.modeling.initializers import Initializer from caffe2.python import convnet_benchm...
8,058
29.070896
84
py
pytorch
pytorch-main/caffe2/python/test/do_op_test.py
from caffe2.python import core, workspace from caffe2.python.test_util import TestCase import numpy as np import unittest class DoOpTest(TestCase): def test_operator(self): def make_net(): subnet = core.Net('subnet') subnet.Add(["X", "Y"], "Z") net = core.Net("net"...
2,055
25.358974
71
py