Skip to content

Commit

Permalink
fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
rsokl committed Sep 7, 2024
1 parent 6c8dc95 commit 70950e0
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/mygrad/_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from weakref import ReferenceType

if TYPE_CHECKING: # pragma: no cover
from mygrad import Tensor
from mygrad.operation_base import Operation # noqa: F401
from mygrad.tensor_base import Tensor

__all__ = [
"collect_all_operations_and_clear_grads",
Expand Down
2 changes: 1 addition & 1 deletion src/mygrad/_utils/duplicating_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from mygrad.operation_base import Operation

if TYPE_CHECKING: # pragma: no cover
from mygrad import Tensor
from mygrad.tensor_base import Tensor


T = TypeVar("T")
Expand Down
14 changes: 4 additions & 10 deletions src/mygrad/_utils/lock_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@

import os
from collections import Counter, defaultdict
from typing import (
TYPE_CHECKING,
Counter as CounterType,
DefaultDict,
Dict,
Generator,
Iterable,
Set,
)
from typing import TYPE_CHECKING
from typing import Counter as CounterType
from typing import DefaultDict, Dict, Generator, Iterable, Set
from weakref import finalize, ref

import numpy as np

from mygrad._utils import ContextTracker, WeakRef, WeakRefIterable

if TYPE_CHECKING: # pragma: no cover
from mygrad import Tensor as TensorType
from mygrad.tensor_base import Tensor as TensorType


# arr-id -> num active ops involving arr
Expand Down
2 changes: 1 addition & 1 deletion src/mygrad/math/arithmetic/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from mygrad.operation_base import BinaryUfunc, Operation, UnaryUfunc

if TYPE_CHECKING: # pragma: no cover
from mygrad import Tensor
from mygrad.tensor_base import Tensor

__all__ = [
"Add",
Expand Down
2 changes: 1 addition & 1 deletion src/mygrad/nnet/activations/elu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import numpy as np

from mygrad import Tensor
from mygrad.operation_base import Operation
from mygrad.tensor_base import Tensor
from mygrad.typing import ArrayLike

__all__ = ["elu"]
Expand Down
3 changes: 2 additions & 1 deletion src/mygrad/nnet/activations/glu.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from numpy import ndarray

from mygrad import Tensor, multiply
from mygrad.math.arithmetic.funcs import multiply
from mygrad.tensor_base import Tensor
from mygrad.typing import ArrayLike

from .sigmoid import sigmoid
Expand Down
2 changes: 1 addition & 1 deletion src/mygrad/nnet/activations/selu.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import numpy as np

from mygrad import Tensor
from mygrad.operation_base import Operation
from mygrad.tensor_base import Tensor
from mygrad.typing import ArrayLike

__all__ = ["selu"]
Expand Down
2 changes: 1 addition & 1 deletion src/mygrad/nnet/initializers/dirac.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import numpy as np

from mygrad import Tensor
from mygrad.tensor_base import Tensor


def dirac(*shape: int, dtype=np.float32, constant: Optional[bool] = None) -> Tensor:
Expand Down
2 changes: 1 addition & 1 deletion src/mygrad/nnet/initializers/glorot_normal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

from mygrad import Tensor
from mygrad.tensor_base import Tensor


def glorot_normal(*shape, gain=1, dtype=np.float32, constant=None):
Expand Down
2 changes: 1 addition & 1 deletion src/mygrad/nnet/initializers/normal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

from mygrad import Tensor
from mygrad.tensor_base import Tensor


def normal(*shape, mean=0, std=1, dtype=np.float32, constant=None):
Expand Down
2 changes: 1 addition & 1 deletion src/mygrad/nnet/initializers/uniform.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

from mygrad import Tensor
from mygrad.tensor_base import Tensor


def uniform(*shape, lower_bound=0, upper_bound=1, dtype=np.float32, constant=None):
Expand Down
4 changes: 2 additions & 2 deletions src/mygrad/nnet/layers/batchnorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import numpy as np

from mygrad import Tensor
from mygrad.operation_base import Operation
from mygrad.tensor_base import Tensor
from mygrad.typing import ArrayLike

__all__ = ["batchnorm"]
Expand Down Expand Up @@ -114,7 +114,7 @@ def batchnorm(
gamma: Optional[ArrayLike] = None,
beta: Optional[ArrayLike] = None,
eps: float,
constant: Optional[bool] = None
constant: Optional[bool] = None,
) -> Tensor:
"""
Performs batch normalization on ``x``::
Expand Down
3 changes: 2 additions & 1 deletion src/mygrad/nnet/losses/negative_log_likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import numpy as np

from mygrad import Tensor, asarray, mean
from mygrad.math.sequential.funcs import mean
from mygrad.tensor_base import Tensor, asarray
from mygrad.typing import ArrayLike

from ._utils import check_loss_inputs
Expand Down
2 changes: 1 addition & 1 deletion src/mygrad/operation_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from mygrad.typing import DTypeLike, Mask

if TYPE_CHECKING: # pragma: no cover
from mygrad import Tensor
from mygrad.tensor_base import Tensor


__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion src/mygrad/random/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import numpy as np

from mygrad import Tensor
from mygrad.tensor_base import Tensor
from mygrad.typing import Shape


Expand Down

0 comments on commit 70950e0

Please sign in to comment.