Skip to content

Commit 2dce8e4

Browse files
author
Ian Schweer
committed
Late import torch
1 parent 851128f commit 2dce8e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pytensor/link/pytorch/linker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import copy
22
from typing import Any
33

4-
from torch import is_tensor
5-
64
from pytensor.graph.basic import Variable
75
from pytensor.link.basic import JITLinker
86
from pytensor.link.utils import unique_name_generator
@@ -21,6 +19,8 @@ def input_filter(self, inp: Any) -> Any:
2119
return pytorch_typify(inp)
2220

2321
def output_filter(self, var: Variable, out: Any) -> Any:
22+
from torch import is_tensor
23+
2424
if is_tensor(out):
2525
return out.cpu()
2626
else:

0 commit comments

Comments
 (0)