python_code stringlengths 0 1.02M | repo_name stringlengths 9 48 | file_path stringlengths 5 114 |
|---|---|---|
# Owner(s): ["module: __torch_dispatch__"]
import tempfile
import torch
from copy import deepcopy
from torch.library import Library
from torch.cuda.jiterator import _create_jit_fn
import unittest
from torch.testing._internal.common_utils import TestCase, run_tests, TEST_WITH_ROCM, IS_WINDOWS
from torch.utils._mode_uti... | pytorch-master | test/test_python_dispatch.py |
# Owner(s): ["oncall: r2p"]
from torch.testing._internal.common_utils import (
TestCase, run_tests,
)
from datetime import timedelta, datetime
import tempfile
import time
from torch.monitor import (
Aggregation,
Event,
log_event,
register_event_handler,
unregister_event_handler,
Stat,
... | pytorch-master | test/test_monitor.py |
# Owner(s): ["module: dataloader"]
import copy
import itertools
import os
import os.path
import pickle
import random
import sys
import tempfile
import warnings
from functools import partial
from typing import (
Any,
Awaitable,
Dict,
Generic,
Iterator,
List,
NamedTuple,
Optional,
Set... | pytorch-master | test/test_datapipe.py |
# -*- coding: utf-8 -*-
# Owner(s): ["module: linear algebra"]
import torch
import numpy as np
import unittest
import itertools
import warnings
import math
from math import inf, nan, isnan
import random
from random import randrange
from itertools import product
from functools import reduce, partial, wraps
from torch... | pytorch-master | test/test_linalg.py |
# Owner(s): ["module: mkldnn"]
import copy
import itertools
import functools
import unittest
try:
import torchvision
HAS_TORCHVISION = True
except ImportError:
HAS_TORCHVISION = False
skipIfNoTorchVision = unittest.skipIf(not HAS_TORCHVISION, "no torchvision")
import torch
import torch.nn.functional as ... | pytorch-master | test/test_mkldnn.py |
# Owner(s): ["module: unknown"]
import sys
import os
import re
import shutil
import random
import subprocess
import tempfile
import textwrap
import unittest
from typing import List
import torch
import torch.nn as nn
import torch.utils.data
from torch.utils.data import DataLoader
import torch.cuda
from torch.utils.chec... | pytorch-master | test/test_utils.py |
from _pytest.junitxml import LogXML, _NodeReporter, bin_xml_escape
from _pytest.terminal import _get_raw_skip_reason
from _pytest.stash import StashKey
from _pytest.reports import TestReport
from _pytest.config.argparsing import Parser
from _pytest.config import filename_arg
from _pytest.config import Config
from _pyte... | pytorch-master | test/conftest.py |
# Owner(s): ["module: tests"]
import torch
import numpy as np
import random
from torch._six import nan
from itertools import permutations, product
from torch.testing import make_tensor
from torch.testing._internal.common_dtype import all_types, all_types_and, floating_types_and
from torch.testing._internal.common_ut... | pytorch-master | test/test_sort_and_select.py |
# Owner(s): ["module: dataloader"]
import math
import sys
import errno
import os
import ctypes
import faulthandler
import torch
import gc
import time
import signal
import unittest
import itertools
import warnings
import tempfile
from torch import multiprocessing as mp
from torch.utils.data import (
ChainDataset,
... | pytorch-master | test/test_dataloader.py |
# Owner(s): ["module: fx.passes"]
from dataclasses import dataclass
import operator
import logging
import torch
from torch.fx._symbolic_trace import symbolic_trace
from torch.fx.passes.infra.partitioner import CapabilityBasedPartitioner
from torch.fx.passes.operator_support import OperatorSupport
from torch.fx.passe... | pytorch-master | test/test_fx_passes.py |
# Owner(s): ["module: unknown"]
import collections
import torch
from torch.testing._internal.common_utils import TestCase, run_tests
from torch.testing._internal.autocast_test_lists import AutocastCPUTestLists
class TestAutocastCPU(TestCase):
def setUp(self):
super(TestAutocastCPU, self).setUp()
s... | pytorch-master | test/test_autocast.py |
# Owner(s): ["module: unknown"]
import unittest
from typing import Dict, Optional
import numpy as np
import torch
from torch import nn
from torch.testing._internal.common_utils import TestCase, run_tests
from typing import List
class StaticModule:
def __init__(self, scripted):
# this is an nn.Module
... | pytorch-master | test/test_static_runtime.py |
# Owner(s): ["module: tests"]
import torch
import numpy as np
import math
from typing import Dict, List, Sequence
import random
from functools import partial
from itertools import product, combinations, permutations
import warnings
from torch._six import inf, nan
from torch.testing import make_tensor
from torch.test... | pytorch-master | test/test_reductions.py |
# Owner(s): ["module: codegen"]
import torch
from torch.testing._internal.common_utils import TestCase, run_tests, skipIfTorchDynamo, TEST_WITH_TORCHDYNAMO
from torch.testing._internal.logging_tensor import LoggingTensor, capture_logs
from torch.utils._pytree import tree_map
from torch.fx.experimental.proxy_tensor imp... | pytorch-master | test/test_functionalization.py |
# Owner(s): ["module: primTorch"]
from collections import defaultdict
from torch import Tensor
import torch.autograd
from torch.utils._python_dispatch import enable_torch_dispatch_mode
from torch._decomp import decomposition_table
from torch.utils._pytree import tree_map, tree_flatten, tree_unflatten
from torch.utils... | pytorch-master | test/test_decomp.py |
# Owner(s): ["module: unknown"]
import hypothesis.strategies as st
from hypothesis import given
import numpy as np
import torch
from torch.testing._internal.common_utils import TestCase
import torch.testing._internal.hypothesis_utils as hu
hu.assert_deadline_disabled()
class PruningOpTest(TestCase):
# Generate ... | pytorch-master | test/test_pruning_op.py |
# Owner(s): ["module: unknown"]
from functools import partial
from textwrap import dedent
import torch
from torch.testing import FileCheck
from torch.testing._internal.common_utils import \
(run_tests, IS_SANDCASTLE, clone_input_helper, first_sample, skipIfSlowGradcheckEnv)
from torch.testing._internal.common_me... | pytorch-master | test/test_ops_jit.py |
# Owner(s): ["oncall: package/deploy"]
def load_tests(loader, standard_tests, pattern):
"""Load all tests from `test/pacakge/`
"""
if pattern is None:
# Use the default pattern if none is specified by the test loader.
pattern = "test*.py"
package_tests = loader.discover("package", patte... | pytorch-master | test/test_package.py |
# Owner(s): ["oncall: jit"]
import sys
sys.argv.append("--jit_executor=legacy")
from test_jit import * # noqa: F403
if __name__ == '__main__':
run_tests()
| pytorch-master | test/test_jit_legacy.py |
# Owner(s): ["module: unknown"]
import torch
from torch.testing._internal.common_utils import TestCase, run_tests
class LoggingTest(TestCase):
def testApiUsage(self):
"""
This test verifies that api usage logging is not triggered via static
initialization. Since it's triggered at first in... | pytorch-master | test/test_logging.py |
# Owner(s): ["oncall: jit"]
import sys
import os
import contextlib
import subprocess
from torch.testing._internal.common_utils import TestCase, run_tests, TemporaryFileName
@contextlib.contextmanager
def _jit_disabled():
cur_env = os.environ.get("PYTORCH_JIT", "1")
os.environ["PYTORCH_JIT"] = "0"
try:
... | pytorch-master | test/test_jit_disabled.py |
# Owner(s): ["NNC"]
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
import unittest
import itertools
from torch.testing._internal.common_utils import suppress_warnings, num_profiled_runs, run_tests
from torch.testing._internal.jit_utils import JitTestCase, TensorExprTestOptions
... | pytorch-master | test/test_tensorexpr.py |
# Owner(s): ["module: type promotion"]
from functools import (partial, wraps)
import itertools
import unittest
import torch
from torch.testing._internal.common_utils import (TestCase, run_tests, load_tests, make_tensor,
TEST_NUMPY, torch_to_numpy_dtype_dict, numpy_to... | pytorch-master | test/test_type_promotion.py |
# Owner(s): ["module: unknown"]
import torch
import copy
from torch.testing._internal.common_utils import TestCase, run_tests
class TestPerOverloadAPI(TestCase):
def test_basics_opoverloadpacket(self):
# add is ony used as an example here. It is ok to update the test
# if the semantics of add are m... | pytorch-master | test/test_per_overload_api.py |
# Owner(s): ["module: ci"]
from torch.testing._internal.common_utils import TestCase, run_tests
# these tests could eventually be changed to fail if the import/init
# time is greater than a certain threshold, but for now we just use them
# as a way to track the duration of `import torch`.
class TestImportTime(TestCa... | pytorch-master | test/test_import_stats.py |
# Owner(s): ["module: sparse"]
import torch
import itertools
import functools
import operator
import random
import unittest
from torch.testing import make_tensor
from torch.testing._internal.common_utils import TestCase, run_tests, skipIfRocm, do_test_dtypes, \
do_test_empty_full, load_tests, TEST_NUMPY, TEST_SCIP... | pytorch-master | test/test_sparse.py |
#!/usr/bin/env python3
# Owner(s): ["oncall: mobile"]
import sys
import os
import io
import functools
import tempfile
import urllib
import unittest
import torch
import torch.backends.xnnpack
import torch.utils.model_dump
import torch.utils.mobile_optimizer
from torch.testing._internal.common_utils import TestCase, ru... | pytorch-master | test/test_model_dump.py |
# Owner(s): ["module: ProxyTensor"]
from torch.testing._internal.common_utils import TestCase, run_tests
import torch
import unittest
import warnings
import torch.nn.utils._stateless as stateless
from collections.abc import Iterable
from torch.testing._internal.common_device_type import instantiate_device_type_tests
f... | pytorch-master | test/test_proxy_tensor.py |
# Owner(s): ["module: hub"]
import unittest
from unittest.mock import patch
import os
import tempfile
import warnings
import torch
import torch.hub as hub
from torch.testing._internal.common_utils import retry, IS_SANDCASTLE, TestCase
def sum_of_state_dict(state_dict):
s = 0
for _, v in state_dict.items():
... | pytorch-master | test/test_hub.py |
# Owner(s): ["module: named tensor"]
import unittest
from torch.testing._internal.common_utils import TestCase, run_tests, TEST_NUMPY
from torch.testing._internal.common_cuda import TEST_CUDA
from torch.testing._internal.common_device_type import get_all_device_types
from collections import namedtuple, OrderedDict
imp... | pytorch-master | test/test_namedtensor.py |
# Owner(s): ["oncall: mobile"]
import unittest
import torch
import torch.nn as nn
import torch.utils.bundled_inputs
from torch.testing._internal.common_utils import TestCase, run_tests, skipIfNoXNNPACK
from torch.testing._internal.jit_utils import get_forward, get_forward_graph
from torch.utils.mobile_optimizer import... | pytorch-master | test/test_mobile_optimizer.py |
# Owner(s): ["module: nn"]
import inspect
import torch
from unittest import mock
from unittest.mock import MagicMock, patch
from torch.testing import floating_types
from torch.testing._internal.common_device_type import instantiate_device_type_tests, dtypes
from torch.testing._internal.common_quantization import skipI... | pytorch-master | test/test_module_init.py |
# Owner(s): ["oncall: mobile"]
import torch
from torch.nn import functional as F
from torch.testing._internal.common_utils import TestCase, run_tests
from torch.testing import FileCheck
import io
class TestMetalRewritePass(TestCase):
@staticmethod
def validate_transformed_module(
# To please flak... | pytorch-master | test/test_metal.py |
# Owner(s): ["module: unknown"]
import os
import re
import yaml
import textwrap
import torch
from torch.testing._internal.common_utils import TestCase, run_tests
from collections import namedtuple
path = os.path.dirname(os.path.realpath(__file__))
aten_native_yaml = os.path.join(path, '../aten/src/ATen/native/nativ... | pytorch-master | test/test_namedtuple_return_api.py |
# Owner(s): ["module: nn"]
from dataclasses import dataclass
from functools import partial
from itertools import product, chain
import unittest
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss
from torch.nn.utils._per_sample_grad import call_for_per_sample_grads
... | pytorch-master | test/test_expanded_weights.py |
# Owner(s): ["oncall: jit"]
import contextlib
import unittest
import os
import random
import enum
import copy
from functools import reduce
import operator
import warnings
import torch
from torch.nn import functional
from torch.profiler import profile, ProfilerActivity
from torch.testing._internal.codegen.random_topo... | pytorch-master | test/test_jit_cuda_fuser.py |
# Owner(s): ["module: unknown"]
import unittest
import torch.testing._internal.common_utils as common
from torch.testing._internal.common_utils import TEST_NUMPY
from torch.testing._internal.common_cuda import TEST_NUMBA_CUDA, TEST_CUDA, TEST_MULTIGPU
import torch
if TEST_NUMPY:
import numpy
if TEST_NUMBA_CUDA... | pytorch-master | test/test_numba_integration.py |
# Owner(s): ["module: cpp"]
import torch
# NN tests use double as the default dtype
torch.set_default_dtype(torch.double)
import os
import torch.testing._internal.common_utils as common
import torch.testing._internal.common_nn as common_nn
from cpp_api_parity.parity_table_parser import parse_parity_tracker_table
fro... | pytorch-master | test/test_cpp_api_parity.py |
import torch
class LinearMod(torch.nn.Linear):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def forward(self, input):
return torch._C._nn.linear(input, self.weight, self.bias)
print(torch.jit.trace(LinearMod(20, 20), torch.rand([20, 20])).graph)
| pytorch-master | test/linear.py |
# Owner(s): ["module: multiprocessing"]
import os
import pickle
import random
import signal
import sys
import time
import unittest
from torch.testing._internal.common_utils import (TestCase, run_tests, IS_WINDOWS, NO_MULTIPROCESSING_SPAWN)
import torch.multiprocessing as mp
def _test_success_func(i):
pass
def... | pytorch-master | test/test_multiprocessing_spawn.py |
# Owner(s): ["module: multiprocessing"]
import contextlib
import gc
import os
import sys
import time
import unittest
import copy
from sys import platform
import torch
import torch.cuda
import torch.multiprocessing as mp
import torch.utils.hooks
from torch.nn import Parameter
from torch.testing._internal.common_utils ... | pytorch-master | test/test_multiprocessing.py |
# Owner(s): ["oncall: jit"]
import os
import sys
import torch
from torch.utils._pytree import tree_map
from torch.testing._internal.common_utils import run_tests
from torch.fx.operator_schemas import normalize_function
from torch.testing._internal.schema_check_mode import SchemaCheckMode
from torch.utils._python_disp... | pytorch-master | test/test_schema_check.py |
# Owner(s): ["module: typing"]
# based on NumPy numpy/typing/tests/test_typing.py
import itertools
import os
import re
import shutil
from collections import defaultdict
from typing import IO, Dict, List, Optional
import pytest
try:
from mypy import api
except ImportError:
NO_MYPY = True
else:
NO_MYPY = F... | pytorch-master | test/test_typing.py |
# Owner(s): ["oncall: mobile"]
import unittest
import torch
import torch.backends.xnnpack
from torch.nn import functional as F
from torch.utils.mobile_optimizer import optimize_for_mobile
from torch.testing import FileCheck
import torch.testing._internal.hypothesis_utils as hu
from torch.testing._internal.common_util... | pytorch-master | test/test_xnnpack_integration.py |
#!/usr/bin/env python3
# Owner(s): ["oncall: mobile"]
import io
import textwrap
from typing import List, Optional, Dict
import torch
import torch.utils.bundled_inputs
from torch.testing._internal.common_utils import TestCase, run_tests
def model_size(sm):
buffer = io.BytesIO()
torch.jit.save(sm, buffer)
... | pytorch-master | test/test_bundled_inputs.py |
# -*- coding: utf-8 -*-
# Owner(s): ["module: tests"]
import torch
import torch.utils.data
import numpy as np
import contextlib
import gc
import io
import inspect
import itertools
import math
import random
import re
import copy
import os
import tempfile
import unittest
import warnings
import types
import pickle
impor... | pytorch-master | test/test_torch.py |
# Owner(s): ["module: cpp-extensions"]
import os
import shutil
import sys
import unittest
import torch.testing._internal.common_utils as common
from torch.testing._internal.common_utils import IS_ARM64
import torch
import torch.utils.cpp_extension
from torch.utils.cpp_extension import CUDA_HOME, ROCM_HOME
TEST_CUDA... | pytorch-master | test/test_cpp_extensions_open_device_registration.py |
# Owner(s): ["module: tests"]
import torch
import numpy as np
import math
from numbers import Number
import random
import unittest
from torch._six import inf, nan
from torch.testing._internal.common_utils import (
TestCase,
run_tests,
torch_to_numpy_dtype_dict,
numpy_to_torch_dtype_dict,
suppress... | pytorch-master | test/test_unary_ufuncs.py |
# Owner(s): ["module: unknown"]
import threading
import time
import torch
import unittest
from torch.futures import Future
from torch.testing._internal.common_utils import IS_WINDOWS, TestCase, TemporaryFileName, run_tests
from typing import TypeVar
T = TypeVar("T")
def add_one(fut):
return fut.wait() + 1
cla... | pytorch-master | test/test_futures.py |
# Owner(s): ["module: tensor creation"]
import torch
import numpy as np
import sys
import math
import warnings
import unittest
from itertools import product, combinations, combinations_with_replacement, permutations
import random
from torch.testing import make_tensor
from torch.testing._internal.common_utils import ... | pytorch-master | test/test_tensor_creation_ops.py |
#!/usr/bin/env python3
# Owner(s): ["oncall: mobile"]
import torch
import torch.utils.bundled_inputs
import io
import cv2
from torch.testing._internal.common_utils import TestCase
torch.ops.load_library("//caffe2/torch/fb/operators:decode_bundled_image")
def model_size(sm):
buffer = io.BytesIO()
torch.jit.sa... | pytorch-master | test/test_bundled_images.py |
# -*- coding: utf-8 -*-
# Owner(s): ["oncall: jit"]
from torch._C import _disabled_torch_function_impl
import torch.fx
import torch.nn.functional as F
from torch.testing._internal.common_utils import run_tests, TestCase
import unittest
import torch
import operator
import itertools
from torch.utils._pytree import tree_... | pytorch-master | test/test_dynamic_shapes.py |
# Owner(s): ["module: optimizer"]
import warnings
import math
import unittest
import functools
import itertools
from copy import deepcopy
import torch
from torch._six import inf
import torch.optim as optim
import torch.optim._multi_tensor as optim_mt
import torch.nn.functional as F
from torch.optim import SGD
from to... | pytorch-master | test/test_optim.py |
# Owner(s): ["NNC"]
import operator
import os
import unittest
import contextlib
import math
import torch
import torch.nn.functional as F
from torch.testing import FileCheck
from typing import List
import warnings
# these needs to be set before `common_utils`
# infers `GRAPH_EXECUTOR`.
# this file **requires** these s... | pytorch-master | test/test_jit_fuser_te.py |
# Owner(s): ["module: nn"]
import contextlib
import math
import random
import string
import unittest
import io
import unittest.mock as mock
import itertools
import warnings
import pickle
from copy import deepcopy
from itertools import repeat, product
from functools import reduce, partial
from operator import mul
from ... | pytorch-master | test/test_nn.py |
# Owner(s): ["oncall: mobile"]
import unittest
import io
import tempfile
import torch
import torch.utils.show_pickle
from torch.testing._internal.common_utils import TestCase, run_tests, IS_WINDOWS
class TestShowPickle(TestCase):
@unittest.skipIf(IS_WINDOWS, "Can't re-open temp file on Windows")
def test_sc... | pytorch-master | test/test_show_pickle.py |
# Owner(s): ["module: unknown"]
from torch.testing._internal.common_utils import TestCase, run_tests
from torch.testing._internal.check_kernel_launches import (
check_cuda_kernel_launches, check_code_for_cuda_kernel_launches
)
class AlwaysCheckCudaLaunchTest(TestCase):
def test_check_code(self):
"""V... | pytorch-master | test/test_kernel_launch_checks.py |
# Owner(s): ["module: tests"]
import torch
import numpy as np
from itertools import product, combinations, permutations, chain
from functools import partial
import random
import warnings
from torch._six import nan
from torch.testing import make_tensor
from torch.testing._internal.common_utils import (
TestCase, ... | pytorch-master | test/test_shape_ops.py |
#!/usr/bin/env python3
# Owner(s): ["oncall: mobile"]
import os
import ctypes
import torch
import unittest
from typing import Tuple
from torch.backends._nnapi.prepare import convert_model_to_nnapi
from torch.testing._internal.common_quantized import supported_qengines
from torch.testing._internal.common_utils import T... | pytorch-master | test/test_nnapi.py |
# Owner(s): ["module: nn"]
import tempfile
import torch
from copy import deepcopy
from functools import partial
from torch import nn
from torch.nn.utils.parametrize import register_parametrization, remove_parametrizations
from torch.nn.modules.lazy import LazyModuleMixin
from torch.testing._internal.common_utils impor... | pytorch-master | test/test_subclass.py |
# -*- coding: utf-8 -*-
# Owner(s): ["oncall: jit"]
import torch
# This is how we include tests located in test/jit/...
# They are included here so that they are invoked when you call `test_jit.py`,
# do not run these test files directly.
from jit.test_tracer import TestTracer, TestMixTracingScripting # noqa: F401
f... | pytorch-master | test/test_jit.py |
# Owner(s): ["module: unknown"]
from torch.testing._internal.common_utils import TestCase, run_tests
import os
import subprocess
import sys
class TestMKLDNNVerbose(TestCase):
def test_verbose_on(self):
num = 0
loc = os.path.dirname(os.path.abspath(__file__))
with subprocess.Popen(f'{sys.ex... | pytorch-master | test/test_mkldnn_verbose.py |
# Owner(s): ["module: nn"]
import math
import torch
from torch.testing._internal.common_device_type import (
dtypes,
dtypesIfCUDA,
instantiate_device_type_tests,
onlyCUDA,
skipMeta,
)
from torch.testing._internal.common_utils import run_tests, TestCase
class TestMHADeviceType(TestCase):
@torch... | pytorch-master | test/test_native_mha.py |
# -*- coding: utf-8 -*-
# Owner(s): ["module: autograd"]
from torch.testing._internal.common_utils import TestCase, run_tests, IS_WINDOWS
import pkgutil
import torch
import sys
from typing import Callable
import inspect
import json
import os
import unittest
class TestPublicBindings(TestCase):
def test_no_new_bind... | pytorch-master | test/test_public_bindings.py |
# Owner(s): ["module: pytree"]
import torch
from torch.testing._internal.common_utils import TestCase, run_tests
from torch.utils._pytree import tree_flatten, tree_map, tree_unflatten, TreeSpec, LeafSpec
from torch.utils._pytree import _broadcast_to_and_flatten, tree_map_only, tree_all
from torch.utils._pytree import ... | pytorch-master | test/test_pytree.py |
# Owner(s): ["module: tests"]
import torch
import numpy as np
import unittest
from itertools import product, permutations, combinations
from functools import partial
import random
from torch.testing import make_tensor
from torch.testing._internal.common_utils import (
TestCase, run_tests, suppress_warnings, gradc... | pytorch-master | test/test_view_ops.py |
# Owner(s): ["module: tests"]
import torch
from torch import tensor
import unittest
import warnings
import random
from functools import reduce
import numpy as np
from torch.testing import make_tensor
from torch.testing._internal.common_utils import TestCase, run_tests
from torch.testing._internal.common_device_type... | pytorch-master | test/test_indexing.py |
# Owner(s): ["oncall: jit"]
import sys
sys.argv.append("--jit_executor=legacy")
from test_jit_fuser import * # noqa: F403
if __name__ == '__main__':
run_tests()
| pytorch-master | test/test_jit_fuser_legacy.py |
# Owner(s): ["module: cuda"]
import torch
from torch.testing._internal.common_utils import TestCase, run_tests, skipIfRocmVersionLessThan
import sys
import unittest
# NOTE: this needs to be run in a brand new process
# We cannot import TEST_CUDA and TEST_MULTIGPU from torch.testing._internal.common_cuda here,
# beca... | pytorch-master | test/test_cuda_primary_ctx.py |
# Owner(s): ["module: cuda"]
import torch
from torch.cuda.jiterator import _create_jit_fn as create_jit_fn
from torch.cuda.jiterator import _create_multi_output_jit_fn as create_multi_output_jit_fn
import sys
from itertools import product
from torch.testing._internal.common_utils import TestCase, parametrize, run_test... | pytorch-master | test/test_jiterator.py |
# -*- coding: utf-8 -*-
# Owner(s): ["oncall: quantization"]
from torch.testing._internal.common_utils import run_tests
# Quantization core tests. These include tests for
# - quantized kernels
# - quantized functional operators
# - quantized workflow modules
# - quantized workflow operators
# - quantized tensor
# 1.... | pytorch-master | test/test_quantization.py |
# Owner(s): ["module: nn"]
import unittest
import sys
import os
import subprocess
import torch
import torch.nn.utils.stateless as stateless
from torch.testing._internal.common_cuda import TEST_MULTIGPU
from torch.testing._internal.common_utils import run_tests, TestCase
class MockModule(torch.nn.Module):
def _... | pytorch-master | test/test_stateless.py |
# Usage: python create_dummy_model.py <name_of_the_file>
import sys
import torch
from torch import nn
class NeuralNetwork(nn.Module):
def __init__(self):
super(NeuralNetwork, self).__init__()
self.flatten = nn.Flatten()
self.linear_relu_stack = nn.Sequential(
nn.Linear(28 * 28... | pytorch-master | test/create_dummy_torchscript_model.py |
# Owner(s): ["module: unknown"]
from functools import partial, wraps
from itertools import chain
import torch
from torch.testing._internal.common_utils import \
(TestCase, is_iterable_of_tensors, run_tests, gradcheck, gradgradcheck, is_slow_gradcheck_env)
from torch.testing._internal.common_methods_invocations im... | pytorch-master | test/test_ops_gradients.py |
# Owner(s): ["oncall: profiler"]
import collections
import expecttest
import gc
import io
import json
import os
import re
import tempfile
from typing import List, Optional
import unittest
from dataclasses import dataclass, field
import torch
import torch.nn as nn
import torch.optim
import torch.utils.data
import torch... | pytorch-master | test/test_profiler.py |
# Owner(s): ["module: unknown"]
import glob
import io
import os
import unittest
import torch
from torch.testing._internal.common_utils import TestCase, run_tests
try:
from third_party.build_bundled import create_bundled
except ImportError:
create_bundled = None
license_file = 'third_party/LICENSES_BUNDLED.... | pytorch-master | test/test_license.py |
# Owner(s): ["module: typing"]
from torch.testing._internal.common_utils import TestCase, run_tests, TEST_NUMPY, load_tests
# load_tests from common_utils is used to automatically filter tests for
# sharding on sandcastle. This line silences flake warnings
load_tests = load_tests
import torch
import unittest
if TES... | pytorch-master | test/test_type_info.py |
import torch.distributed as c10d
import torch
import argparse
import os
import logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='Simple script to simulate NCCL errors. The... | pytorch-master | test/simulate_nccl_errors.py |
import argparse
import torch
class Module(torch.nn.Module):
def __init__(self):
super(Module, self).__init__()
self.conv = torch.nn.Conv2d(1, 10, 5, 1)
def forward(self, x):
y = self.conv(x)
return y
def run_model(level):
m = Module().eval()
d = torch.rand(1, 1, 112, 1... | pytorch-master | test/mkldnn_verbose.py |
# -*- coding: utf-8 -*-
# Owner(s): ["module: unknown"]
from torch.testing._internal.common_utils import run_tests, IS_ARM64
# Kernels
from ao.sparsity.test_kernels import TestQuantizedSparseKernels # noqa: F401
from ao.sparsity.test_kernels import TestQuantizedSparseLayers # noqa: F401
# Parametrizations
from ao.... | pytorch-master | test/test_ao_sparsity.py |
# Owner(s): ["oncall: mobile"]
import torch
from torch.testing._internal.common_utils import TestCase, run_tests
class TestSetDefaultMobileCPUAllocator(TestCase):
def test_no_exception(self):
torch._C._set_default_mobile_cpu_allocator()
torch._C._unset_default_mobile_cpu_allocator()
def test_... | pytorch-master | test/test_set_default_mobile_cpu_allocator.py |
# Owner(s): ["module: mkldnn"]
import torch
import unittest
import itertools
import torch.nn as nn
import torch.nn.functional as F
from torch.testing._internal.jit_utils import JitTestCase
from torch.testing._internal.common_utils import run_tests, TEST_SCIPY, IS_WINDOWS, IS_MACOS
LLGA_FUSION_GROUP = 'prim::oneDNNFus... | pytorch-master | test/test_jit_llga_fuser.py |
# Owner(s): ["module: mta"]
import itertools
from numbers import Number
import random
import re
import torch
import unittest
from torch.testing import make_tensor
from torch.testing._comparison import default_tolerances
from torch.testing._internal.common_utils import TestCase, run_tests, TEST_WITH_ROCM, TEST_WITH_SL... | pytorch-master | test/test_foreach.py |
# Owner(s): ["module: unknown"]
from typing import Optional, List
import torch
from torch.testing._internal.common_utils import TestCase, run_tests
# End-to-end tests of features in native_functions.yaml
class FloatListWrapperModule(torch.nn.Module):
def forward(self, values, incr: Optional[List[float]]):
... | pytorch-master | test/test_native_functions.py |
# Owner(s): ["module: unknown"]
from torch.testing._internal.common_utils import TestCase, run_tests
import os
import subprocess
import sys
class TestMKLVerbose(TestCase):
def test_verbose_on(self):
num = 0
loc = os.path.dirname(os.path.abspath(__file__))
with subprocess.Popen(f'{sys.execu... | pytorch-master | test/test_mkl_verbose.py |
# Owner(s): ["module: sparse"]
import copy
import torch
import random
import itertools
import unittest
import functools
from torch.testing import make_tensor
from torch.testing._internal.common_cuda import SM53OrLater, SM80OrLater, TEST_CUSPARSE_GENERIC
from torch.testing._internal.common_utils import \
(TEST_WITH... | pytorch-master | test/test_sparse_csr.py |
# Owner(s): ["module: unknown"]
import io
import numpy as np
import os
import shutil
import sys
import unittest
import uuid
TEST_TENSORBOARD = True
try:
import tensorboard.summary.writer.event_file_writer # noqa: F401
from tensorboard.compat.proto.summary_pb2 import Summary
except ImportError:
TEST_TENSO... | pytorch-master | test/test_tensorboard.py |
# Owner(s): ["module: cuda"]
from itertools import repeat, chain, product
from typing import NamedTuple
import collections
import contextlib
import ctypes
import gc
import io
import os
import pickle
import queue
import sys
import tempfile
import threading
import unittest
from random import randint
import torch
import... | pytorch-master | test/test_cuda.py |
# Owner(s): ["oncall: package/deploy"]
import textwrap
import types
from torch.utils._freeze import Freezer, PATH_MARKER
from torch.testing._internal.common_utils import run_tests, TestCase
class TestFreezer(TestCase):
"""Tests the freeze.py script"""
def test_compile_string(self):
freezer = Freeze... | pytorch-master | test/test_deploy.py |
# -*- coding: utf-8 -*-
# Owner(s): ["module: scatter & gather ops"]
import random
import torch
from torch.testing import make_tensor
from torch.testing._internal.common_utils import \
(parametrize, run_tests, TestCase,)
from torch.testing._internal.common_device_type import \
(instantiate_device_type_tests,... | pytorch-master | test/test_scatter_gather_ops.py |
#!/usr/bin/env python3
import argparse
import copy
from datetime import datetime
from distutils.util import strtobool
from distutils.version import LooseVersion
import functools
import os
import pathlib
import shutil
import signal
import subprocess
import sys
import tempfile
import json
from typing import Dict, Option... | pytorch-master | test/run_test.py |
# Owner(s): ["module: cuda"]
import sys
import unittest
import unittest.mock
import torch
import torch.utils._cuda_trace as cuda_trace
from torch.testing._internal.common_utils import TestCase, run_tests
# NOTE: Each test needs to be run in a brand new process, to reset the registered hooks
# and make sure the CUDA ... | pytorch-master | test/test_cuda_trace.py |
# Owner(s): ["module: cpp-extensions"]
import os
import unittest
import torch.testing._internal.common_utils as common
from torch.testing._internal.common_utils import IS_WINDOWS
from torch.testing._internal.common_cuda import TEST_CUDA
import torch
import torch.backends.cudnn
import torch.utils.cpp_extension
try:
... | pytorch-master | test/test_cpp_extensions_aot.py |
# Owner(s): ["oncall: jit"]
from test_jit import JitTestCase
from torch.testing._internal.common_utils import run_tests
from typing import List, Tuple
class TestScript(JitTestCase):
def test_str_ops(self):
def test_str_is(s: str) -> Tuple[bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool]:... | pytorch-master | test/test_jit_string.py |
# Owner(s): ["oncall: mobile"]
import unittest
import torch
from torch.nn import functional as F
from torch.testing._internal.common_utils import TestCase, run_tests
from torch.testing import FileCheck
import io
@unittest.skipUnless(torch.is_vulkan_available(),
"Vulkan backend must be available ... | pytorch-master | test/test_vulkan.py |
# Owner(s): ["module: unknown"]
import torch
from torch.testing._internal.common_utils import TestCase, run_tests
from torch._C import parse_schema
class TestFunctionSchema(TestCase):
def test_serialize_and_deserialize(self):
schemas = torch._C._jit_get_all_schemas()
# so far we have around 1700 ... | pytorch-master | test/test_function_schema.py |
# -*- coding: utf-8 -*-
# Owner(s): ["oncall: jit"]
import unittest
import os
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.testing import FileCheck
from unittest import skipIf
from torch.testing._internal.common_utils import run_tests, IS_SANDCASTLE, ProfilingMode, GRAPH_EX... | pytorch-master | test/test_jit_fuser.py |
# Owner(s): ["module: primTorch"]
import torch
import os
from enum import Enum
from torch.overrides import resolve_name
from torch.utils._pytree import tree_map, tree_flatten
from torch._subclasses.meta_utils import MetaConverter
import torch.utils._python_dispatch
from torch.testing._internal.common_utils import (
... | pytorch-master | test/test_meta.py |
# Owner(s): ["module: primTorch"]
from functools import partial
from itertools import product
from warnings import catch_warnings
import unittest
import torch
from torch.testing import make_tensor
from torch.testing._internal.common_utils import parametrize, run_tests, TestCase, TEST_SCIPY
from torch.testing._interna... | pytorch-master | test/test_prims.py |
# Owner(s): ["module: functionalization"]
import torch
from torch.testing._internal.common_utils import TestCase, run_tests
from torch.fx.passes.reinplace import reinplace
from torch.fx.experimental.proxy_tensor import make_fx
try:
from functorch.experimental import functionalize
HAS_FUNCTIONALIZATION = True
e... | pytorch-master | test/test_fx_reinplace_pass.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.