From 802ac297cc6a838991616e2243efc977463405f9 Mon Sep 17 00:00:00 2001 From: Jiarui Fang Date: Wed, 18 May 2022 14:54:51 +0800 Subject: [PATCH] [Tensor] remove useless import in tensor dir (#997) --- colossalai/tensor/_ops/addmm.py | 5 +---- colossalai/tensor/_ops/embedding.py | 6 +----- colossalai/tensor/colo_tensor.py | 5 +---- colossalai/tensor/dist_spec_mgr.py | 1 - 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/colossalai/tensor/_ops/addmm.py b/colossalai/tensor/_ops/addmm.py index 30f01d2cd..eb9f59b9d 100644 --- a/colossalai/tensor/_ops/addmm.py +++ b/colossalai/tensor/_ops/addmm.py @@ -1,11 +1,8 @@ import torch from typing import Union from colossalai.tensor.op_wrapper import colo_op_impl -from colossalai.nn.layer.parallel_1d._utils import split_forward_gather_backward, reduce_input, reduce_grad -from colossalai.nn.layer.utils import divide -from colossalai.core import global_context as gpc +from colossalai.nn.layer.parallel_1d._utils import reduce_input, reduce_grad from colossalai.tensor import ComputePattern, TensorSpec, ComputePattern, ParallelAction, ColoTensor -from colossalai.tensor.graph import GraphOpNode, GraphGlobalEnv from colossalai.tensor import dist_spec diff --git a/colossalai/tensor/_ops/embedding.py b/colossalai/tensor/_ops/embedding.py index 308794f98..36b1ea92f 100644 --- a/colossalai/tensor/_ops/embedding.py +++ b/colossalai/tensor/_ops/embedding.py @@ -1,11 +1,7 @@ import torch from colossalai.tensor.op_wrapper import colo_op_impl -from colossalai.context import ParallelMode -from colossalai.nn.layer.parallel_1d._utils import split_forward_gather_backward, reduce_input, \ - gather_forward_split_backward, reduce_grad -from colossalai.nn.layer.utils import divide +from colossalai.nn.layer.parallel_1d._utils import reduce_input from colossalai.core import global_context as gpc -from packaging import version from colossalai.tensor import ComputePattern, TensorSpec, ComputePattern, ParallelAction, ColoTensor, dist_spec diff --git a/colossalai/tensor/colo_tensor.py b/colossalai/tensor/colo_tensor.py index d5ff84349..21412b87a 100644 --- a/colossalai/tensor/colo_tensor.py +++ b/colossalai/tensor/colo_tensor.py @@ -3,10 +3,7 @@ from copy import copy import torch from typing import Tuple, Optional, Callable, Union from numpy import product -from colossalai.core import global_context as gpc -from colossalai.nn.layer.utils import divide -from colossalai.tensor import TensorSpec, ComputePattern -from colossalai.nn.layer.parallel_1d._utils import split_forward_gather_backward, gather_forward_split_backward +from colossalai.tensor import TensorSpec from .const import TensorType from colossalai.tensor import dist_spec from colossalai.tensor.dist_spec_mgr import DistSpecManager diff --git a/colossalai/tensor/dist_spec_mgr.py b/colossalai/tensor/dist_spec_mgr.py index ef4a1a359..714660bc6 100644 --- a/colossalai/tensor/dist_spec_mgr.py +++ b/colossalai/tensor/dist_spec_mgr.py @@ -1,4 +1,3 @@ -from math import dist from colossalai.tensor.dist_spec import _DistSpec from colossalai.nn.layer.utils import divide from numpy import prod