Skip to content

linspace and retstep=True fails #1297

Open
@williambdean

Description

@williambdean

retstep=True returns a tuple which doesn't work with the astype

ls = _linspace_core(
start=start,
stop=stop,
num=num,
endpoint=endpoint,
retstep=retstep,
axis=axis,
)
return ls.astype(dtype)

[ins] In [1]: import pytensor.tensor as pt

[ins] In [2]: pt.linspace(0, 1, retstep=True)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[2], line 1
----> 1 pt.linspace(0, 1, retstep=True)

File ~/GitHub/pymc-eco/pytensor/pytensor/tensor/extra_ops.py:1808, in linspace(start, stop, num, endpoint, retstep, dtype, axis, end, steps)
   1797 start, stop = broadcast_arrays(start, stop)
   1799 ls = _linspace_core(
   1800     start=start,
   1801     stop=stop,
   (...)
   1805     axis=axis,
   1806 )
-> 1808 return ls.astype(dtype)

AttributeError: 'tuple' object has no attribute 'astype'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions