python_code stringlengths 0 1.02M | repo_name stringlengths 9 48 | file_path stringlengths 5 114 |
|---|---|---|
## @package BlobWeightedSum
# Module caffe2.python.layers.blob_weighted_sum
from caffe2.python import schema
from caffe2.python.layers.layers import ModelLayer
class BlobWeightedSum(ModelLayer):
"""
This layer implements the weighted sum:
weighted element-wise sum of input blobs.
"""
def __in... | pytorch-master | caffe2/python/layers/blob_weighted_sum.py |
## @package batch_lr_loss
# Module caffe2.python.layers.batch_lr_loss
from caffe2.python import core, schema
from caffe2.python.layers.layers import (
ModelLayer,
)
from caffe2.python.layers.tags import (
Tags
)
import numpy as np
class BatchLRLoss(ModelLayer):
def __init__(
self,
mod... | pytorch-master | caffe2/python/layers/batch_lr_loss.py |
## @package gather_record
# Module caffe2.python.layers.gather_record
from caffe2.python import core, schema
from caffe2.python.layers.layers import ModelLayer
class GatherRecord(ModelLayer):
"""
Given 1-D `indices` tensor, gather elements at `i` in `indices` from all the
blobs in `record`. If a blob... | pytorch-master | caffe2/python/layers/gather_record.py |
# @package sparse_to_dense
# Module caffe2.python.layers.sparse_to_dense
from collections import defaultdict
import numpy as np
from caffe2.python import schema
from caffe2.python.layers.layers import AccessedFeatures, ModelLayer
class FeatureSparseToDense(ModelLayer):
def __init__(
self,
model... | pytorch-master | caffe2/python/layers/feature_sparse_to_dense.py |
# @package functional
# Module caffe2.python.layers.functional
from caffe2.python import core, schema, scope, workspace
from caffe2.python.layers.layers import (
ModelLayer,
)
import caffe2.proto.caffe2_pb2 as caffe2_pb2
import numpy as np
import logging
logger = logging.getLogger(__name__)
logger.setLevel(lo... | pytorch-master | caffe2/python/layers/functional.py |
import logging
from caffe2.python import schema
from caffe2.python.layers.layers import (
InstantiationContext,
ModelLayer,
)
logger = logging.getLogger(__name__)
class SelectRecordByContext(ModelLayer):
"""
Allowing model to follow different paths for each instantiation context and
join l... | pytorch-master | caffe2/python/layers/select_record_by_context.py |
## @package split
# Module caffe2.python.layers.split
from caffe2.python import schema
from caffe2.python.layers.layers import (
ModelLayer,
)
class Split(ModelLayer):
def __init__(self, model, input_record, num_splits=1, axis=1,
name='split', split=None, **kwargs):
super(Split,... | pytorch-master | caffe2/python/layers/split.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... | pytorch-master | caffe2/python/layers/label_smooth.py |
## @package reservoir_sampling
# Module caffe2.python.layers.reservoir_sampling
from caffe2.python import core, schema
from caffe2.python.layers.layers import ModelLayer
class ReservoirSampling(ModelLayer):
"""
Collect samples from input record w/ reservoir sampling. If you have complex
data, use Pac... | pytorch-master | caffe2/python/layers/reservoir_sampling.py |
## @package sparse_feature_hash
# Module caffe2.python.layers.sparse_feature_hash
from caffe2.python import schema, core
from caffe2.python.layers.layers import (
ModelLayer,
IdList,
IdScoreList,
)
from caffe2.python.layers.tags import (
Tags
)
import numpy as np
class SparseFeatureHash(ModelLay... | pytorch-master | caffe2/python/layers/sparse_feature_hash.py |
## @package fc_with_bootstrap
# Module caffe2.python.layers.fc_with_bootstrap
import math
import numpy as np
from caffe2.python import core, schema
from caffe2.python.helpers.arg_scope import get_current_scope
from caffe2.python.layers.layers import ModelLayer
from caffe2.python.layers.sampling_trainable_mixin impor... | pytorch-master | caffe2/python/layers/fc_with_bootstrap.py |
# Module caffe2.python.layers.dropout
from caffe2.python import schema
from caffe2.python.layers.layers import ModelLayer
class Dropout(ModelLayer):
def __init__(
self,
model,
input_record,
name='dropout',
ratio=0.5,
dropout_for_eval=Fa... | pytorch-master | caffe2/python/layers/dropout.py |
## @package conv
# Module caffe2.python.layers.conv
from caffe2.python import schema
from caffe2.python.layers.layers import (
ModelLayer,
)
import numpy as np
class Conv(ModelLayer):
"""
Convolutional layer
Input:
- input_record: at least has the shape info of C (num_channels)
... | pytorch-master | caffe2/python/layers/conv.py |
## @package layers
# Module caffe2.python.layers.layers
import logging
from collections import namedtuple
import numpy as np
from caffe2.proto import caffe2_pb2
from caffe2.python import core, schema, scope, utils, workspace
from caffe2.python.layers.tags import TagContext
logger = logging.getLogger(__name__)
logg... | pytorch-master | caffe2/python/layers/layers.py |
from caffe2.python import schema
from caffe2.python.layers.layers import (
IdList,
ModelLayer,
)
# Model layer for implementing probabilistic replacement of elements in
# IdLists. Takes probabilities for train, eval and predict nets as input, as
# well as the replacement value when dropout happens. For ... | pytorch-master | caffe2/python/layers/sparse_dropout_with_replacement.py |
## @package batch_mse_loss
# Module caffe2.python.layers.batch_mse_loss
from caffe2.python import core, schema
from caffe2.python.layers.layers import (
ModelLayer,
)
from caffe2.python.layers.tags import (
Tags
)
import numpy as np
class BatchMSELoss(ModelLayer):
def __init__(self, model, input_rec... | pytorch-master | caffe2/python/layers/batch_mse_loss.py |
# @package constant_weight
# Module caffe2.fb.python.layers.constant_weight
from caffe2.python import schema
from caffe2.python.layers.layers import ModelLayer
import numpy as np
class ConstantWeight(ModelLayer):
def __init__(
self,
model,
input_record,
weights=None,
n... | pytorch-master | caffe2/python/layers/constant_weight.py |
## @package uniform_sampling
# Module caffe2.python.layers.uniform_sampling
import numpy as np
from caffe2.python import core, schema
from caffe2.python.layers.layers import ModelLayer
class UniformSampling(ModelLayer):
"""
Uniform sampling `num_samples - len(input_record)` unique elements from the
... | pytorch-master | caffe2/python/layers/uniform_sampling.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"... | pytorch-master | caffe2/python/test/do_op_test.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... | pytorch-master | caffe2/python/test/executor_test_util.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... | pytorch-master | caffe2/python/test/gpu_context_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... | pytorch-master | caffe2/python/test/executor_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.... | pytorch-master | caffe2/python/test/inference_lstm_op_test.py |
from caffe2.python import core, workspace
import unittest
core.GlobalInit(['python'])
class BlobDeallocationTest(unittest.TestCase):
def test(self):
net = core.Net('net')
x = net.GivenTensorStringFill([], ['x'], shape=[3], values=['a', 'b', 'c'])
y = net.GivenTensorStringFill([], ['y... | pytorch-master | caffe2/python/test/blob_deallocation_test.py |
pytorch-master | caffe2/python/test/__init__.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... | pytorch-master | caffe2/python/test/fakefp16_transform_test.py |
# make sure we use cpp implementation of protobuf
import os
os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "cpp"
# then import protobuf
from caffe2.proto import caffe2_pb2, metanet_pb2
import unittest
class TestCrossProtoCalls(unittest.TestCase):
def testSimple(self):
net = caffe2_pb2.NetDef(... | pytorch-master | caffe2/python/test/python_protobuf_test.py |
## @package onnx
# Module caffe2.python.onnx.backend_rep_cpp
from onnx.backend.base import BackendRep, namedtupledict
# This is a wrapper around C++ Caffe2BackendRep,
# mainly to handle the different input and output types for convenience of Python
class Caffe2CppRep(BackendRep):
def __init__(self, cpp_rep):... | pytorch-master | caffe2/python/onnx/backend_cpp_rep.py |
## @package onnx
# Module caffe2.python.onnx.backend
"""Backend for running ONNX on Caffe2
To run this, you will need to have Caffe2 installed as well.
"""
import collections
import sys
import zipfile
import itertools
# When onnx is built against a version of protobuf that is older than
# that which is vendored with... | pytorch-master | caffe2/python/onnx/backend.py |
## @package onnx
# Module caffe2.python.onnx.error
class BaseException(Exception): pass
class Unsupported(BaseException): pass
| pytorch-master | caffe2/python/onnx/error.py |
## @package onnx
# Module caffe2.python.onnx.frontend
"""Caffe2 Protobuf to ONNX converter
To run this, you will need to have Caffe2 installed as well.
"""
import collections
import itertools
import logging
import re
from caffe2.python import core as caffe2_core
from onnx import (checker, helper, numpy_helper, ... | pytorch-master | caffe2/python/onnx/frontend.py |
pytorch-master | caffe2/python/onnx/__init__.py | |
## @package onnx
# Module caffe2.python.onnx.helper
from caffe2.proto import caffe2_pb2
from onnx.backend.base import namedtupledict
from caffe2.python.onnx.workspace import Workspace
import logging
import time
log = logging.getLogger(__name__)
def c2_native_run_op(op_def, inputs):
ws = Workspace()
if... | pytorch-master | caffe2/python/onnx/helper.py |
## @package onnx
# Module caffe2.python.onnx.workspace
import uuid
from caffe2.python import workspace
# Separating out the context manager part so that users won't
# (mis-)use Workspace instances as context managers
class _WorkspaceCtx(object):
def __init__(self, workspace_id):
self.workspace_id = ... | pytorch-master | caffe2/python/onnx/workspace.py |
# @package onnx
# Module caffe2.python.onnx.backend_rep
from caffe2.python import core
from caffe2.proto import caffe2_pb2
from onnx.backend.base import BackendRep, namedtupledict
class Caffe2Rep(BackendRep):
def __init__(self, init_net, predict_net, workspace, uninitialized):
super(Caffe2Rep, self)._... | pytorch-master | caffe2/python/onnx/backend_rep.py |
## @package onnx
#Module caffe2.python.onnx.onnxifi
"""
ONNXIFI a Caffe2 net
"""
from caffe2.proto import caffe2_pb2
import caffe2.python._import_c_extension as C
def onnxifi_set_option(option_name, option_value):
"""
Set onnxifi option
"""
return C.onnxifi_set_option(option_name, str(option_value))... | pytorch-master | caffe2/python/onnx/onnxifi.py |
import numpy as np
import time
import unittest
import onnx
import onnx.defs
from onnx.backend.base import namedtupledict
from onnx.helper import make_node, make_graph, make_tensor_value_info, make_model
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
from caffe2.python.models.downloa... | pytorch-master | caffe2/python/onnx/test_onnxifi.py |
## @package onnx
# Module caffe2.python.onnx.bin.conversion
import json
from caffe2.proto import caffe2_pb2
import click
from onnx import ModelProto
from caffe2.python.onnx.backend import Caffe2Backend as c2
import caffe2.python.onnx.frontend as c2_onnx
@click.command(
help='convert caffe2 net to onnx mode... | pytorch-master | caffe2/python/onnx/bin/conversion.py |
pytorch-master | caffe2/python/onnx/bin/__init__.py | |
# @package onnx
# Module caffe2.python.onnx.tests.onnx_backend_test
import os
import unittest
import onnx.backend.test
import caffe2.python.onnx.backend as c2
from caffe2.python import core
core.SetEnginePref({}, {})
# This is a pytest magic variable to load extra plugins
pytest_plugins = 'onnx.backend.test.r... | pytorch-master | caffe2/python/onnx/tests/onnx_backend_test.py |
## @package onnx
# Module caffe2.python.onnx.tests.test_utils
import unittest
import numpy as np
class TestCase(unittest.TestCase):
def setUp(self):
np.random.seed(seed=0)
def assertSameOutputs(self, outputs1, outputs2, decimal=7):
self.assertEqual(len(outputs1), len(outputs2))
... | pytorch-master | caffe2/python/onnx/tests/test_utils.py |
## @package onnx
# Module caffe2.python.onnx.tests.helper_test
import unittest
from caffe2.python.onnx.tests.test_utils import TestCase
import caffe2.python._import_c_extension as C
class TestCaffe2Basic(TestCase):
def test_dummy_name(self):
g = C.DummyName()
g.reset()
names_1 = [g.... | pytorch-master | caffe2/python/onnx/tests/helper_test.py |
## @package onnx
# Module caffe2.python.onnx.tests.ssa_test
import copy
import numpy as np
from caffe2.proto import caffe2_pb2
from caffe2.python import core
from onnx import TensorProto
import caffe2.python.onnx.frontend as c2_onnx
from caffe2.python.onnx.helper import c2_native_run_net
from caffe2.python.onnx.... | pytorch-master | caffe2/python/onnx/tests/ssa_test.py |
pytorch-master | caffe2/python/onnx/tests/__init__.py | |
## @package onnx
# Module caffe2.python.onnx.tests.conversion_test
import json
import tempfile
import textwrap
import traceback
import unittest
import zipfile
from caffe2.proto import caffe2_pb2
from caffe2.python import brew, core
from caffe2.python.model_helper import ModelHelper
from click.testing import CliRu... | pytorch-master | caffe2/python/onnx/tests/conversion_test.py |
# @package onnx
# Module caffe2.python.onnx.tests.c2_ref_test
import os
import unittest
from caffe2.python import core
from caffe2.proto import caffe2_pb2
import onnx
from onnx.helper import make_node, make_graph, make_tensor, make_tensor_value_info, make_model
from caffe2.python.onnx.helper import c2_native_ru... | pytorch-master | caffe2/python/onnx/tests/c2_ref_test.py |
###################################################################################################
# ATTENTION! This test will most probably fail if you install TensorRT 6.0.1 only.
# That's because it's shipped with older version of ONNX parser not supporting some
# required features. To make it work please use new v... | pytorch-master | caffe2/python/trt/test_pt_onnx_trt.py |
pytorch-master | caffe2/python/trt/__init__.py | |
## @package onnx
#Module caffe2.python.trt.transform
"""
TensorRT related transformation
Note that ONNX-TRT enforce an NCHW input!
"""
from caffe2.proto import caffe2_pb2
from caffe2.python import workspace
import caffe2.python._import_c_extension as C
import numpy as np
def _dim_values_to_list(dim_values):
... | pytorch-master | caffe2/python/trt/transform.py |
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
import onnx
import onnx.defs
from onnx.helper import make_node, make_graph, make_tensor_value_info, make_model
from onnx.backend.base import namedtupledict
from caffe2.python.models.download import ModelDownloader
import caffe2.python.on... | pytorch-master | caffe2/python/trt/test_trt.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... | pytorch-master | caffe2/python/operator_test/storm_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):
... | pytorch-master | caffe2/python/operator_test/matmul_op_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:
... | pytorch-master | caffe2/python/operator_test/rebatching_queue_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, ... | pytorch-master | caffe2/python/operator_test/moments_op_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... | pytorch-master | caffe2/python/operator_test/basic_rnn_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 TestListwiseL2rOps(hu.HypothesisTestCase):
def ref_lambda_rank_loss(
self, y, r, use_ndcg_as_loss, use_idcg_normalization, us... | pytorch-master | caffe2/python/operator_test/listwise_l2r_operator_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... | pytorch-master | 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.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... | pytorch-master | caffe2/python/operator_test/merge_id_lists_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... | pytorch-master | caffe2/python/operator_test/softplus_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)... | pytorch-master | caffe2/python/operator_test/flatten_op_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):
... | pytorch-master | caffe2/python/operator_test/reduction_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
import unittest
class TestCTCGreedyDecoderOp(serial.SerializedTestCase):
... | pytorch-master | caffe2/python/operator_test/ctc_greedy_decoder_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... | pytorch-master | caffe2/python/operator_test/bucketize_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... | pytorch-master | caffe2/python/operator_test/clip_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
... | pytorch-master | caffe2/python/operator_test/spatial_bn_op_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... | pytorch-master | caffe2/python/operator_test/deform_conv_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... | pytorch-master | caffe2/python/operator_test/locally_connected_op_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),
... | pytorch-master | caffe2/python/operator_test/sparse_gradient_checker_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):
... | pytorch-master | caffe2/python/operator_test/math_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 numpy as np
import unittest
class TestTrigonometricOp(serial.SerializedTestCase):
@given(
X=hu.tensor(eleme... | pytorch-master | caffe2/python/operator_test/trigonometric_op_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... | pytorch-master | caffe2/python/operator_test/instance_norm_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, ... | pytorch-master | caffe2/python/operator_test/emptysample_ops_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... | pytorch-master | caffe2/python/operator_test/assert_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... | pytorch-master | caffe2/python/operator_test/hsm_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... | pytorch-master | caffe2/python/operator_test/reduce_ops_test.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... | pytorch-master | caffe2/python/operator_test/conftest.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... | pytorch-master | caffe2/python/operator_test/momentum_sgd_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... | pytorch-master | caffe2/python/operator_test/ensure_cpu_output_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 = ... | pytorch-master | caffe2/python/operator_test/percentile_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... | pytorch-master | caffe2/python/operator_test/rms_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
import hypothesis.strategies as st
import numpy as np
class TestConditionalOp(serial.SerializedTestCase):
@serial.given(rows_num=st.integers(1, 10000), **hu.gcs_cp... | pytorch-master | caffe2/python/operator_test/conditional_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... | pytorch-master | caffe2/python/operator_test/python_op_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... | pytorch-master | caffe2/python/operator_test/map_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... | pytorch-master | caffe2/python/operator_test/one_hot_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
import math
MAX_TEST_EMBEDDING_SIZE = 20
MAX_TEST_SEQUENCE_LENGTH = 10
MAX... | pytorch-master | caffe2/python/operator_test/sinusoid_position_encoding_op_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_... | pytorch-master | caffe2/python/operator_test/histogram_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... | pytorch-master | caffe2/python/operator_test/group_norm_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
from hypothesis import given, settings
from hypothesis import strategies as st
import numpy as np
import time
class TestTensorPackOps(serial.SerializedTes... | pytorch-master | caffe2/python/operator_test/pack_ops_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
... | pytorch-master | caffe2/python/operator_test/fc_operator_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... | pytorch-master | caffe2/python/operator_test/dropout_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)... | pytorch-master | caffe2/python/operator_test/data_couple_op_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... | pytorch-master | caffe2/python/operator_test/top_k_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,
... | pytorch-master | caffe2/python/operator_test/decay_adagrad_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 =... | pytorch-master | caffe2/python/operator_test/wngrad_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... | pytorch-master | caffe2/python/operator_test/copy_rows_to_tensor_op_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):
... | pytorch-master | caffe2/python/operator_test/text_file_reader_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(... | pytorch-master | caffe2/python/operator_test/floor_op_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),
... | pytorch-master | caffe2/python/operator_test/im2col_col2im_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], [... | pytorch-master | caffe2/python/operator_test/scale_op_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
... | pytorch-master | caffe2/python/operator_test/stats_ops_test.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.