Skip to content

Commit c894b08

Browse files
author
Ian Schweer
committed
Late import torch
1 parent f0507d5 commit c894b08

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,7 +1,5 @@
11
from typing import Any
22

3-
from torch import is_tensor
4-
53
from pytensor.graph.basic import Variable
64
from pytensor.link.basic import JITLinker
75

@@ -15,6 +13,8 @@ def input_filter(self, inp: Any) -> Any:
1513
return pytorch_typify(inp)
1614

1715
def output_filter(self, var: Variable, out: Any) -> Any:
16+
from torch import is_tensor
17+
1818
if is_tensor(out):
1919
return out.cpu()
2020
else:

0 commit comments

Comments
 (0)