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/given_tensor_byte_string_to_uint8_fill_op_test.py |
from caffe2.python import core
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
import numpy as np
import unittest
class TestGivenTensorByteStringToUInt8FillOps(hu.HypothesisTestCase):
@given(X=hu.tensor(min_dim=1, max_dim=4, dtype=np.int32),
**hu.gcs)
def test_giv... | 1,392 | 24.796296 | 72 | py |
pytorch | pytorch-main/caffe2/python/operator_test/pooling_test.py |
import numpy as np
from hypothesis import assume, given, settings
import hypothesis.strategies as st
import os
import unittest
from caffe2.python import core, utils, workspace
import caffe2.python.hip_test_util as hiputl
import caffe2.python.hypothesis_test_util as hu
class TestPooling(hu.HypothesisTestCase):
... | 16,508 | 34.275641 | 95 | py |
pytorch | pytorch-main/caffe2/python/operator_test/sequence_ops_test.py |
from caffe2.python import core
from functools import partial
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
from caffe2.python import wor... | 16,051 | 35.234763 | 105 | py |
pytorch | pytorch-main/caffe2/python/operator_test/unique_uniform_fill_op_test.py |
from caffe2.python import core, workspace
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
import unittest
class TestUniqueUniformFillOp(hu.HypothesisTestCase):
@given(
r=st.integers(1000, 10000),
avoid=st.lists... | 1,335 | 24.692308 | 72 | py |
pytorch | pytorch-main/caffe2/python/operator_test/histogram_test.py | import unittest
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
class TestHistogram(hu.HypothesisTestCase):
@given(rows=st.integers(1, 1000), cols=st.integers(1, 1000), **hu.gcs_... | 3,097 | 35.023256 | 88 | py |
pytorch | pytorch-main/caffe2/python/operator_test/cudnn_recurrent_test.py |
from caffe2.python import model_helper, workspace, core, rnn_cell
import numpy as np
import unittest
@unittest.skipIf(not workspace.has_gpu_support, "No gpu support.")
class TestLSTMs(unittest.TestCase):
def testEqualToCudnn(self):
with core.DeviceScope(core.DeviceOption(workspace.GpuDeviceType)):
... | 5,776 | 37.006579 | 99 | py |
pytorch | pytorch-main/caffe2/python/operator_test/mean_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
import unittest
class TestMean(serial.SerializedTestCase):
@serial.given(
k=st.integers(1, 5),
... | 1,469 | 22.333333 | 67 | py |
pytorch | pytorch-main/caffe2/python/operator_test/hyperbolic_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 TestHyperbolicOps(serial.SerializedTestCase):
def _test_hyperbolic_op(self, op_name, np_ref, X, in_pla... | 1,472 | 31.021739 | 88 | py |
pytorch | pytorch-main/caffe2/python/operator_test/roi_align_rotated_op_test.py |
from caffe2.python import core, workspace
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
import copy
class RoIAlignRotatedOp(hu.HypothesisTestCase):
def bbox_xywh_to_xyxy(self, boxes):
"""
Convert from [center... | 7,579 | 34.924171 | 88 | py |
pytorch | pytorch-main/caffe2/python/operator_test/unsafe_coalesce_test.py | #!/usr/bin/env python3
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 TestUnsafeCoalesceOp(hu.HypothesisTestCase):
@given(
n=st.integers(1, 5),
... | 2,939 | 37.181818 | 92 | py |
pytorch | pytorch-main/caffe2/python/operator_test/activation_ops_test.py |
import numpy as np
from hypothesis import given, assume, settings
import hypothesis.strategies as st
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.mkl_test_util as mu
import caffe2.python.serialized_test.serialized_test_util as serial
from scipy.s... | 9,691 | 31.854237 | 110 | py |
pytorch | pytorch-main/caffe2/python/operator_test/segment_ops_test.py |
from functools import partial
from hypothesis import given, settings
import numpy as np
import unittest
import hypothesis.strategies as st
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
def sparse_leng... | 25,745 | 32.177835 | 98 | py |
pytorch | pytorch-main/caffe2/python/operator_test/selu_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 unittest
class TestSelu(serial.SerializedTestCase):
@serial.... | 3,232 | 31.009901 | 85 | py |
pytorch | pytorch-main/caffe2/python/operator_test/softmax_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 unittest
class TestSoftmaxOps(serial.SerializedTestCas... | 23,685 | 33.578102 | 83 | py |
pytorch | pytorch-main/caffe2/python/operator_test/merge_id_lists_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.extra.numpy as hnp
import hypothesis.strategies as st
import numpy as np
@st.composite
def id_list_batch(draw):
num_inputs = draw(st.integers(1... | 2,989 | 35.463415 | 86 | py |
pytorch | pytorch-main/caffe2/python/operator_test/storm_test.py |
import functools
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
class TestStorm(hu.HypothesisTestCase):
@given(inputs=hu.tensors(n=3),
grad_sq_sum=st.floats(m... | 6,507 | 40.189873 | 80 | py |
pytorch | pytorch-main/caffe2/python/operator_test/index_ops_test.py |
from caffe2.python import core, workspace
from caffe2.python.test_util import TestCase
import numpy as np
import tempfile
class TestIndexOps(TestCase):
def _test_index_ops(self, entries, dtype, index_create_op):
workspace.RunOperatorOnce(core.CreateOperator(
index_create_op,
[]... | 4,595 | 32.304348 | 77 | py |
pytorch | pytorch-main/caffe2/python/operator_test/dropout_op_test.py |
from hypothesis import assume, given, settings
import hypothesis.strategies as st
import numpy as np
from caffe2.proto import caffe2_pb2
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
class TestDropout(serial.Ser... | 4,401 | 39.385321 | 109 | py |
pytorch | pytorch-main/caffe2/python/operator_test/fused_nbit_rowwise_conversion_ops_test.py |
import math
import struct
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
from caffe2.python import core, workspace
from caffe2.python.operator_test.fused_nbit_rowwise_test_helper import (
_compress_uniform_simplified,
param_search_greedy,
)
from hypothes... | 14,077 | 38.656338 | 211 | py |
pytorch | pytorch-main/caffe2/python/operator_test/async_net_barrier_test.py | #!/usr/bin/env python3
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
from caffe2.python import core
from hypothesis import given
class TestAsyncNetBarrierOp(hu.HypothesisTestCase):
@given(
n=st.integers(1, 5),
shape=st.lists(st.integers(0, 5... | 945 | 28.5625 | 92 | py |
pytorch | pytorch-main/caffe2/python/operator_test/affine_channel_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 TestAffineChannelOp(serial.SerializedTestCase):
def affine_chann... | 3,784 | 33.409091 | 80 | py |
pytorch | pytorch-main/caffe2/python/operator_test/conv_test.py |
import collections
import functools
import unittest
import caffe2.python._import_c_extension as C
import caffe2.python.hip_test_util as hiputl
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... | 32,473 | 31.152475 | 86 | py |
pytorch | pytorch-main/caffe2/python/operator_test/duplicate_operands_test.py |
import numpy as np
from caffe2.python import core, workspace
from caffe2.python.test_util import TestCase
class TestDuplicateOperands(TestCase):
def test_duplicate_operands(self):
net = core.Net('net')
shape = (2, 4)
x_in = np.random.uniform(size=shape)
x = net.GivenTensorFil... | 734 | 24.344828 | 66 | py |
pytorch | pytorch-main/caffe2/python/operator_test/upsample_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... | 7,308 | 35.914141 | 78 | py |
pytorch | pytorch-main/caffe2/python/operator_test/copy_rows_to_tensor_op_test.py |
import logging
import caffe2.python.hypothesis_test_util as hu
import numpy as np
from caffe2.python import core
from hypothesis import given, settings, strategies as st
logger = logging.getLogger(__name__)
def get_input_tensors():
height = np.random.randint(1, 10)
width = np.random.randint(1, 10)
dt... | 2,526 | 32.693333 | 88 | py |
pytorch | pytorch-main/caffe2/python/operator_test/matmul_op_test.py |
import inspect
import numpy as np
from hypothesis import assume, 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 TestMatMul(serial.SerializedTestCase):
... | 10,096 | 33.817241 | 105 | py |
pytorch | pytorch-main/caffe2/python/operator_test/lars_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 TestLars(hu.HypothesisTestCase):
@given(offset=st.floats(min_value=0, max_value=100),
lr_min=st.floats(min_value=1e-8, max_value=1e-6),
... | 1,354 | 28.456522 | 78 | py |
pytorch | pytorch-main/caffe2/python/operator_test/channel_backprop_stats_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 TestChannelBackpropStats(serial.SerializedTestCase)... | 2,131 | 32.84127 | 79 | py |
pytorch | pytorch-main/caffe2/python/operator_test/adam_test.py |
import functools
import hypothesis
from hypothesis import given
import hypothesis.strategies as st
import numpy as np
import unittest
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
class TestAdam(hu.HypothesisTestCase):
@staticmethod
def ref_adam(param, mom1,... | 21,658 | 39.183673 | 103 | py |
pytorch | pytorch-main/caffe2/python/operator_test/floor_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 TestFloor(serial.SerializedTestCase):
@given(... | 894 | 21.375 | 70 | py |
pytorch | pytorch-main/caffe2/python/operator_test/adadelta_test.py |
import functools
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
class TestAdadelta(seri... | 7,932 | 38.665 | 88 | py |
pytorch | pytorch-main/caffe2/python/operator_test/text_file_reader_test.py |
from caffe2.python import core, workspace
from caffe2.python.text_file_reader import TextFileReader
from caffe2.python.test_util import TestCase
from caffe2.python.schema import Struct, Scalar, FetchRecord
import tempfile
import numpy as np
class TestTextFileReader(TestCase):
def test_text_file_reader(self):
... | 2,517 | 36.029412 | 80 | py |
pytorch | pytorch-main/caffe2/python/operator_test/reduction_ops_test.py |
from caffe2.python import core, workspace
from hypothesis import assume, 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 TestReductionOps(serial.SerializedTestCase):
... | 4,664 | 24.773481 | 77 | py |
pytorch | pytorch-main/caffe2/python/operator_test/shape_inference_test.py |
import numpy as np
import unittest
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace, test_util, model_helper, brew, build
@unittest.skipIf(build.CAFFE2_NO_OPERATOR_SCHEMA,
'Built with CAFFE2_NO_OPERATOR_SCHEMA')
class TestShapeInference(test_util.TestCase):
def... | 25,701 | 37.190193 | 93 | py |
pytorch | pytorch-main/caffe2/python/operator_test/conftest.py |
import caffe2.python.serialized_test.serialized_test_util as serial
def pytest_addoption(parser):
parser.addoption(
'-G',
'--generate-serialized',
action='store_true',
dest='generate',
help='generate output files (default=false, compares to current files)',
)
p... | 1,446 | 28.530612 | 80 | py |
pytorch | pytorch-main/caffe2/python/operator_test/gather_ops_test.py |
import numpy as np
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 hypothesis.extra.numpy as hnp
# Basic implementation of ... | 9,216 | 36.930041 | 109 | py |
pytorch | pytorch-main/caffe2/python/operator_test/bucketize_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 TestBucketizeOp(hu.HypothesisTestCase):
@given(
x=hu.tensor(
min_dim=1, max_dim=2, dtype=np.float32,
elements=hu.floats(min_value=-5, max_value=5... | 930 | 25.6 | 64 | py |
pytorch | pytorch-main/caffe2/python/operator_test/batch_sparse_to_dense_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 TestBatchSparseToDense(serial.SerializedTestCase):
@given(
... | 4,199 | 35.521739 | 97 | py |
pytorch | pytorch-main/caffe2/python/operator_test/unique_ops_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,255 | 28.684211 | 78 | py |
pytorch | pytorch-main/caffe2/python/operator_test/batch_bucketize_op_test.py |
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
from hypothesis import given
import hypothesis.strategies as st
class TestBatchBucketize(serial.SerializedTestCase):
@serial.given(**hu.gcs_cp... | 3,730 | 39.554348 | 84 | py |
pytorch | pytorch-main/caffe2/python/operator_test/square_root_divide_op_test.py |
from caffe2.python import core
from functools import partial
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 math
import numpy as np
def _data_and_scale(
data_min_size=4, data_max_size=10,
... | 2,179 | 27.311688 | 78 | py |
pytorch | pytorch-main/caffe2/python/operator_test/adagrad_test_helper.py | from functools import partial
import caffe2.python.hypothesis_test_util as hu
import numpy as np
from caffe2.python import core
def ref_adagrad(
param_in,
mom_in,
grad,
lr,
epsilon,
using_fp16=False,
output_effective_lr=False,
output_effective_lr_and_update=False,
decay=1.0,
r... | 5,178 | 30.198795 | 133 | py |
pytorch | pytorch-main/caffe2/python/operator_test/filler_ops_test.py |
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_util as serial
from hypothesis import given, settings
import hypothesis.strategies as st
import numpy as np
def _fill_diagonal(shape,... | 8,476 | 30.165441 | 98 | py |
pytorch | pytorch-main/caffe2/python/operator_test/find_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
from hypothesis import given, settings
import numpy as np
class TestFindOperator(serial.SerializedTestCase):
@given(n=st.samp... | 1,316 | 24.326923 | 67 | py |
pytorch | pytorch-main/caffe2/python/operator_test/decay_adagrad_test.py | import functools
from hypothesis import given
import hypothesis.strategies as st
import numpy as np
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
class TestDecayAdagrad(hu.HypothesisTestCase):
@staticmethod
def ref_decay_adagrad(param, mom1, mom2, grad, LR, ITER,
... | 2,694 | 38.057971 | 131 | py |
pytorch | pytorch-main/caffe2/python/operator_test/concat_split_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
@st.composite
def _tensor_splits(draw, add_axis=False):
... | 7,266 | 33.278302 | 97 | py |
pytorch | pytorch-main/caffe2/python/operator_test/ctc_greedy_decoder_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 unittest
class TestCTCGreedyDecoderOp(serial.SerializedTestCase):
... | 4,743 | 30.210526 | 71 | py |
pytorch | pytorch-main/caffe2/python/operator_test/counter_ops_test.py |
from caffe2.python import core, workspace
from caffe2.python.test_util import TestCase
import tempfile
class TestCounterOps(TestCase):
def test_counter_ops(self):
workspace.RunOperatorOnce(core.CreateOperator(
'CreateCounter', [], ['c'], init_count=1))
workspace.RunOperatorOnce(... | 3,348 | 38.4 | 69 | py |
pytorch | pytorch-main/caffe2/python/operator_test/conditional_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 TestConditionalOp(serial.SerializedTestCase):
@serial.given(rows_num=st.integers(1, 10000), **hu.gcs_cp... | 995 | 32.2 | 76 | py |
pytorch | pytorch-main/caffe2/python/operator_test/load_save_test.py | import hypothesis.strategies as st
from hypothesis import given, assume, settings
import io
import math
import numpy as np
import os
import struct
import unittest
from pathlib import Path
from typing import Dict, Generator, List, NamedTuple, Optional, Tuple, Type
from caffe2.proto import caffe2_pb2
from caffe2.proto.ca... | 33,219 | 37.227848 | 82 | py |
pytorch | pytorch-main/caffe2/python/operator_test/_utils.py | """
This file only exists since `torch.testing.assert_allclose` is deprecated, but used extensively throughout the tests in
this package. The replacement `torch.testing.assert_close` doesn't support one feature that is needed here: comparison
between numpy arrays and torch tensors. See https://github.com/pytorch/pytorc... | 1,628 | 31.58 | 119 | py |
pytorch | pytorch-main/caffe2/python/operator_test/elementwise_linear_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 TestElementwiseLinearOp(serial.SerializedTestCase):
@serial.given(n=st.integers(2, 100), d=st.integer... | 1,382 | 28.425532 | 75 | py |
pytorch | pytorch-main/caffe2/python/operator_test/piecewise_linear_transform_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 TestPiecewiseLinearTransform(serial.SerializedTest... | 6,232 | 35.238372 | 77 | py |
pytorch | pytorch-main/caffe2/python/operator_test/sparse_itemwise_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 SparseItemwiseDropoutWithReplacementTest(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, ... | 2,913 | 41.231884 | 82 | py |
pytorch | pytorch-main/caffe2/python/operator_test/glu_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
@st.composite
def _glu_old_input(draw):
dims = draw(... | 1,212 | 25.369565 | 88 | py |
pytorch | pytorch-main/caffe2/python/operator_test/apmeter_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
def calculate_ap(predictions, labels):
N, D = predictions.shape
ap = np.zeros(D)
num_range = np.arange((N), dtype=np.float32) + 1
for k... | 2,738 | 31.223529 | 79 | py |
pytorch | pytorch-main/caffe2/python/operator_test/leaky_relu_test.py |
import numpy as np
from hypothesis import given, assume
import hypothesis.strategies as st
from caffe2.python import core, model_helper, utils
import caffe2.python.hypothesis_test_util as hu
class TestLeakyRelu(hu.HypothesisTestCase):
def _get_inputs(self, N, C, H, W, order):
input_data = np.random.... | 5,639 | 30.685393 | 82 | py |
pytorch | pytorch-main/caffe2/python/operator_test/flexible_top_k_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 collections import OrderedDict
from hypothesis import given, settings
import numpy as np
class TestFlexibleTopK(serial.SerializedTestCase):
def flexible_top... | 2,609 | 32.461538 | 79 | py |
pytorch | pytorch-main/caffe2/python/operator_test/adagrad_test.py | import functools
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
from caffe2.python.operator_test.adagrad_test_helper import (
adagrad_sparse_test_helper,
ref... | 7,586 | 30.35124 | 87 | py |
pytorch | pytorch-main/caffe2/python/operator_test/recurrent_net_executor_test.py |
from caffe2.proto import caffe2_pb2
from caffe2.python import model_helper, workspace, core, rnn_cell, test_util
from caffe2.python.attention import AttentionType
import numpy as np
import unittest
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
from hypothesis import given, se... | 10,901 | 34.396104 | 82 | py |
pytorch | pytorch-main/caffe2/python/operator_test/checkpoint_test.py |
from caffe2.python import core, workspace, test_util
import os
import shutil
import tempfile
import unittest
class CheckpointTest(test_util.TestCase):
"""A simple test case to make sure that the checkpoint behavior is correct.
"""
@unittest.skipIf("LevelDB" not in core.C.registered_dbs(), "Need Leve... | 1,500 | 32.355556 | 82 | py |
pytorch | pytorch-main/caffe2/python/operator_test/heatmap_max_keypoint_op_test.py |
import numpy as np
import torch
import sys
import unittest
from scipy import interpolate
import caffe2.python.hypothesis_test_util as hu
from caffe2.python import core, utils
from caffe2.proto import caffe2_pb2
import caffe2.python.operator_test.detectron_keypoints as keypoint_utils
NUM_TEST_ROI = 14
NUM_KEYPOI... | 4,740 | 31.472603 | 86 | py |
pytorch | pytorch-main/caffe2/python/operator_test/map_ops_test.py |
import itertools
import numpy as np
import tempfile
import unittest
import os
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
class TestMap(hu.HypothesisTestCase):
def test_create_map(self):
dtypes = [core.DataType.INT32, core.DataType.INT64]
for ke... | 2,249 | 30.690141 | 86 | py |
pytorch | pytorch-main/caffe2/python/operator_test/string_ops_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
def _string_lists(alphabet=None):
return st.lists(
elements=s... | 4,154 | 26.335526 | 78 | py |
pytorch | pytorch-main/caffe2/python/operator_test/split_op_cost_test.py | import numpy as np
from caffe2.python import core, workspace
from caffe2.python.test_util import TestCase
class TestSplitOpCost(TestCase):
def _verify_cost(self, workspace, split_op):
flops, bytes_written, bytes_read = workspace.GetOperatorCost(
split_op, split_op.input
)
self.... | 8,645 | 34.004049 | 95 | py |
pytorch | pytorch-main/caffe2/python/operator_test/self_binning_histogram_test.py | import unittest
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
class TestSelfBinningHistogramBase:
def __init__(self, bin_spacing, dtype, abs=False):
self.bin_spacing = ... | 12,907 | 41.883721 | 112 | py |
pytorch | pytorch-main/caffe2/python/operator_test/batch_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
from hypothesis import given, settings
import hypothesis.strategies as st
import numpy as np
class TestBatchMomentsOp(serial.SerializedTestCase):
def batch_moments... | 2,795 | 29.064516 | 73 | py |
pytorch | pytorch-main/caffe2/python/operator_test/numpy_tile_op_test.py |
import numpy as np
from hypothesis import given, settings
import hypothesis.strategies as st
import unittest
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
class TestNumpyTile(serial.SerializedTestCase):
@gi... | 1,924 | 27.731343 | 67 | py |
pytorch | pytorch-main/caffe2/python/operator_test/tile_op_test.py |
import numpy as np
from hypothesis import given, settings
import hypothesis.strategies as st
import unittest
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
class TestTile(serial.SerializedTestCase):
... | 3,878 | 31.872881 | 75 | py |
pytorch | pytorch-main/caffe2/python/operator_test/learning_rate_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 copy
from functools import partial
import math
import numpy as np
class TestLearnin... | 8,652 | 32.026718 | 115 | py |
pytorch | pytorch-main/caffe2/python/operator_test/partition_ops_test.py |
import numpy as np
from caffe2.python import core, workspace
from caffe2.python.test_util import TestCase, rand_array
class TestPartitionOps(TestCase):
def test_configs(self):
# (main dims, partitions, main type, [list of (extra dims, type)])
configs = [
((10, ), 3),
... | 6,838 | 36.576923 | 80 | py |
pytorch | pytorch-main/caffe2/python/operator_test/enforce_finite_op_test.py |
from hypothesis import given, settings
import numpy as np
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
class TestEnforceFinite(hu.HypothesisTestCase):
@given(
X=hu.tensor(
# allow empty
min_value=0,
elements=hu.floats(a... | 1,286 | 22.833333 | 97 | py |
pytorch | pytorch-main/caffe2/python/operator_test/one_hot_ops_test.py |
from caffe2.python import core, workspace
from caffe2.proto import caffe2_pb2
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
def _one_hots():
index... | 7,478 | 34.956731 | 79 | py |
pytorch | pytorch-main/caffe2/python/operator_test/torch_integration_test.py |
import struct
import unittest
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
import torch
from caffe2.python import core, workspace
from hypothesis import given, settings
from scipy.stats import norm
from ._utils import assert_allclose
def generate_rois(roi_c... | 39,530 | 34.710027 | 88 | py |
pytorch | pytorch-main/caffe2/python/operator_test/order_switch_test.py |
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
from caffe2.python import core, utils
from hypothesis import given, settings
class OrderSwitchOpsTest(hu.HypothesisTestCase):
@given(
X=hu.tensor(min_dim=3, max_dim=5, min_value=1, max_value=5),
engine=st.sampled_... | 1,306 | 30.878049 | 74 | py |
pytorch | pytorch-main/caffe2/python/operator_test/feature_maps_ops_test.py |
from caffe2.python import core, workspace
from caffe2.python.test_util import TestCase
import numpy as np
class TestFeatureMapsOps(TestCase):
def test_merge_dense_feature_tensors(self):
op = core.CreateOperator(
"MergeDenseFeatureTensors",
[
"in1", "in1_presenc... | 21,492 | 29.443343 | 93 | py |
pytorch | pytorch-main/caffe2/python/operator_test/pack_rnn_sequence_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 TestPackRNNSequenceOperator(serial.SerializedTestCase):
@serial.given(n=st.integers(0, 10), k=st.inte... | 2,891 | 30.78022 | 75 | py |
pytorch | pytorch-main/caffe2/python/operator_test/concat_op_cost_test.py | from collections import namedtuple
import numpy as np
from caffe2.python import core, workspace
from caffe2.python.test_util import TestCase
class TestConcatOpCost(TestCase):
def test_columnwise_concat(self):
def _test_columnwise_concat_for_type(dtype):
workspace.ResetWorkspace()
... | 2,858 | 32.635294 | 88 | py |
pytorch | pytorch-main/caffe2/python/operator_test/record_queue_test.py |
from caffe2.python import core, workspace
from caffe2.python.dataset import Dataset
from caffe2.python.schema import (
Struct, Map, Scalar, from_blob_list, NewRecord, FeedRecord)
from caffe2.python.record_queue import RecordQueue
from caffe2.python.test_util import TestCase
import numpy as np
class TestRecord... | 3,125 | 32.612903 | 77 | py |
pytorch | pytorch-main/caffe2/python/operator_test/momentum_sgd_test.py |
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_util as serial
from hypothesis import given, assume, settings
import hypothesis.strategies as st
import numpy as np
import unittest
c... | 6,480 | 32.755208 | 88 | py |
pytorch | pytorch-main/caffe2/python/operator_test/boolean_unmask_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 TestUnmaskOp(serial.SerializedTestCase):
@serial.given(N=st.integers(min_value=2, max_value=20),
... | 1,711 | 26.174603 | 67 | py |
pytorch | pytorch-main/caffe2/python/operator_test/softplus_op_test.py |
from caffe2.python import core
from hypothesis import given, settings
import caffe2.python.hypothesis_test_util as hu
import unittest
class TestSoftplus(hu.HypothesisTestCase):
@given(X=hu.tensor(),
**hu.gcs)
@settings(deadline=10000)
def test_softplus(self, X, gc, dc):
op = core... | 516 | 18.884615 | 58 | py |
pytorch | pytorch-main/caffe2/python/operator_test/onnx_while_test.py |
from caffe2.proto import caffe2_pb2
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 TestONNXWhile(se... | 3,070 | 30.020202 | 88 | py |
pytorch | pytorch-main/caffe2/python/operator_test/mpi_test.py |
from hypothesis import given
import hypothesis.strategies as st
import numpy as np
import unittest
from caffe2.python import core, workspace, dyndep
import caffe2.python.hypothesis_test_util as hu
dyndep.InitOpsLibrary("@/caffe2/caffe2/mpi:mpi_ops")
_has_mpi =False
COMM = None
RANK = 0
SIZE = 0
def SetupMPI()... | 8,154 | 39.775 | 80 | py |
pytorch | pytorch-main/caffe2/python/operator_test/distance_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 DistanceTest(serial.SerializedTestCase):
@serial.given(n=st.integers(1, 3),
dim=st.integers... | 4,351 | 38.926606 | 77 | py |
pytorch | pytorch-main/caffe2/python/operator_test/cast_op_test.py |
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
from hypothesis import given
import numpy as np
class TestCastOp(hu.HypothesisTestCase):
@given(**hu.gcs)
def test_cast_int_float(self, gc, dc):
data = np.random.rand(5, 5).astype(np.int32)
# from... | 1,597 | 31.612245 | 80 | py |
pytorch | pytorch-main/caffe2/python/operator_test/depthwise_3x3_conv_test.py |
import numpy as np
import caffe2.python.hypothesis_test_util as hu
from caffe2.python import core, utils
from hypothesis import given, settings
import hypothesis.strategies as st
class Depthwise3x3ConvOpsTest(hu.HypothesisTestCase):
@given(pad=st.integers(0, 1),
kernel=st.integers(3, 3),
... | 1,863 | 31.701754 | 70 | py |
pytorch | pytorch-main/caffe2/python/operator_test/sparse_lp_regularizer_test.py |
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
class TestSparseLpNorm(hu.HypothesisTestCase):
@staticmethod
def ref_lpnorm(param_in, p, reg_lambda)... | 2,553 | 32.168831 | 79 | py |
pytorch | pytorch-main/caffe2/python/operator_test/pack_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
from hypothesis import given, settings
from hypothesis import strategies as st
import numpy as np
import time
class TestTensorPackOps(serial.SerializedTes... | 12,632 | 32.420635 | 80 | py |
pytorch | pytorch-main/caffe2/python/operator_test/lengths_top_k_ops_test.py |
from caffe2.python import core
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 TestLengthsTopKOps(serial.SerializedTestCase):
@serial.given(N=st.integer... | 2,371 | 37.885246 | 87 | py |
pytorch | pytorch-main/caffe2/python/operator_test/group_conv_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.hip_test_util as hiputl
import caffe2.python.hypothesis_test_util as hu
import unittest
class TestGroupConvolution(hu... | 2,870 | 32.383721 | 85 | py |
pytorch | pytorch-main/caffe2/python/operator_test/batch_box_cox_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
# The reference implementation is susceptible to numerical cancellation ... | 5,080 | 34.78169 | 80 | py |
pytorch | pytorch-main/caffe2/python/operator_test/sparse_normalize_test.py | import caffe2.python.hypothesis_test_util as hu
import hypothesis
import hypothesis.strategies as st
import numpy as np
from caffe2.python import core
from hypothesis import HealthCheck, given, settings
class TestSparseNormalize(hu.HypothesisTestCase):
@staticmethod
def ref_normalize(param_in, use_max_norm, n... | 3,136 | 31.340206 | 87 | py |
pytorch | pytorch-main/caffe2/python/operator_test/box_with_nms_limit_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 unittest
import numpy as np
def get_op(input_len, output_len, args):
input_names ... | 8,750 | 33.452756 | 90 | py |
pytorch | pytorch-main/caffe2/python/operator_test/basic_rnn_test.py |
from caffe2.python import workspace, core, rnn_cell
from caffe2.python.model_helper import ModelHelper
from caffe2.python.rnn.rnn_cell_test_util import tanh
import caffe2.python.hypothesis_test_util as hu
from hypothesis import given
from hypothesis import settings as ht_settings
import hypothesis.strategies as s... | 4,720 | 33.210145 | 83 | py |
pytorch | pytorch-main/caffe2/python/operator_test/length_split_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 TestLengthSplitOperator(serial.SerializedTestCase):
def _lengt... | 4,868 | 29.816456 | 81 | py |
pytorch | pytorch-main/caffe2/python/operator_test/margin_loss_l2r_operator_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 TestMarginLossL2rOps(hu.HypothesisTestCase):
def ref_margin_loss(self, y, r, margin):
n = len(y)
dy = np.zeros(n)
... | 3,370 | 35.247312 | 82 | py |
pytorch | pytorch-main/caffe2/python/operator_test/clip_tensor_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
from hypothesis import given, settings
import numpy as np
class TestClipTensorByScalingOp(serial.SerializedTestCase):
@given(n... | 2,076 | 31.453125 | 82 | py |
pytorch | pytorch-main/caffe2/python/operator_test/cosine_embedding_criterion_op_test.py |
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
class TestCosineEmbeddingCriterion(serial.SerializedTestCase):
@serial.given(N=st.integers(min_value=10, ma... | 1,953 | 37.313725 | 80 | py |
pytorch | pytorch-main/caffe2/python/operator_test/emptysample_ops_test.py |
from caffe2.python import core, workspace
from caffe2.python.test_util import TestCase
import numpy as np
lengths = [[0], [1, 2], [1, 0, 2, 0]]
features1 = [[],
[1, 2, 2],
[[1, 1], [2, 2], [2, 2]]
]
features2 = [[],
[2, 4, 4],
[[2, 2], [4, 4], [4, ... | 1,977 | 29.90625 | 70 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.