Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
import importlib.machinery


def _download_file_from_remote_location(fpath: str, url: str) -> None:
pass


def _is_remote_location_available() -> bool:
return False


try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url


def _get_extension_path(lib_name):

lib_dir = os.path.dirname(__file__)
Expand Down
6 changes: 0 additions & 6 deletions torchvision/datasets/_utils.py

This file was deleted.

2 changes: 1 addition & 1 deletion torchvision/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import torch
from torch.utils.model_zoo import tqdm

from ._utils import (
from .._internally_replaced_utils import (
_download_file_from_remote_location,
_is_remote_location_available,
)
Expand Down
2 changes: 1 addition & 1 deletion torchvision/extension.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import torch

from ._register_extension import _get_extension_path
from ._internally_replaced_utils import _get_extension_path


_HAS_OPS = False
Expand Down
2 changes: 1 addition & 1 deletion torchvision/io/_video_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np
import torch

from .._register_extension import _get_extension_path
from .._internally_replaced_utils import _get_extension_path


try:
Expand Down
2 changes: 1 addition & 1 deletion torchvision/io/image.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import torch
from enum import Enum

from .._register_extension import _get_extension_path
from .._internally_replaced_utils import _get_extension_path


try:
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/alexnet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import torch
import torch.nn as nn
from .utils import load_state_dict_from_url
from .._internally_replaced_utils import load_state_dict_from_url
from typing import Any


Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/densenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import torch.nn.functional as F
import torch.utils.checkpoint as cp
from collections import OrderedDict
from .utils import load_state_dict_from_url
from .._internally_replaced_utils import load_state_dict_from_url
from torch import Tensor
from typing import Any, List, Tuple

Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/detection/faster_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from torchvision.ops import MultiScaleRoIAlign

from ._utils import overwrite_eps
from ..utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url

from .anchor_utils import AnchorGenerator
from .generalized_rcnn import GeneralizedRCNN
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/detection/keypoint_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from torchvision.ops import MultiScaleRoIAlign

from ._utils import overwrite_eps
from ..utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url

from .faster_rcnn import FasterRCNN
from .backbone_utils import resnet_fpn_backbone, _validate_trainable_layers
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/detection/mask_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from torchvision.ops import MultiScaleRoIAlign

from ._utils import overwrite_eps
from ..utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url

from .faster_rcnn import FasterRCNN
from .backbone_utils import resnet_fpn_backbone, _validate_trainable_layers
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/detection/retinanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import Dict, List, Tuple, Optional

from ._utils import overwrite_eps
from ..utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url

from . import _utils as det_utils
from .anchor_utils import AnchorGenerator
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/detection/ssd.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from .backbone_utils import _validate_trainable_layers
from .transform import GeneralizedRCNNTransform
from .. import vgg
from ..utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url
from ...ops import boxes as box_ops

__all__ = ['SSD', 'ssd300_vgg16']
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/detection/ssdlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .backbone_utils import _validate_trainable_layers
from .. import mobilenet
from ..mobilenetv3 import ConvBNActivation
from ..utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url


__all__ = ['ssdlite320_mobilenet_v3_large']
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/googlenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from .utils import load_state_dict_from_url
from .._internally_replaced_utils import load_state_dict_from_url
from typing import Optional, Tuple, List, Callable, Any

__all__ = ['GoogLeNet', 'googlenet', "GoogLeNetOutputs", "_GoogLeNetOutputs"]
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/inception.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import torch
from torch import nn, Tensor
import torch.nn.functional as F
from .utils import load_state_dict_from_url
from .._internally_replaced_utils import load_state_dict_from_url
from typing import Callable, Any, Optional, Tuple, List


Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/mnasnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import torch
from torch import Tensor
import torch.nn as nn
from .utils import load_state_dict_from_url
from .._internally_replaced_utils import load_state_dict_from_url
from typing import Any, Dict, List

__all__ = ['MNASNet', 'mnasnet0_5', 'mnasnet0_75', 'mnasnet1_0', 'mnasnet1_3']
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/mobilenetv2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import torch
from torch import nn
from torch import Tensor
from .utils import load_state_dict_from_url
from .._internally_replaced_utils import load_state_dict_from_url
from typing import Callable, Any, Optional, List


Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/mobilenetv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from torch.nn import functional as F
from typing import Any, Callable, Dict, List, Optional, Sequence

from torchvision.models.utils import load_state_dict_from_url
from .._internally_replaced_utils import load_state_dict_from_url
from torchvision.models.mobilenetv2 import _make_divisible, ConvBNActivation


Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/quantization/googlenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import torch.nn as nn
from torch.nn import functional as F

from torchvision.models.utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url
from torchvision.models.googlenet import (
GoogLeNetOutputs, BasicConv2d, Inception, InceptionAux, GoogLeNet, model_urls)

Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/quantization/inception.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import torch.nn.functional as F
from torchvision.models import inception as inception_module
from torchvision.models.inception import InceptionOutputs
from torchvision.models.utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url
from .utils import _replace_relu, quantize_model


Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/quantization/mobilenetv2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from torch import nn
from torchvision.models.utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url
from torchvision.models.mobilenetv2 import InvertedResidual, ConvBNReLU, MobileNetV2, model_urls
from torch.quantization import QuantStub, DeQuantStub, fuse_modules
from .utils import _replace_relu, quantize_model
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/quantization/mobilenetv3.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import torch
from torch import nn, Tensor
from torchvision.models.utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url
from torchvision.models.mobilenetv3 import InvertedResidual, InvertedResidualConfig, ConvBNActivation, MobileNetV3,\
SqueezeExcitation, model_urls, _mobilenet_v3_conf
from torch.quantization import QuantStub, DeQuantStub, fuse_modules
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/quantization/resnet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import torch
from torchvision.models.resnet import Bottleneck, BasicBlock, ResNet, model_urls
import torch.nn as nn
from torchvision.models.utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url
from torch.quantization import fuse_modules
from .utils import _replace_relu, quantize_model

Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/quantization/shufflenetv2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import torch
import torch.nn as nn
from torchvision.models.utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url
import torchvision.models.shufflenetv2
import sys
from .utils import _replace_relu, quantize_model
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/resnet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import torch
from torch import Tensor
import torch.nn as nn
from .utils import load_state_dict_from_url
from .._internally_replaced_utils import load_state_dict_from_url
from typing import Type, Any, Callable, Union, List, Optional


Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/segmentation/segmentation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .._utils import IntermediateLayerGetter
from ..utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url
from .. import mobilenetv3
from .. import resnet
from .deeplabv3 import DeepLabHead, DeepLabV3
Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/shufflenetv2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import torch
from torch import Tensor
import torch.nn as nn
from .utils import load_state_dict_from_url
from .._internally_replaced_utils import load_state_dict_from_url
from typing import Callable, Any, List


Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/squeezenet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import torch
import torch.nn as nn
import torch.nn.init as init
from .utils import load_state_dict_from_url
from .._internally_replaced_utils import load_state_dict_from_url
from typing import Any

__all__ = ['SqueezeNet', 'squeezenet1_0', 'squeezenet1_1']
Expand Down
7 changes: 0 additions & 7 deletions torchvision/models/utils.py

This file was deleted.

2 changes: 1 addition & 1 deletion torchvision/models/vgg.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import torch
import torch.nn as nn
from .utils import load_state_dict_from_url
from .._internally_replaced_utils import load_state_dict_from_url
from typing import Union, List, Dict, Any, cast


Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/video/resnet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import torch.nn as nn

from ..utils import load_state_dict_from_url
from ..._internally_replaced_utils import load_state_dict_from_url


__all__ = ['r3d_18', 'mc3_18', 'r2plus1d_18']
Expand Down