We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
index = array(['2017-06-02T00:00:00.000000000', '2017-06-03T00:00:00.000000000', '2017-06-04T00:00:00.000000000', ..., '2021-06-28T00:00:00.000000000', '2021-06-29T00:00:00.000000000', '2021-06-30T00:00:00.000000000'], dtype='datetime64[ns]') pt.as_tensor(index) --------------------------------------------------------------------------- KeyError Traceback (most recent call last) File .venv/lib/python3.10/site-packages/pytensor/tensor/type.py:287, in TensorType.dtype_specs(self) 286 try: --> 287 return self.dtype_specs_map[self.dtype] 288 except KeyError: KeyError: 'datetime64[ns]' During handling of the above exception, another exception occurred: TypeError Traceback (most recent call last) Cell In[12], line 1 ----> 1 pt.as_tensor(index) File .venv/lib/python3.10/site-packages/pytensor/tensor/__init__.py:49, in as_tensor_variable(x, name, ndim, **kwargs) 17 def as_tensor_variable( 18 x: TensorLike, name: Optional[str] = None, ndim: Optional[int] = None, **kwargs 19 ) -> "TensorVariable": 20 """Convert `x` into an equivalent `TensorVariable`. 21 22 This function can be used to turn ndarrays, numbers, `ScalarType` instances, (...) 47 48 """ ---> 49 return _as_tensor_variable(x, name, ndim, **kwargs) File /usr/lib/python3.10/functools.py:889, in singledispatch.<locals>.wrapper(*args, **kw) 885 if not args: 886 raise TypeError(f'{funcname} requires at least ' 887 '1 positional argument') --> 889 return dispatch(args[0].__class__)(*args, **kw) File .venv/lib/python3.10/site-packages/pytensor/tensor/basic.py:176, in _as_tensor_numbers(x, name, ndim, dtype, **kwargs) 171 @_as_tensor_variable.register(np.bool_) 172 @_as_tensor_variable.register(np.number) 173 @_as_tensor_variable.register(Number) 174 @_as_tensor_variable.register(np.ndarray) 175 def _as_tensor_numbers(x, name, ndim, dtype=None, **kwargs): --> 176 return constant(x, name=name, ndim=ndim, dtype=dtype) File venv/lib/python3.10/site-packages/pytensor/tensor/basic.py:229, in constant(x, name, ndim, dtype) 223 raise ValueError( 224 f"ndarray could not be cast to constant with {int(ndim)} dimensions" 225 ) 227 assert x_.ndim == ndim --> 229 ttype = TensorType(dtype=x_.dtype, shape=x_.shape) 231 return TensorConstant(ttype, x_, name=name) File .venv/lib/python3.10/site-packages/pytensor/tensor/type.py:116, in TensorType.__init__(self, dtype, shape, name, broadcastable) 113 return s 115 self.shape = tuple(parse_bcast_and_shape(s) for s in shape) --> 116 self.dtype_specs() # error checking is done there 117 self.name = name 118 self.numpy_dtype = np.dtype(self.dtype) File .venv/lib/python3.10/site-packages/pytensor/tensor/type.py:289, in TensorType.dtype_specs(self) 287 return self.dtype_specs_map[self.dtype] 288 except KeyError: --> 289 raise TypeError( 290 f"Unsupported dtype for {self.__class__.__name__}: {self.dtype}" 291 ) TypeError: Unsupported dtype for TensorType: datetime64[ns]
No error
Would be nice to have native support for datetimes in pytensor
The text was updated successfully, but these errors were encountered:
What is the case for supporting this? Do you want to do operations on time variables? That's fine but a considerable effort akin to #259
Sorry, something went wrong.
No branches or pull requests
Before
After
Context for the issue:
Would be nice to have native support for datetimes in pytensor
The text was updated successfully, but these errors were encountered: