Skip to content

Commit

Permalink
apply pyfmt with usort to opted-in sources
Browse files Browse the repository at this point in the history
Reviewed By: zertosh

Differential Revision: D24880203

fbshipit-source-id: 2034cdfc2712209e86d3d05c119c58f979b05c52
  • Loading branch information
amyreese authored and facebook-github-bot committed Nov 11, 2020
1 parent 273a961 commit 2f2beaf
Show file tree
Hide file tree
Showing 22 changed files with 38 additions and 37 deletions.
2 changes: 1 addition & 1 deletion torch_glow/examples/basic_example.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# isort:skip_file
from __future__ import absolute_import, division, print_function, unicode_literals

import torch_glow
import torch
import torch_glow

x = torch.randn(4)
y = torch.randn(4)
Expand Down
2 changes: 1 addition & 1 deletion torch_glow/examples/profiling_executor_example.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# isort:skip_file
from __future__ import absolute_import, division, print_function, unicode_literals

import torch_glow
import torch
import torch.nn as nn
import torch_glow


class Model(nn.Module):
Expand Down
2 changes: 1 addition & 1 deletion torch_glow/examples/resnet_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import argparse

import torch_glow
import torch
import torch_glow
import utils.torchvision_fake.resnet as resnet
import utils.torchvision_fake.transforms as torchvisionTransforms
from PIL import Image
Expand Down
6 changes: 3 additions & 3 deletions torch_glow/tests/functionality/blacklist_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# isort:skip_file
from __future__ import absolute_import, division, print_function, unicode_literals

import torch_glow
import torch
import unittest

import torch
import torch_glow
from tests.utils import GLOW_FUSION_GROUP, SUBGRAPH_ATTR
import unittest


class TestBlackList(unittest.TestCase):
Expand Down
6 changes: 3 additions & 3 deletions torch_glow/tests/functionality/compilation_spec_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# isort:skip_file
from __future__ import absolute_import, division, print_function, unicode_literals

import torch_glow
import torch
import pickle
import unittest

import pickle
import torch
import torch_glow


class TestCompilationSpec(unittest.TestCase):
Expand Down
6 changes: 3 additions & 3 deletions torch_glow/tests/functionality/conv_to_glow_test.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# isort:skip_file
from __future__ import absolute_import, division, print_function, unicode_literals

import torch_glow
import torch
import unittest

from collections import OrderedDict

import torch
import torch_glow


def create_model(x, relu, bias=True):
""" x is an example input, relu is whether or not to include a fused relu"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# isort:skip_file
from __future__ import absolute_import, division, print_function, unicode_literals

import torch_glow
import torch
import torch_glow


class LinearModel(torch.nn.Module):
Expand Down
2 changes: 1 addition & 1 deletion torch_glow/tests/functionality/fused_linear_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import unittest

import torch_glow
import torch
import torch_glow
from tests.utils import graph_contains_str


Expand Down
2 changes: 1 addition & 1 deletion torch_glow/tests/functionality/jit_vs_glow_path_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import unittest

import torch_glow
import torch
import torch.nn.functional as F
import torch_glow
from tests import utils


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import tempfile
import unittest

import torch_glow
import torch
import torch_glow


class TestLoadBackendSpecificOptions(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import unittest

import torch_glow
import torch
import torch_glow
from tests.utils import GLOW_FUSION_GROUP


Expand Down
6 changes: 3 additions & 3 deletions torch_glow/tests/functionality/min_graph_size_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# isort:skip_file
from __future__ import absolute_import, division, print_function, unicode_literals

import torch_glow
import torch
import unittest

import torch
import torch_glow
from tests.utils import GLOW_FUSION_GROUP
import unittest


class TestMinGraphSize(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion torch_glow/tests/functionality/only_tensor_outputs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import unittest

import torch_glow
import torch
import torch_glow
from tests.utils import GLOW_FUSION_GROUP


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import unittest

import torch_glow
import torch
import torch_glow
from tests.utils import GLOW_FUSION_GROUP


Expand Down
2 changes: 1 addition & 1 deletion torch_glow/tests/functionality/randomize_constants_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import unittest

import torch_glow
import torch
import torch_glow


class Model(torch.nn.Module):
Expand Down
2 changes: 1 addition & 1 deletion torch_glow/tests/functionality/remove_exceptions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import unittest

import torch_glow
import torch
import torch_glow
from tests.utils import graph_contains_str


Expand Down
2 changes: 1 addition & 1 deletion torch_glow/tests/functionality/to_glow_selective_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import unittest

import torch_glow
import torch
import torch_glow


class Qux(torch.nn.Module):
Expand Down
5 changes: 3 additions & 2 deletions torch_glow/tests/nodes/getattr_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# isort:skip_file
from __future__ import absolute_import, division, print_function, unicode_literals

import torch_glow
import unittest

import torch
import torch_glow
from tests.utils import GLOW_FUSION_GROUP, SUBGRAPH_ATTR
import unittest


class TestGetAttr(unittest.TestCase):
Expand Down
6 changes: 3 additions & 3 deletions torch_glow/tests/nodes/sigmoid_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# isort:skip_file
from __future__ import absolute_import, division, print_function, unicode_literals

import torch
import unittest

from tests import utils
import torch
from parameterized import parameterized
import unittest
from tests import utils


class SimpleSigmoidModel(torch.nn.Module):
Expand Down
1 change: 0 additions & 1 deletion torch_glow/tests/nodes/upsample_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import torch
from parameterized import parameterized

from tests import utils


Expand Down
8 changes: 4 additions & 4 deletions torch_glow/tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# isort:skip_file
from __future__ import absolute_import, division, print_function, unicode_literals
from copy import deepcopy

import itertools
import os
from contextlib import contextmanager
from copy import deepcopy

import torch_glow
import torch

from contextlib import contextmanager
import torch_glow

GLOW_FUSION_GROUP = "glow::FusionGroup"
SUBGRAPH_ATTR = "Subgraph"
Expand Down
5 changes: 3 additions & 2 deletions utils/caffe2_train_and_dump_pb.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@

def DownloadResource(url, path):
"""Downloads resources from s3 by url and unzips them to the provided path"""
import requests
import zipfile
import StringIO
import zipfile

import requests

print("Downloading... {} to {}".format(url, path))
r = requests.get(url, stream=True)
Expand Down

0 comments on commit 2f2beaf

Please sign in to comment.