python_code
stringlengths
0
1.02M
repo_name
stringlengths
9
48
file_path
stringlengths
5
114
import tensorboard from distutils.version import LooseVersion if not hasattr(tensorboard, "__version__") or LooseVersion( tensorboard.__version__ ) < LooseVersion("1.15"): raise ImportError("TensorBoard logging requires TensorBoard version 1.15 or above") del LooseVersion del tensorboard from .writer import ...
pytorch-master
torch/utils/tensorboard/__init__.py
import math import numpy as np from ._convert_np import make_np from ._utils import make_grid from tensorboard.compat import tf from tensorboard.plugins.projector.projector_config_pb2 import EmbeddingInfo def make_tsv(metadata, save_path, metadata_header=None): if not metadata_header: metadata = [str(x) f...
pytorch-master
torch/utils/tensorboard/_embedding.py
from tensorboard.compat.proto.graph_pb2 import GraphDef from tensorboard.compat.proto.node_def_pb2 import NodeDef from tensorboard.compat.proto.versions_pb2 import VersionDef from tensorboard.compat.proto.attr_value_pb2 import AttrValue from tensorboard.compat.proto.tensor_shape_pb2 import TensorShapeProto def load_o...
pytorch-master
torch/utils/tensorboard/_onnx_graph.py
import json import logging import os from typing import Optional import numpy as np from google.protobuf import struct_pb2 # pylint: disable=unused-import from six.moves import range from tensorboard.compat.proto.summary_pb2 import HistogramProto from tensorboard.compat.proto.summary_pb2 import Summary from tensorboa...
pytorch-master
torch/utils/tensorboard/summary.py
""" This module converts objects into numpy array. """ import numpy as np import torch def make_np(x): """ Args: x: An instance of torch tensor or caffe blob name Returns: numpy.array: Numpy array """ if isinstance(x, np.ndarray): return x if isinstance(x, str): # Caffe...
pytorch-master
torch/utils/tensorboard/_convert_np.py
"""Provides an API for writing protocol buffers to event files to be consumed by TensorBoard for visualization.""" import os import time import torch from tensorboard.compat import tf from tensorboard.compat.proto.event_pb2 import SessionLog from tensorboard.compat.proto.event_pb2 import Event from tensorboard.compat...
pytorch-master
torch/utils/tensorboard/writer.py
import copy import logging import os import re from tensorboard.compat.proto.graph_pb2 import GraphDef from tensorboard.compat.proto.node_def_pb2 import NodeDef from tensorboard.compat.proto.tensor_shape_pb2 import TensorShapeProto from builtins import bytes from caffe2.proto import caffe2_pb2 from caffe2.python impo...
pytorch-master
torch/utils/tensorboard/_caffe2_graph.py
import numpy as np # Functions for converting def figure_to_image(figures, close=True): """Render matplotlib figure to numpy format. Note that this requires the ``matplotlib`` package. Args: figure (matplotlib.pyplot.figure) or list of figures: figure or a list of figures close (bool): F...
pytorch-master
torch/utils/tensorboard/_utils.py
#!/usr/bin/env python3 """ model_dump: a one-stop shop for TorchScript model inspection. The goal of this tool is to provide a simple way to extract lots of useful information from a TorchScript model and make it easy for humans to consume. It (mostly) replaces zipinfo, common uses of show_pickle, and various ad-hoc ...
pytorch-master
torch/utils/model_dump/__init__.py
#!/usr/bin/env python3 import sys from . import main sys.exit(main(sys.argv))
pytorch-master
torch/utils/model_dump/__main__.py
import warnings from typing import Any, List, Optional, Set import torch import torch.utils.data.datapipes as dp from torch.utils.data.graph import DataPipe, DataPipeGraph, traverse __all__ = [ "apply_sharding", "apply_shuffle_seed", "apply_shuffle_settings", "get_all_graph_pipes", ] def get_all_g...
pytorch-master
torch/utils/data/graph_settings.py
import io import pickle from torch.utils.data import IterDataPipe, MapDataPipe from torch.utils.data._utils.serialization import DILL_AVAILABLE from typing import Dict, List, Set, Tuple, Type, Union __all__ = ["traverse"] DataPipe = Union[IterDataPipe, MapDataPipe] DataPipeGraph = Dict[int, Tuple[DataPipe, "DataPip...
pytorch-master
torch/utils/data/graph.py
# TODO(VitalyFedyunin): Rearranging this imports leads to crash, # need to cleanup dependencies and fix it from torch.utils.data.sampler import ( BatchSampler, RandomSampler, Sampler, SequentialSampler, SubsetRandomSampler, WeightedRandomSampler, ) from torch.utils.data.dataset import ( Chai...
pytorch-master
torch/utils/data/__init__.py
import bisect import warnings import math from typing import ( Generic, Iterable, Iterator, List, Optional, Sequence, Tuple, TypeVar, Union ) # No 'default_generator' in torch/__init__.pyi from torch import default_generator, randperm from torch._utils import _accumulate from ... i...
pytorch-master
torch/utils/data/dataset.py
import math from typing import TypeVar, Optional, Iterator import torch from . import Sampler, Dataset import torch.distributed as dist __all__ = ["DistributedSampler", ] T_co = TypeVar('T_co', covariant=True) class DistributedSampler(Sampler[T_co]): r"""Sampler that restricts data loading to a subset of the d...
pytorch-master
torch/utils/data/distributed.py
import time from typing import Any, List import torch.utils.data.backward_compatibility import torch.utils.data.graph_settings from torch.utils.data import DataLoader, IterDataPipe, communication from torch.utils.data.datapipes.iter import IterableWrapper __all__ = [ "DataLoader2", ] class _ThreadingDataLoade...
pytorch-master
torch/utils/data/dataloader_experimental.py
import warnings def worker_init_fn(worker_id): warnings.warn("Usage of backward_compatibility.worker_init_fn is deprecated" " as DataLoader automatically applies sharding in every worker")
pytorch-master
torch/utils/data/backward_compatibility.py
r"""Definition of the DataLoader and associated iterators that subclass _BaseDataLoaderIter To support these two classes, in `./_utils` we define many utility methods and functions to be run in multiprocessing. E.g., the data loading worker loop is in `./_utils/worker.py`. """ import functools import itertools import...
pytorch-master
torch/utils/data/dataloader.py
import torch from torch import Tensor from typing import Iterator, Iterable, Optional, Sequence, List, TypeVar, Generic, Sized, Union __all__ = [ "BatchSampler", "RandomSampler", "Sampler", "SequentialSampler", "SubsetRandomSampler", "WeightedRandomSampler", ] T_co = TypeVar('T_co', covariant...
pytorch-master
torch/utils/data/sampler.py
r""""Contains definitions of the methods used by the _BaseDataLoaderIter to fetch data from an iterable-style or map-style dataset. This logic is shared in both single- and multi-processing data loading. """ class _BaseDatasetFetcher(object): def __init__(self, dataset, auto_collation, collate_fn, drop_last): ...
pytorch-master
torch/utils/data/_utils/fetch.py
r""""Contains definitions of the methods used by the _BaseDataLoaderIter workers. These **needs** to be in global scope since Py2 doesn't support serializing static methods. """ import torch import random import os import queue from dataclasses import dataclass from torch._utils import ExceptionWrapper from typing im...
pytorch-master
torch/utils/data/_utils/worker.py
r""""Contains definitions of the methods used by the _BaseDataLoaderIter workers to collate samples fetched from dataset into Tensor(s). These **needs** to be in global scope since Py2 doesn't support serializing static methods. `default_collate` and `default_convert` are exposed to users via 'dataloader.py'. """ im...
pytorch-master
torch/utils/data/_utils/collate.py
r""""Contains definitions of the methods used by the _BaseDataLoaderIter to put fetched tensors into pinned memory. These **needs** to be in global scope since Py2 doesn't support serializing static methods. """ import collections import queue import torch from torch._six import string_classes from . import MP_STATU...
pytorch-master
torch/utils/data/_utils/pin_memory.py
r"""Utility classes & functions for data loading. Code in this folder is mostly used by ../dataloder.py. A lot of multiprocessing is used in data loading, which only supports running functions defined in global environment (py2 can't serialize static methods). Therefore, for code tidiness we put these functions into d...
pytorch-master
torch/utils/data/_utils/__init__.py
r""""Signal handling for multiprocessing data loading. NOTE [ Signal handling in multiprocessing data loading ] In cases like DataLoader, if a worker process dies due to bus error/segfault or just hang, the main process will hang waiting for data. This is difficult to avoid on PyTorch side as it can be caused by limi...
pytorch-master
torch/utils/data/_utils/signal_handling.py
try: import dill # XXX: By default, dill writes the Pickler dispatch table to inject its # own logic there. This globally affects the behavior of the standard library # pickler for any user who transitively depends on this module! # Undo this extension to avoid altering the behavior of the pickler ...
pytorch-master
torch/utils/data/_utils/serialization.py
import threading import time class LocalQueue(): ops = 0 stored = 0 uid = 0 empty = 0 def __init__(self, name='unnamed'): self.items = [] self.name = name self.uid = LocalQueue.uid LocalQueue.uid += 1 def put(self, item, block=True): LocalQueue.ops += ...
pytorch-master
torch/utils/data/communication/queue.py
import time import types from torch.utils.data import IterDataPipe, communication DEFAULT_NON_BLOCKING_SLEEP = 0.001 __all__ = [ "DataPipeBehindQueues", "EnsureNonBlockingDataPipe", "InvalidStateResetRequired", "NonBlocking", "NotAvailable", "QueueWrapper", "default_not_available_hook", ]...
pytorch-master
torch/utils/data/communication/iter.py
from torch.utils.data import communication class Protocol(object): __slots__ = ('request_queue', 'response_queue') def __init__(self, request_queue, response_queue): self.request_queue = request_queue self.response_queue = response_queue class ProtocolClient(Protocol): """ Proto...
pytorch-master
torch/utils/data/communication/protocol.py
from . import eventloop from . import iter from . import map from . import messages from . import protocol from . import queue
pytorch-master
torch/utils/data/communication/__init__.py
import torch import threading import pickle from torch.utils.data import IterDataPipe, communication, MapDataPipe try: import dill # XXX: By default, dill writes the Pickler dispatch table to inject its # own logic there. This globally affects the behavior of the standard library # pickler for any use...
pytorch-master
torch/utils/data/communication/eventloop.py
import time import types from torch.utils.data import communication, MapDataPipe DEFAULT_NON_BLOCKING_SLEEP = 0.001 __all__ = [ "DataPipeBehindQueues", "EnsureNonBlockingMapDataPipe", "NonBlockingMap", "NotAvailable", "QueueWrapperForMap", "default_not_available_hook", ] def default_not_ava...
pytorch-master
torch/utils/data/communication/map.py
class DataLoaderQueueMessage(object): pass class Request(DataLoaderQueueMessage): pass class Response(DataLoaderQueueMessage): pass class ResetIteratorRequest(Request): pass class ResetIteratorResponse(Response): pass class TerminateRequest(Request): pass class TerminateResponse(Resp...
pytorch-master
torch/utils/data/communication/messages.py
import inspect from functools import wraps from typing import Any, Callable, Optional, Type, Union, get_type_hints from torch.utils.data.datapipes.datapipe import IterDataPipe, MapDataPipe from torch.utils.data.datapipes._typing import _DataPipeMeta ###################################################### # Functional ...
pytorch-master
torch/utils/data/datapipes/_decorator.py
# Taking reference from official Python typing # https://github.com/python/cpython/blob/master/Lib/typing.py import collections import functools import numbers import sys from torch.utils.data.datapipes._hook_iterator import hook_iterator, _SnapshotState from typing import (Any, Dict, Iterator, Generic, List, Set, Tu...
pytorch-master
torch/utils/data/datapipes/_typing.py
import inspect import functools from enum import Enum import torch.autograd class _SnapshotState(Enum): r""" These are the snapshotting-related states that IterDataPipes can be in. `NotStarted` - allows you to restore a snapshot and create an iterator without reset `Restored` - cannot restore again, ...
pytorch-master
torch/utils/data/datapipes/_hook_iterator.py
import functools import pickle from typing import Dict, Callable, Optional, TypeVar, Generic, Iterator from torch.utils.data.datapipes._typing import _DataPipeMeta, _IterDataPipeMeta from torch.utils.data.datapipes._hook_iterator import _SnapshotState from torch.utils.data.datapipes.utils.common import ( _deprecat...
pytorch-master
torch/utils/data/datapipes/datapipe.py
from . import iter from . import map from . import dataframe
pytorch-master
torch/utils/data/datapipes/__init__.py
import os import pathlib from typing import Any, Dict, List, Set, Tuple, Union def materialize_lines(lines: List[str], indentation: int) -> str: output = "" new_line_with_indent = "\n" + " " * indentation for i, line in enumerate(lines): if i != 0: output += new_line_with_indent ...
pytorch-master
torch/utils/data/datapipes/gen_pyi.py
from torch.utils.data.datapipes.dataframe.dataframes import ( CaptureDataFrame, DFIterDataPipe, ) from torch.utils.data.datapipes.dataframe.datapipes import ( DataFramesAsTuplesPipe, ) __all__ = ['CaptureDataFrame', 'DFIterDataPipe', 'DataFramesAsTuplesPipe'] # Please keep this list sorted assert __all__ == s...
pytorch-master
torch/utils/data/datapipes/dataframe/__init__.py
import random from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import DFIterDataPipe, IterDataPipe from torch.utils.data.datapipes.dataframe import dataframe_wrapper as df_wrapper __all__ = [ "ConcatDataFramesPipe", "DataFramesAsTuplesPipe", "...
pytorch-master
torch/utils/data/datapipes/dataframe/datapipes.py
_pandas = None _WITH_PANDAS = None def _try_import_pandas() -> bool: try: import pandas # type: ignore[import] global _pandas _pandas = pandas return True except ImportError: return False # pandas used only for prototyping, will be shortly replaced with TorchArrow de...
pytorch-master
torch/utils/data/datapipes/dataframe/dataframe_wrapper.py
from torch.utils.data.datapipes.datapipe import DataChunk from torch.utils.data.datapipes.dataframe import dataframe_wrapper as df_wrapper __all__ = ["DataChunkDF", ] class DataChunkDF(DataChunk): """ DataChunkDF iterating over individual items inside of DataFrame containers, to access DataFrames...
pytorch-master
torch/utils/data/datapipes/dataframe/structures.py
from typing import Any, Dict, List from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import DFIterDataPipe, IterDataPipe from torch.utils.data.datapipes.dataframe.structures import DataChunkDF # TODO(VitalyFedyunin): Add error when two different traces get...
pytorch-master
torch/utils/data/datapipes/dataframe/dataframes.py
from io import IOBase from typing import Iterable, Tuple, Optional from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import IterDataPipe from torch.utils.data.datapipes.utils.common import get_file_binaries_from_pathnames, _deprecation_warning __all__ = [ ...
pytorch-master
torch/utils/data/datapipes/iter/fileopener.py
import functools from collections import namedtuple from typing import Callable, Iterator, Sized, TypeVar, Optional, Union, Any, Dict, List from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data._utils.collate import default_collate from torch.utils.data.datapipes.dataframe import...
pytorch-master
torch/utils/data/datapipes/iter/callable.py
from collections import defaultdict from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import IterDataPipe, DataChunk from torch.utils.data.datapipes.utils.common import _check_unpickable_fn from typing import Any, Callable, DefaultDict, Iterator, List, Optio...
pytorch-master
torch/utils/data/datapipes/iter/grouping.py
from torch.utils.data.datapipes.iter.utils import ( IterableWrapperIterDataPipe as IterableWrapper, ) from torch.utils.data.datapipes.iter.callable import ( CollatorIterDataPipe as Collator, MapperIterDataPipe as Mapper, ) from torch.utils.data.datapipes.iter.combinatorics import ( SamplerIterDataPipe a...
pytorch-master
torch/utils/data/datapipes/iter/__init__.py
from typing import Callable, Iterator, Optional, TypeVar from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import IterDataPipe from torch.utils.data.datapipes.dataframe import dataframe_wrapper as df_wrapper from torch.utils.data.datapipes.utils.common impor...
pytorch-master
torch/utils/data/datapipes/iter/selecting.py
import warnings from collections import deque from typing import Any, Callable, Iterator, List, Optional, Sized, Tuple, TypeVar, Deque from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes._hook_iterator import _SnapshotState from torch.utils.data.datapipes.datapipe imp...
pytorch-master
torch/utils/data/datapipes/iter/combining.py
from typing import Iterator, List, Sequence, Union from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import IterDataPipe from torch.utils.data.datapipes.iter import IterableWrapper from torch.utils.data.datapipes.utils.common import get_file_pathnames_from...
pytorch-master
torch/utils/data/datapipes/iter/filelister.py
import copy import warnings from torch.utils.data.datapipes.datapipe import IterDataPipe __all__ = ["IterableWrapperIterDataPipe", ] class IterableWrapperIterDataPipe(IterDataPipe): r""" Wraps an iterable object to create an IterDataPipe. Args: iterable: Iterable object to be wrapped into an Ite...
pytorch-master
torch/utils/data/datapipes/iter/utils.py
import random import torch from torch.utils.data import Sampler, SequentialSampler from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import IterDataPipe from typing import Dict, Iterator, List, Optional, Sized, Tuple, Type, TypeVar __all__ = [ "SamplerI...
pytorch-master
torch/utils/data/datapipes/iter/combinatorics.py
from typing import Tuple from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import IterDataPipe __all__ = ["StreamReaderIterDataPipe", ] @functional_datapipe('read_from_stream') class StreamReaderIterDataPipe(IterDataPipe[Tuple[str, bytes]]): r""" G...
pytorch-master
torch/utils/data/datapipes/iter/streamreader.py
from io import BufferedIOBase from typing import Any, Callable, Iterable, Iterator, Sized, Tuple from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import IterDataPipe from torch.utils.data.datapipes.utils.common import _deprecation_warning from torch.utils.d...
pytorch-master
torch/utils/data/datapipes/iter/routeddecoder.py
# This file takes partial of the implementation from NVIDIA's webdataset at here: # https://github.com/tmbdev/webdataset/blob/master/webdataset/autodecode.py import io import json import os.path import pickle import tempfile import torch from torch.utils.data.datapipes.utils.common import StreamWrapper __all__ = [ ...
pytorch-master
torch/utils/data/datapipes/utils/decoder.py
pytorch-master
torch/utils/data/datapipes/utils/__init__.py
import fnmatch import inspect import os import warnings from io import IOBase from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union from torch.utils.data._utils.serialization import DILL_AVAILABLE __all__ = [ "StreamWrapper", "get_file_binaries_from_pa...
pytorch-master
torch/utils/data/datapipes/utils/common.py
from torch.utils.data.datapipes._hook_iterator import _SnapshotState from torch.utils.data.datapipes.datapipe import IterDataPipe from torch.utils.data.graph_settings import apply_shuffle_seed # TODO: Caveats # 1. Caller (either the ReadingService or DataLoader) must pass in the initial RNG # 2. `in_batch_shuffle...
pytorch-master
torch/utils/data/datapipes/utils/snapshot.py
from torch.utils.data.datapipes.utils.common import _check_unpickable_fn from typing import Callable, TypeVar from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import MapDataPipe __all__ = ["MapperMapDataPipe", "default_fn"] T_co = TypeVar('T_co', covariant...
pytorch-master
torch/utils/data/datapipes/map/callable.py
from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import MapDataPipe, DataChunk from typing import List, Optional, Sized, TypeVar __all__ = ["BatcherMapDataPipe", ] T = TypeVar('T') @functional_datapipe('batch') class BatcherMapDataPipe(MapDataPipe[DataCh...
pytorch-master
torch/utils/data/datapipes/map/grouping.py
# Functional DataPipe from torch.utils.data.datapipes.map.callable import MapperMapDataPipe as Mapper from torch.utils.data.datapipes.map.combinatorics import ShufflerMapDataPipe as Shuffler from torch.utils.data.datapipes.map.combining import ( ConcaterMapDataPipe as Concater, ZipperMapDataPipe as Zipper ) fro...
pytorch-master
torch/utils/data/datapipes/map/__init__.py
from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import MapDataPipe from typing import Sized, Tuple, TypeVar __all__ = ["ConcaterMapDataPipe", "ZipperMapDataPipe"] T_co = TypeVar('T_co', covariant=True) @functional_datapipe('concat') class ConcaterMapDat...
pytorch-master
torch/utils/data/datapipes/map/combining.py
import copy import warnings from torch.utils.data.datapipes.datapipe import MapDataPipe __all__ = ["SequenceWrapperMapDataPipe", ] class SequenceWrapperMapDataPipe(MapDataPipe): r""" Wraps a sequence object into a MapDataPipe. Args: sequence: Sequence object to be wrapped into an MapDataPipe ...
pytorch-master
torch/utils/data/datapipes/map/utils.py
import random from torch.utils.data.datapipes._decorator import functional_datapipe from torch.utils.data.datapipes.datapipe import MapDataPipe from typing import Iterator, List, Optional, TypeVar __all__ = ["ShufflerMapDataPipe", ] T_co = TypeVar('T_co', covariant=True) @functional_datapipe('shuffle') class Shuf...
pytorch-master
torch/utils/data/datapipes/map/combinatorics.py
pytorch-master
torch/contrib/__init__.py
import time from collections import defaultdict from functools import partial from typing import DefaultDict import torch # Unfortunately it doesn't seem as if there was any way to get TensorBoard to do # anything without having TF installed, and so this file has a hard dependency on it # as well. It really is a deb...
pytorch-master
torch/contrib/_tensorboard_vis.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/quantization/observer.py`, while adding an import statement here. """ fro...
pytorch-master
torch/quantization/observer.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/quantization/fuse_modules.py`, while adding an import statement here. """...
pytorch-master
torch/quantization/fuse_modules.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/quantization/quantization_mappings.py`, while adding an import statement ...
pytorch-master
torch/quantization/quantization_mappings.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/quantization/quantize.py`, while adding an import statement here. """ fr...
pytorch-master
torch/quantization/quantize.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/ns/_numeric_suite.py`, while adding an import statement here. """ from t...
pytorch-master
torch/quantization/_numeric_suite.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/quantization/fake_quantize.py`, while adding an import statement here. ""...
pytorch-master
torch/quantization/fake_quantize.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/quantization/qconfig.py`, while adding an import statement here. """ from...
pytorch-master
torch/quantization/qconfig.py
from .quantize import * # noqa: F403 from .observer import * # noqa: F403 from .qconfig import * # noqa: F403 from .fake_quantize import * # noqa: F403 from .fuse_modules import fuse_modules from .stubs import * # noqa: F403 from .quant_type import * # noqa: F403 from .quantize_jit import * # noqa: F403 # from ....
pytorch-master
torch/quantization/__init__.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/quantization/stubs.py`, while adding an import statement here. """ from ...
pytorch-master
torch/quantization/stubs.py
# flake8: noqa: F401 r""" Utils shared by different modes of quantization (eager/graph) This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/quantizati...
pytorch-master
torch/quantization/utils.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/quantization/fuser_method_mappings.py`, while adding an import statement ...
pytorch-master
torch/quantization/fuser_method_mappings.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/quantization/quantize_jit.py`, while adding an import statement here. """...
pytorch-master
torch/quantization/quantize_jit.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/quantization/quant_type.py`, while adding an import statement here. """ ...
pytorch-master
torch/quantization/quant_type.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/quantization/quantize_fx.py`, while adding an import statement here. """ ...
pytorch-master
torch/quantization/quantize_fx.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the `torch/ao/ns/_numeric_suite_fx.py`, while adding an import statement here. """ fro...
pytorch-master
torch/quantization/_numeric_suite_fx.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the appropriate files under `torch/ao/quantization/fx/`, while adding an import stateme...
pytorch-master
torch/quantization/fx/graph_module.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the appropriate files under `torch/ao/quantization/fx/`, while adding an import stateme...
pytorch-master
torch/quantization/fx/fusion_patterns.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the appropriate files under `torch/ao/quantization/fx/`, while adding an import stateme...
pytorch-master
torch/quantization/fx/_equalize.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the appropriate files under `torch/ao/quantization/fx/`, while adding an import stateme...
pytorch-master
torch/quantization/fx/quantization_types.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the appropriate files under `torch/ao/quantization/fx/`, while adding an import stateme...
pytorch-master
torch/quantization/fx/convert.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the appropriate files under `torch/ao/quantization/fx/`, while adding an import stateme...
pytorch-master
torch/quantization/fx/__init__.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the appropriate files under `torch/ao/quantization/fx/`, while adding an import stateme...
pytorch-master
torch/quantization/fx/utils.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the appropriate files under `torch/ao/quantization/fx/`, while adding an import stateme...
pytorch-master
torch/quantization/fx/pattern_utils.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the appropriate files under `torch/ao/quantization/fx/`, while adding an import stateme...
pytorch-master
torch/quantization/fx/fuse.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the appropriate files under `torch/ao/quantization/fx/`, while adding an import stateme...
pytorch-master
torch/quantization/fx/match_utils.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the appropriate files under `torch/ao/quantization/fx/`, while adding an import stateme...
pytorch-master
torch/quantization/fx/prepare.py
# flake8: noqa: F401 r""" This file is in the process of migration to `torch/ao/quantization`, and is kept here for compatibility while the migration process is ongoing. If you are adding a new entry/functionality, please, add it to the appropriate files under `torch/ao/quantization/fx/`, while adding an import stateme...
pytorch-master
torch/quantization/fx/quantization_patterns.py
import torch from torch._C import _add_docstr, _special # type: ignore[attr-defined] from torch._torch_docs import common_args, multi_dim_common __all__ = [ 'airy_ai', 'bessel_j0', 'bessel_j1', 'bessel_y0', 'bessel_y1', 'chebyshev_polynomial_t', 'chebyshev_polynomial_u', 'chebyshev_pol...
pytorch-master
torch/special/__init__.py
""" This module contains tensor creation utilities. """ import torch from typing import Optional, List, Tuple, Union, cast import math import collections.abc # Used by make_tensor for generating complex tensor. complex_to_corresponding_float_type_map = {torch.complex32: torch.float16, ...
pytorch-master
torch/testing/_creation.py
"""This module exists since the `torch.testing` exposed a lot of stuff that shouldn't have been public. Although this was never documented anywhere, some other internal FB projects as well as downstream OSS projects might use this. Thus, we don't internalize without warning, but still go through a deprecation cycle. ""...
pytorch-master
torch/testing/_deprecated.py
from ._comparison import assert_close from torch._C import FileCheck from ._creation import make_tensor from ._deprecated import * # noqa: F403
pytorch-master
torch/testing/__init__.py
"""This module exist to be able to deprecate functions publicly without doing so internally. The deprecated public versions are defined in torch.testing._deprecated and exposed from torch.testing. The non-deprecated internal versions should be imported from torch.testing._internal """ from typing import List import t...
pytorch-master
torch/testing/_legacy.py
import abc import cmath import collections.abc import contextlib from typing import NoReturn, Callable, Sequence, List, Union, Optional, Type, Tuple, Any, Collection import torch try: import numpy as np NUMPY_AVAILABLE = True except ModuleNotFoundError: NUMPY_AVAILABLE = False class ErrorMeta(Exception...
pytorch-master
torch/testing/_comparison.py