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/test/distributed/fsdp/test_checkpoint_wrapper.py | # Owner(s): ["oncall: distributed"]
import unittest
from copy import deepcopy
from functools import partial
import torch
import torch.nn as nn
from torch.distributed.algorithms._checkpoint.checkpoint_wrapper import (
apply_activation_checkpointing,
checkpoint_wrapper,
CheckpointImpl,
CheckpointWrapper... | 13,597 | 36.66759 | 87 | py |
pytorch | pytorch-main/test/distributed/fsdp/test_fsdp_grad_acc.py | # Owner(s): ["oncall: distributed"]
import contextlib
import itertools
import sys
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Tuple
import torch
from torch import distributed as dist
from torch.distributed.fsdp import CPUOffload, FullyShardedDataParallel as FSDP
from torch.distribu... | 11,010 | 35.101639 | 88 | py |
pytorch | pytorch-main/test/distributed/fsdp/test_fsdp_misc.py | # Owner(s): ["oncall: distributed"]
import functools
import os
import sys
import warnings
from collections import namedtuple
from contextlib import nullcontext
from copy import deepcopy
from typing import Any, Tuple
import torch
import torch.distributed as dist
import torch.distributed.fsdp._traversal_utils as traver... | 34,744 | 36.807399 | 121 | py |
pytorch | pytorch-main/test/distributed/fsdp/test_fsdp_multiple_forward.py | # Owner(s): ["oncall: distributed"]
import sys
import torch
from torch import distributed as dist
from torch.distributed.fsdp import FullyShardedDataParallel as FSDP
from torch.nn import Linear, Module
from torch.nn.parallel import DistributedDataParallel
from torch.optim import SGD
from torch.testing._internal.commo... | 2,259 | 26.560976 | 82 | py |
pytorch | pytorch-main/test/distributed/fsdp/test_fsdp_multiple_wrapping.py | # Owner(s): ["oncall: distributed"]
import sys
import torch
from torch import distributed as dist
from torch.distributed.fsdp import FullyShardedDataParallel as FSDP
from torch.nn import Linear, Module, Sequential
from torch.optim import SGD
from torch.testing._internal.common_distributed import skip_if_lt_x_gpu
from... | 2,007 | 29.424242 | 98 | py |
pytorch | pytorch-main/test/distributed/fsdp/test_fsdp_mixed_precision.py | # Owner(s): ["oncall: distributed"]
import contextlib
import itertools
import os
import sys
from functools import partial
from itertools import product
from typing import Any, Dict, List
import torch
import torch.cuda.nccl as nccl
import torch.nn as nn
import torch.nn.functional as F
from torch import distributed as ... | 49,561 | 38.272583 | 90 | py |
pytorch | pytorch-main/test/distributed/fsdp/test_utils.py | # Owner(s): ["oncall: distributed"]
import random
import sys
import unittest
from collections import OrderedDict
from dataclasses import dataclass
from typing import List
import torch
import torch.nn as nn
from torch import distributed as dist
from torch.distributed.utils import _apply_to_tensors, _replace_by_prefix
... | 3,601 | 28.768595 | 85 | py |
pytorch | pytorch-main/test/distributed/_shard/test_sharder.py |
# Owner(s): ["oncall: distributed"]
import sys
import copy
import torch
import torch.nn as nn
from torch.testing._internal.common_distributed import (
requires_nccl,
skip_if_lt_x_gpu,
)
from torch.distributed._shard import shard_module
from torch.distributed._shard.sharding_plan import ShardingPlan
from torch... | 5,973 | 34.987952 | 105 | py |
pytorch | pytorch-main/test/distributed/_shard/sharding_plan/test_sharding_plan.py |
# Owner(s): ["oncall: distributed"]
import sys
import torch
import torch.nn as nn
import torch.distributed as dist
from torch.testing._internal.common_distributed import (
requires_nccl,
skip_if_lt_x_gpu,
)
from torch.distributed._shard import shard_module
from torch.distributed._shard.sharding_plan import Sh... | 5,532 | 31.739645 | 88 | py |
pytorch | pytorch-main/test/distributed/_shard/sharding_spec/test_sharding_spec.py | # Owner(s): ["oncall: distributed"]
from typing import List, Union
from dataclasses import dataclass
import copy
import torch
from torch.testing._internal.common_utils import TestCase
from torch.testing._internal.common_distributed import (
requires_nccl,
skip_if_lt_x_gpu,
)
from torch.distributed._shard impor... | 21,365 | 35.152284 | 99 | py |
pytorch | pytorch-main/test/distributed/_shard/sharded_tensor/test_sharded_tensor_reshard.py | # Owner(s): ["oncall: distributed"]
import sys
from itertools import product
import torch
from torch.distributed._shard import (
sharded_tensor,
_shard_tensor,
)
from torch.distributed._shard.sharding_spec import (
EnumerableShardingSpec,
ShardMetadata,
)
from torch.testing._internal.common_distribute... | 3,601 | 33.634615 | 97 | py |
pytorch | pytorch-main/test/distributed/_shard/sharded_tensor/test_logger.py | # Owner(s): ["oncall: distributed"]
import logging
from torch.distributed._shard.sharded_tensor.logger import _get_or_create_logger
from torch.testing._internal.common_utils import (
TestCase,
run_tests,
)
class ShardingSpecLoggerTest(TestCase):
def test_get_or_create_logger(self):
logger = _get... | 543 | 23.727273 | 80 | py |
pytorch | pytorch-main/test/distributed/_shard/sharded_tensor/test_sharded_tensor.py | # Owner(s): ["oncall: distributed"]
import copy
import math
import io
import itertools
import pickle
import sys
import torch
import torch.distributed as dist
from torch.distributed import rpc
from torch.distributed import distributed_c10d
from torch.distributed._shard import sharded_tensor
from torch.distributed._shar... | 107,422 | 36.798381 | 126 | py |
pytorch | pytorch-main/test/distributed/_shard/sharded_tensor/ops/test_binary_cmp.py | # Owner(s): ["oncall: distributed"]
import sys
import torch
import torch.distributed as dist
from torch.distributed._shard import sharded_tensor
from torch.distributed.distributed_c10d import _get_default_group
from torch.testing._internal.common_distributed import (
requires_nccl,
skip_if_lt_x_gpu,
)
from t... | 5,313 | 31.601227 | 112 | py |
pytorch | pytorch-main/test/distributed/_shard/sharded_tensor/ops/test_embedding_bag.py | # Owner(s): ["oncall: distributed"]
import sys
import torch
import torch.distributed as dist
from torch.distributed._shard import (
shard_parameter,
)
from torch.testing._internal.common_distributed import (
requires_nccl,
skip_if_lt_x_gpu,
)
from torch.testing._internal.common_utils import (
TEST_WIT... | 9,230 | 31.618375 | 88 | py |
pytorch | pytorch-main/test/distributed/_shard/sharded_tensor/ops/test_tensor_ops.py | # Owner(s): ["oncall: distributed"]
import copy
import torch
import torch.distributed._shard.sharded_tensor as sharded_tensor
from torch.distributed._shard.sharding_spec import (
ChunkShardingSpec,
)
from torch.testing._internal.common_distributed import (
requires_nccl,
skip_if_lt_x_gpu,
)
from torch.t... | 4,460 | 29.765517 | 83 | py |
pytorch | pytorch-main/test/distributed/_shard/sharded_tensor/ops/test_embedding.py | # Owner(s): ["oncall: distributed"]
import sys
import torch
import torch.distributed as dist
from torch.distributed._shard import (
shard_parameter,
)
from torch.testing._internal.common_distributed import (
requires_nccl,
skip_if_lt_x_gpu,
)
from torch.testing._internal.common_utils import (
TEST_WIT... | 6,191 | 33.983051 | 88 | py |
pytorch | pytorch-main/test/distributed/_shard/sharded_tensor/ops/test_init.py | # Owner(s): ["oncall: distributed"]
import sys
import torch
from torch.distributed._shard import sharded_tensor
from torch.distributed._shard.sharding_spec import (
ChunkShardingSpec,
)
from torch.testing._internal.common_distributed import (
requires_nccl,
skip_if_lt_x_gpu,
)
from torch.testing._internal... | 4,280 | 30.248175 | 101 | py |
pytorch | pytorch-main/test/distributed/_shard/sharded_optim/test_sharded_optim.py | # Owner(s): ["oncall: distributed"]
import torch
import torch.optim as optim
from torch.distributed._shard import (
sharded_tensor,
shard_parameter
)
from copy import deepcopy
from torch.distributed._shard.sharding_spec import (
ChunkShardingSpec,
)
from torch.distributed._shard.sharded_optim import (
... | 5,992 | 31.570652 | 127 | py |
pytorch | pytorch-main/test/distributed/_composable/test_replicate.py | # Owner(s): ["oncall: distributed"]
import os
from copy import deepcopy
import torch
import torch.distributed as dist
import torch.nn.functional as F
from torch import nn
from torch.distributed._composable.replicate import replicate
from torch.testing._internal.common_distributed import (
MultiProcessTestCase,
... | 9,037 | 33.234848 | 88 | py |
pytorch | pytorch-main/test/distributed/_composable/test_checkpoint.py | # Owner(s): ["oncall: distributed"]
import unittest
from collections import deque
from contextlib import ContextDecorator
from copy import deepcopy
from typing import Tuple
import torch
import torch.nn as nn
from torch.distributed._composable import checkpoint
from torch.testing._internal.common_cuda import TEST_CUDA... | 5,904 | 28.232673 | 77 | py |
pytorch | pytorch-main/test/distributed/_composable/test_contract.py | # Owner(s): ["oncall: distributed"]
from copy import deepcopy
from typing import Tuple
import torch
import torch.nn as nn
from torch.distributed._composable import _get_registry, contract
from torch.testing._internal.common_utils import run_tests, skipIfTorchDynamo, TestCase
class ToyModel(nn.Module):
def __ini... | 4,684 | 31.992958 | 94 | py |
pytorch | pytorch-main/test/distributed/_composable/test_compose.py | # Owner(s): ["oncall: distributed"]
import copy
import sys
import torch
import torch.distributed as dist
import torch.nn as nn
from torch.distributed._composable import checkpoint, fully_shard, replicate
from torch.distributed._shard.sharded_tensor import ShardedTensor
from torch.distributed.fsdp import FullyShardedD... | 12,654 | 35.787791 | 86 | py |
pytorch | pytorch-main/test/distributed/_composable/fully_shard/test_fully_shard_mixed_precision.py | # Owner(s): ["oncall: distributed"]
import sys
from typing import Dict, NamedTuple, Optional
import torch
import torch.distributed as dist
import torch.nn as nn
from torch.distributed._composable import fully_shard
from torch.distributed.fsdp import MixedPrecision
from torch.testing._internal.common_distributed impor... | 7,382 | 34.839806 | 116 | py |
pytorch | pytorch-main/test/distributed/_composable/fully_shard/test_fully_shard_compile.py | # Owner(s): ["oncall: distributed"]
import copy
import sys
import torch
import torch.distributed as dist
import torch.nn as nn
from torch.distributed._composable import fully_shard
from torch.distributed.fsdp import ShardingStrategy
from torch.distributed.fsdp.wrap import ModuleWrapPolicy
from torch.testing._internal... | 2,707 | 30.488372 | 82 | py |
pytorch | pytorch-main/test/distributed/_composable/fully_shard/test_fully_shard_optim_checkpoint.py | # Owner(s): ["oncall: distributed"]
import copy
import itertools
import sys
import torch
import torch.distributed as dist
from torch.distributed._composable import fully_shard
from torch.distributed.fsdp import FullyShardedDataParallel as FSDP
from torch.distributed.fsdp.wrap import ModuleWrapPolicy
from torch.testin... | 4,309 | 36.478261 | 83 | py |
pytorch | pytorch-main/test/distributed/_composable/fully_shard/test_fully_shard_util.py | # Owner(s): ["oncall: distributed"]
import sys
import torch
import torch.distributed as dist
from torch.distributed._composable import fully_shard
from torch.distributed.fsdp._debug_utils import (
_get_sharded_module_tree_with_module_name_to_fqns,
)
from torch.distributed.fsdp.wrap import ModuleWrapPolicy
from to... | 3,584 | 29.905172 | 85 | py |
pytorch | pytorch-main/test/distributed/_composable/fully_shard/test_fully_shard_model_checkpoint.py | # Owner(s): ["oncall: distributed"]
import copy
import itertools
import sys
from typing import Dict
import torch
import torch.distributed as dist
import torch.nn as nn
from torch.distributed._composable import fully_shard
from torch.distributed.fsdp import FullyShardedDataParallel as FSDP, StateDictType
from torch.di... | 9,205 | 38.34188 | 102 | py |
pytorch | pytorch-main/test/distributed/_composable/fully_shard/test_fully_shard_init.py | # Owner(s): ["oncall: distributed"]
import copy
import sys
from typing import Optional
import torch
import torch.distributed as dist
import torch.distributed.fsdp._traversal_utils as traversal_utils
import torch.nn as nn
from torch.distributed._composable import fully_shard
from torch.distributed.fsdp import FullySha... | 11,710 | 37.778146 | 88 | py |
pytorch | pytorch-main/test/distributed/_composable/fully_shard/test_fully_shard_runtime.py | # Owner(s): ["oncall: distributed"]
import contextlib
import copy
import functools
import sys
from enum import auto, Enum
from typing import Callable, Iterable, List, Tuple
import torch
import torch.distributed as dist
import torch.distributed.fsdp._traversal_utils as traversal_utils
import torch.nn as nn
from torch.... | 10,867 | 38.093525 | 87 | py |
pytorch | pytorch-main/test/distributed/rpc/test_tensorpipe_agent.py | #!/usr/bin/env python3
# Owner(s): ["oncall: distributed"]
import sys
import torch
import torch.distributed as dist
if not dist.is_available():
print("Distributed not available, skipping tests", file=sys.stderr)
sys.exit(0)
from torch.testing._internal.common_utils import IS_CI, run_tests
from torch.testing... | 1,003 | 24.74359 | 87 | py |
pytorch | pytorch-main/test/distributed/rpc/test_share_memory.py | #!/usr/bin/env python3
# Owner(s): ["oncall: distributed"]
import torch
import torch.distributed as dist
if not dist.is_available():
print("Distributed not available, skipping tests", file=sys.stderr)
sys.exit(0)
import copyreg
import os
import contextlib
from torch import multiprocessing
import torch.multi... | 2,477 | 28.855422 | 76 | py |
pytorch | pytorch-main/test/distributed/rpc/test_faulty_agent.py | #!/usr/bin/env python3
# Owner(s): ["oncall: distributed"]
import sys
import torch
import torch.distributed as dist
if not dist.is_available():
print("Distributed not available, skipping tests", file=sys.stderr)
sys.exit(0)
from torch.testing._internal.common_utils import IS_CI, run_tests
from torch.testing... | 956 | 24.184211 | 83 | py |
pytorch | pytorch-main/test/distributed/rpc/cuda/test_tensorpipe_agent.py | #!/usr/bin/env python3
# Owner(s): ["oncall: distributed"]
import sys
import torch.distributed as dist
if not dist.is_available():
print("Distributed not available, skipping tests", file=sys.stderr)
sys.exit(0)
from torch.testing._internal.common_utils import run_tests
from torch.testing._internal.distribut... | 882 | 22.236842 | 87 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_dtensor.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
import torch
import torch.distributed as dist
import torch.nn.functional as F
from numpy.testing import assert_array_equal
from torch.distributed._tensor import DeviceMesh, distribute_tensor, DTensor
from torch.distributed._tensor... | 26,820 | 39.576399 | 92 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_api.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
import torch
import torch.nn as nn
from torch.distributed._tensor import (
DeviceMesh,
distribute_module,
distribute_tensor,
DTensor,
Replicate,
Shard,
)
from torch.testing._internal.common_utils import run_... | 10,189 | 40.255061 | 117 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_dtensor_ops.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
import unittest
import warnings
import torch
import torch.distributed as dist
import torch.testing._internal.common_methods_invocations as common_ops
from torch.distributed._tensor import DeviceMesh, DTensor, Replicate
from torc... | 24,731 | 33.35 | 112 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_basic_strategy.py | # Owner(s): ["oncall: distributed"]
import torch
from torch.distributed._tensor import DeviceMesh
from torch.distributed._tensor.ops.basic_strategy import (
EinsumDims,
gen_einsum_strategies,
)
from torch.testing._internal.common_utils import run_tests, TestCase
from torch.testing._internal.distributed._tenso... | 4,434 | 35.652893 | 88 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_pointwise_ops.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
from typing import Any, Callable, Dict, Optional, Sequence
from unittest import skip
import torch
import torch.utils._pytree as pytree
from torch import Tensor
from torch.distributed._tensor import DeviceMesh, distribute_tensor,... | 7,940 | 27.981752 | 87 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_common_rules.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
import torch
from torch._C import parse_schema
from torch.distributed._tensor import DeviceMesh
from torch.distributed._tensor.op_schema import OpSchema
from torch.distributed._tensor.ops.common_rules import (
einop_rule,
... | 19,743 | 39.877847 | 95 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_random_ops.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
import itertools
import torch
import torch.distributed._tensor.random as random
from torch.distributed._tensor import DeviceMesh, DTensor
from torch.distributed._tensor._utils import compute_local_offset
from torch.distributed._t... | 12,238 | 39.66113 | 88 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_tensor_ops.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
import torch
from torch.distributed._tensor import DeviceMesh, distribute_tensor, DTensor
from torch.distributed._tensor.placement_types import _Partial, Replicate, Shard
from torch.testing._internal.common_utils import run_tests
f... | 15,070 | 38.044041 | 99 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_view_ops.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
import itertools
from typing import cast, List
import torch
import torch.distributed as dist
from torch import rand, randn, Tensor
from torch.distributed._tensor import DeviceMesh, distribute_tensor, Replicate, Shard
from torch.di... | 14,836 | 30.907527 | 88 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_matrix_ops.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
import itertools
from typing import cast, List, Optional
import torch
from torch.distributed._tensor import DeviceMesh, distribute_tensor
from torch.distributed._tensor.api import DTensor
from torch.distributed._tensor.placement_t... | 11,709 | 39.519031 | 97 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_embedding_ops.py | # Owner(s): ["oncall: distributed"]
import sys
import torch
from torch.distributed._tensor import distribute_tensor, DTensor
from torch.distributed._tensor.placement_types import Replicate, Shard
from torch.testing._internal.common_utils import run_tests, TEST_WITH_DEV_DBG_ASAN
from torch.testing._internal.distribute... | 4,524 | 30.423611 | 86 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_init.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
import torch
from torch.distributed._tensor import DeviceMesh, DTensor, Replicate, Shard, zeros
from torch.testing._internal.common_utils import run_tests
from torch.testing._internal.distributed._tensor.common_dtensor import (
... | 9,490 | 37.270161 | 88 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_redistribute.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
import itertools
import torch
from torch.distributed._tensor import DeviceMesh, distribute_tensor, DTensor
from torch.distributed._tensor.placement_types import _Partial, Replicate, Shard
from torch.testing._internal.common_utils... | 12,713 | 43.299652 | 109 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_math_ops.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
import itertools
import torch
from torch.distributed._tensor import distribute_tensor
from torch.distributed._tensor.placement_types import Replicate, Shard
from torch.testing._internal.common_utils import run_tests
from torch.te... | 4,773 | 39.457627 | 89 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_device_mesh.py | # Copyright (c) Meta Platforms, Inc. and affiliates
# Owner(s): ["oncall: distributed"]
import os
import torch
from torch.distributed._tensor.device_mesh import DeviceMesh
from torch.distributed._tensor.placement_types import Shard
from torch.distributed.distributed_c10d import (
get_global_rank,
get_process_... | 21,048 | 39.792636 | 95 | py |
pytorch | pytorch-main/test/distributed/_tensor/test_utils.py | # Owner(s): ["oncall: distributed"]
import torch
from torch.distributed._tensor._utils import compute_local_offset, compute_local_shape
from torch.distributed._tensor.device_mesh import DeviceMesh
from torch.distributed._tensor.placement_types import Replicate, Shard
from torch.testing._internal.common_utils import r... | 3,534 | 34.35 | 86 | py |
pytorch | pytorch-main/test/distributed/_tensor/debug/test_op_coverage.py | # Owner(s): ["oncall: distributed"]
import torch
import torch.nn as nn
from torch.distributed._tensor.debug.op_coverage import get_inductor_decomp_graphs
from torch.testing._internal.common_utils import run_tests, TestCase
class SimpleMLP(nn.Module):
def __init__(self):
super(SimpleMLP, self).__init__(... | 980 | 27.028571 | 82 | py |
pytorch | pytorch-main/test/forward_backward_compatibility/dump_all_function_schemas.py |
import argparse
import torch
def dump(filename):
schemas = torch._C._jit_get_all_schemas()
schemas += torch._C._jit_get_custom_class_schemas()
with open(filename, 'w') as f:
for s in schemas:
f.write(str(s))
f.write('\n')
if __name__ == '__main__':
parser = argparse.... | 583 | 22.36 | 74 | py |
pytorch | pytorch-main/test/forward_backward_compatibility/check_forward_backward_compatibility.py | import argparse
import datetime
import re
import sys
import warnings
from collections import defaultdict
import torch
from torch._C import parse_schema
# How to run this test locally:
# 1 Have two virtual environments (eg conda env), one without PyTorch installed (venv_nightly)
# one with your local changes (venv_... | 26,024 | 48.856322 | 128 | py |
pytorch | pytorch-main/test/export/test_upgrade.py | # Owner(s): ["module: dynamo"]
import unittest
from unittest.mock import patch
import torch
import torch._dynamo as torchdynamo
from torch._export import export
from torch._export.serde.serialize import GraphModuleOpUpgrader
from torch._export.serde.upgrade import get_target_version, get_upgraders
from torch.testing._... | 5,748 | 39.202797 | 114 | py |
pytorch | pytorch-main/test/export/test_pass_infra.py | # Owner(s): ["module: dynamo"]
from typing import List
import unittest
import torch
from torch.testing._internal.common_utils import run_tests, TestCase
from torch._dynamo.eval_frame import is_dynamo_supported
from torch._export import export
from torch._export.pass_base import ExportPassBase
from torch._export.constr... | 2,154 | 30.691176 | 79 | py |
pytorch | pytorch-main/test/export/test_passes.py | """
PYTEST_DONT_REWRITE (prevents pytest from rewriting assertions, which interferes
with test_functionalization_with_native_python_assertion)
"""
# Owner(s): ["module: dynamo"]
import unittest
from typing import List, Set
import operator
import torch
from torch.testing._internal.common_utils import run_tests, TestCa... | 23,038 | 34.554012 | 124 | py |
pytorch | pytorch-main/test/export/test_serialize.py | # Owner(s): ["module: dynamo"]
import unittest
import torch
import torch._dynamo as torchdynamo
from torch._export import dynamic_dim, export
from torch._export.db.case import ExportCase, normalize_inputs, SupportLevel
from torch._export.db.examples import all_examples
from torch._export.serde.serialize import (
E... | 14,646 | 34.811736 | 104 | py |
pytorch | pytorch-main/test/export/test_export.py | # Owner(s): ["module: dynamo"]
import unittest
import torch
import torch._dynamo as torchdynamo
from torch._export import export, dynamic_dim
from torch._export.trace import do_not_use_experimental_export
from torch._export.constraints import constrain_as_size, constrain_as_value
from torch.fx.experimental.proxy_tenso... | 10,837 | 34.302932 | 112 | py |
pytorch | pytorch-main/test/export/test_verifier.py | # Owner(s): ["module: dynamo"]
import copy
from typing import Tuple
import unittest
import torch # noqa: F401
import torch.nn as nn
import torch._dynamo as torchdynamo
from functorch import make_fx
from functorch.experimental import functionalize
from torch import Tensor
from torch.testing._internal.common_utils impo... | 6,771 | 30.64486 | 98 | py |
pytorch | pytorch-main/test/export/test_funtionalized_assertions.py | # Owner(s): ["module: dynamo"]
import torch
from torch.testing._internal.common_utils import run_tests, TestCase
class TestFuntionalAssertions(TestCase):
def test_functional_assert_async_msg(self) -> None:
dep_token = torch.ops.aten._make_dep_token()
self.assertEqual(
torch.ops.aten._f... | 986 | 29.84375 | 68 | py |
pytorch | pytorch-main/test/export/test_db.py | # Owner(s): ["module: dynamo"]
import unittest
import torch._dynamo as torchdynamo
from torch._export import export
from torch._export.db.case import ExportCase, normalize_inputs, SupportLevel
from torch._export.db.examples import (
filter_examples_by_support_level,
get_rewrite_cases,
)
from torch.testing._in... | 2,944 | 30 | 81 | py |
pytorch | pytorch-main/test/custom_operator/test_custom_ops.py | # Owner(s): ["module: unknown"]
import os.path
import tempfile
import torch
from torch import ops
from model import Model, get_custom_op_library_path
from torch.testing._internal.common_utils import TestCase, run_tests
class TestCustomOperators(TestCase):
def setUp(self):
self.library_path = get_custom... | 3,407 | 34.5 | 96 | py |
pytorch | pytorch-main/test/custom_operator/model.py | import argparse
import os.path
import sys
import torch
def get_custom_op_library_path():
if sys.platform.startswith("win32"):
library_filename = "custom_ops.dll"
elif sys.platform.startswith("darwin"):
library_filename = "libcustom_ops.dylib"
else:
library_filename = "libcustom_op... | 1,098 | 23.422222 | 67 | py |
pytorch | pytorch-main/test/custom_backend/test_custom_backend.py | # Owner(s): ["module: unknown"]
import os
import tempfile
import torch
from backend import Model, to_custom_backend, get_custom_backend_library_path
from torch.testing._internal.common_utils import TestCase, run_tests
class TestCustomBackend(TestCase):
def setUp(self):
# Load the library containing the ... | 1,701 | 28.859649 | 78 | py |
pytorch | pytorch-main/test/custom_backend/backend.py | import argparse
import os.path
import sys
import torch
def get_custom_backend_library_path():
"""
Get the path to the library containing the custom backend.
Return:
The path to the custom backend object, customized by platform.
"""
if sys.platform.startswith("win32"):
library_file... | 1,946 | 26.814286 | 94 | py |
pytorch | pytorch-main/test/jit/test_convert_activation.py | # Owner(s): ["oncall: jit"]
import os
import sys
from itertools import product
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.testing import FileCheck
import unittest
try:
import torchvision
HAS_TORCHVISION = True
except ImportError:
HAS_TORCHVISION = False
skipIfNoTorchVis... | 6,251 | 34.123596 | 81 | py |
pytorch | pytorch-main/test/jit/test_jit_utils.py | # Owner(s): ["oncall: jit"]
import os
import sys
from textwrap import dedent
import torch
from torch.testing._internal import jit_utils
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._in... | 3,743 | 34.320755 | 96 | py |
pytorch | pytorch-main/test/jit/test_pdt.py | # Owner(s): ["oncall: jit"]
import os
import sys
import torch
from torch.testing._internal.jit_utils import JitTestCase, make_global
from torch.jit._monkeytype_config import _IS_MONKEYTYPE_INSTALLED
from typing import List, Dict, Tuple, Any, Optional, NamedTuple # noqa: F401
from torch.testing._internal.common_utils ... | 19,228 | 42.211236 | 129 | py |
pytorch | pytorch-main/test/jit/test_optimize_for_mobile_preserve_debug_info.py | # Owner(s): ["oncall: mobile"]
import torch
import torch._C
import torch.nn.functional as F
from torch.testing._internal.jit_utils import JitTestCase
from torch.testing._internal.common_utils import skipIfNoXNNPACK
class TestOptimizeForMobilePreserveDebugInfo(JitTestCase):
def check_replacement(
self,
... | 9,670 | 34.686347 | 80 | py |
pytorch | pytorch-main/test/jit/test_logging.py | # Owner(s): ["oncall: jit"]
import os
import sys
import torch
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils import JitTestCase
if __name__ == '__main__':
raise R... | 4,306 | 34.891667 | 82 | py |
pytorch | pytorch-main/test/jit/test_builtins.py | # Owner(s): ["oncall: jit"]
import os
import sys
import inspect
import unittest
from typing import Dict, List
import torch
from torch.testing import FileCheck
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
... | 9,514 | 31.810345 | 101 | py |
pytorch | pytorch-main/test/jit/test_class_type.py | # Owner(s): ["oncall: jit"]
import io
import os
import sys
import unittest
import torch
import torch.nn as nn
from torch.testing import FileCheck
from typing import Any
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_... | 47,770 | 29.919741 | 132 | py |
pytorch | pytorch-main/test/jit/test_functional_blocks.py | # Owner(s): ["oncall: jit"]
import os
import sys
import torch
from torch.testing import FileCheck
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils import JitTestCase
if... | 1,571 | 34.727273 | 99 | py |
pytorch | pytorch-main/test/jit/test_types.py | # Owner(s): ["oncall: jit"]
from collections import namedtuple
from typing import Dict, Iterator, List, Optional, Tuple
from torch.testing._internal.jit_utils import JitTestCase
from torch.testing import FileCheck
from textwrap import dedent
from jit.test_module_interface import TestModuleInterface # noqa: F401
impo... | 11,271 | 32.84985 | 121 | py |
pytorch | pytorch-main/test/jit/test_op_decompositions.py | # Owner(s): ["oncall: jit"]
import torch
from torch.testing import FileCheck
from torch.testing._internal.jit_utils import JitTestCase
if __name__ == '__main__':
raise RuntimeError("This test file is not meant to be run directly, use:\n\n"
"\tpython test/test_jit.py TESTNAME\n\n"
... | 1,352 | 33.692308 | 93 | py |
pytorch | pytorch-main/test/jit/test_type_sharing.py | # Owner(s): ["oncall: jit"]
import os
import sys
import io
import torch
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils import JitTestCase
from torch.testing._internal.... | 17,917 | 28.71476 | 105 | py |
pytorch | pytorch-main/test/jit/test_profiler.py | # Owner(s): ["oncall: jit"]
import os
import sys
import torch
from torch.testing._internal.common_utils import skipIfTorchDynamo
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.j... | 10,256 | 36.298182 | 131 | py |
pytorch | pytorch-main/test/jit/test_slice.py | # Owner(s): ["oncall: jit"]
import os
import sys
import torch
from typing import List
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils import JitTestCase
if __name__ ==... | 5,267 | 29.627907 | 97 | py |
pytorch | pytorch-main/test/jit/test_warn.py | # Owner(s): ["oncall: jit"]
import os
import sys
import io
import torch
import warnings
from contextlib import redirect_stderr
from torch.testing import FileCheck
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_d... | 4,154 | 23.732143 | 81 | py |
pytorch | pytorch-main/test/jit/test_backends.py | # Owner(s): ["oncall: jit"]
from torch.testing._internal.jit_utils import JitTestCase
import io
import os
import sys
import unittest
import torch
import torch._C
from torch.testing import FileCheck
from torch.jit.mobile import _load_for_lite_interpreter
from torch.testing._internal.common_utils import (
IS_FBCOD... | 28,956 | 37.201847 | 131 | py |
pytorch | pytorch-main/test/jit/test_modules.py | # Owner(s): ["oncall: jit"]
import torch
import os
import sys
from torch.testing._internal.jit_utils import JitTestCase
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
if __name__ == '__main__':
raise Ru... | 1,035 | 29.470588 | 81 | py |
pytorch | pytorch-main/test/jit/test_fuser_common.py | # Owner(s): ["oncall: jit"]
import torch
from torch.testing._internal.jit_utils import JitTestCase
class TestFuserCommon(JitTestCase):
def test_autodiff_fallback(self):
for rq in [True, False]:
@torch.jit.script
def fn(x):
return torch.max(x**2.0, x**3.0)
... | 631 | 30.6 | 63 | py |
pytorch | pytorch-main/test/jit/test_python_builtins.py | # Owner(s): ["oncall: jit"]
import os
import sys
import tempfile
import random
from textwrap import dedent
import torch
from torch.testing._internal.jit_utils import JitTestCase, execWrapper
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sy... | 15,398 | 34.56351 | 106 | py |
pytorch | pytorch-main/test/jit/test_async.py | # Owner(s): ["oncall: jit"]
import os
import sys
import torch
import torch.nn as nn
from typing import Any, Tuple
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils impor... | 17,039 | 32.087379 | 124 | py |
pytorch | pytorch-main/test/jit/test_module_interface.py | # Owner(s): ["oncall: jit"]
from typing import List, Any
import torch
import torch.nn as nn
import os
import sys
from torch import Tensor
from torch.testing._internal.jit_utils import JitTestCase, make_global
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpa... | 22,326 | 32.625 | 128 | py |
pytorch | pytorch-main/test/jit/test_complexity.py | # Owner(s): ["oncall: jit"]
import os
import sys
import unittest
import torch
# as with test_jit tests, requires global dtype set
torch.set_default_dtype(torch.double)
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_... | 3,377 | 34.93617 | 112 | py |
pytorch | pytorch-main/test/jit/test_misc.py | # Owner(s): ["oncall: jit"]
from typing import Any, Dict, List, Optional, Tuple
from torch.testing._internal.jit_utils import JitTestCase, make_global
from torch.testing import FileCheck
from torch import jit
from jit.test_module_interface import TestModuleInterface # noqa: F401
import os
import sys
import torch
imp... | 14,454 | 32.15367 | 110 | py |
pytorch | pytorch-main/test/jit/test_python_ir.py | # Owner(s): ["oncall: jit"]
import torch
from torch.testing._internal.jit_utils import JitTestCase
if __name__ == '__main__':
raise RuntimeError("This test file is not meant to be run directly, use:\n\n"
"\tpython test/test_jit.py TESTNAME\n\n"
"instead.")
class Test... | 711 | 32.904762 | 81 | py |
pytorch | pytorch-main/test/jit/test_complex.py | # Owner(s): ["oncall: jit"]
import torch
import os
import sys
from torch.testing._internal.jit_utils import JitTestCase, execWrapper
from torch.testing._internal.common_utils import IS_MACOS
from typing import List, Dict
from itertools import product
from textwrap import dedent
import cmath
# Make the helper files in... | 11,991 | 32.218837 | 109 | py |
pytorch | pytorch-main/test/jit/test_torchbind.py | # Owner(s): ["oncall: jit"]
import io
import os
import sys
import copy
import unittest
import torch
from typing import Optional
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.ji... | 16,253 | 34.801762 | 123 | py |
pytorch | pytorch-main/test/jit/test_python_bindings.py | # Owner(s): ["oncall: jit"]
import torch
from torch.testing import FileCheck
from torch.testing._internal.jit_utils import JitTestCase
if __name__ == "__main__":
raise RuntimeError(
"This test file is not meant to be run directly, use:\n\n"
"\tpython test/test_jit.py TestPythonBindings\n\n"
... | 3,673 | 30.672414 | 82 | py |
pytorch | pytorch-main/test/jit/test_upgraders.py | # Owner(s): ["oncall: jit"]
import io
import os
import sys
import torch
import zipfile
from torch.testing import FileCheck
from typing import Union
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.t... | 13,551 | 44.47651 | 131 | py |
pytorch | pytorch-main/test/jit/test_custom_operators.py | # Owner(s): ["oncall: jit"]
import os
import sys
import unittest
import torch
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils import JitTestCase
if __name__ == '__main... | 4,859 | 33.714286 | 92 | py |
pytorch | pytorch-main/test/jit/test_parametrization.py | # Owner(s): ["oncall: jit"]
import torch
from torch import nn
import torch.nn.utils.parametrize as parametrize
from torch.testing._internal.jit_utils import JitTestCase
if __name__ == '__main__':
raise RuntimeError("This test file is not meant to be run directly, use:\n\n"
"\tpython test... | 2,529 | 35.142857 | 88 | py |
pytorch | pytorch-main/test/jit/test_save_load.py | # Owner(s): ["oncall: jit"]
import io
import os
import pathlib
import sys
from typing import NamedTuple, Optional
import torch
from torch import Tensor
from torch.testing._internal.common_utils import TemporaryFileName
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.... | 40,169 | 32.363787 | 100 | py |
pytorch | pytorch-main/test/jit/test_models.py | # Owner(s): ["oncall: jit"]
import os
import sys
import unittest
from torch.testing._internal.common_utils import (
enable_profiling_mode_for_profiling_tests, GRAPH_EXECUTOR, ProfilingMode,
set_default_dtype,
)
import torch
import torch.nn as nn
import torch.nn.functional as F
# Make the helper files in test/... | 29,633 | 40.330544 | 117 | py |
pytorch | pytorch-main/test/jit/test_autodiff_subgraph_slicing.py | # Owner(s): ["oncall: jit"]
import os
import sys
import unittest
from torch.testing._internal.common_utils import GRAPH_EXECUTOR, ProfilingMode, \
num_profiled_runs, enable_profiling_mode_for_profiling_tests
from torch.testing._internal.common_jit import check_against_reference
import torch
# Make the helper file... | 20,596 | 38.609615 | 122 | py |
pytorch | pytorch-main/test/jit/test_save_load_for_op_version.py | # Owner(s): ["oncall: jit"]
from itertools import product as product
import io
import os
import sys
import hypothesis.strategies as st
from hypothesis import example, settings, given
from typing import Union
import torch
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(o... | 22,028 | 42.97006 | 117 | py |
pytorch | pytorch-main/test/jit/test_string_formatting.py | # Owner(s): ["oncall: jit"]
import os
import sys
import torch
from typing import List
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils import JitTestCase
if __name__ ==... | 6,694 | 39.575758 | 115 | py |
pytorch | pytorch-main/test/jit/test_hooks.py | # Owner(s): ["oncall: jit"]
import os
import sys
import unittest
from typing import Tuple
import torch
from jit.test_hooks_modules import (
ModuleDirectforwardSubmodCall, ModuleForwardSingleInput,
ModuleForwardTupleInput, create_forward_tuple_input,
create_module_forward_multiple_inputs, create_module_for... | 14,486 | 36.628571 | 86 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.