We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2fb9f0e commit ae76cdfCopy full SHA for ae76cdf
pytensor/link/pytorch/dispatch/basic.py
@@ -1,4 +1,5 @@
1
from functools import singledispatch
2
+from types import NoneType
3
4
import torch
5
@@ -12,8 +13,11 @@
12
13
@singledispatch
14
def pytorch_typify(data, dtype=None, **kwargs):
15
r"""Convert instances of PyTensor `Type`\s to PyTorch types."""
- if data is not None:
16
- return torch.as_tensor(data, dtype=dtype)
+ return torch.as_tensor(data, dtype=dtype)
17
+
18
19
+@pytorch_typify.register(NoneType)
20
+def pytorch_typify_None(data, **kwargs):
21
return None
22
23
0 commit comments