@@ -86,28 +86,30 @@ def _iota(shape: TensorVariable, axis: int) -> TensorVariable:
86
86
87
87
.. testcode::
88
88
89
- import pytensor as pt
90
- shape = pt.as_tensor('shape', (5,))
91
- print(pt._iota(shape, 0).eval())
89
+ import pytensor.tensor as pt
90
+ from pytensor.tensor.einsum import _iota
91
+
92
+ shape = pt.as_tensor((5,))
93
+ print(_iota(shape, 0).eval())
92
94
93
95
.. testoutput::
94
96
95
- [0., 1., 2., 3., 4. ]
97
+ [0 1 2 3 4 ]
96
98
97
- In higher dimensions, it will look like many concatenated `pt. arange`:
99
+ In higher dimensions, it will look like many concatenated `arange`:
98
100
99
101
.. testcode::
100
102
101
- shape = pt.as_tensor('shape', (5, 5))
102
- print(pt. _iota(shape, 1).eval())
103
+ shape = pt.as_tensor((5, 5))
104
+ print(_iota(shape, 1).eval())
103
105
104
106
.. testoutput::
105
107
106
- [[0., 1., 2., 3., 4.],
107
- [0., 1., 2., 3., 4.],
108
- [0., 1., 2., 3., 4.],
109
- [0., 1., 2., 3., 4.],
110
- [0., 1., 2., 3., 4. ]]
108
+ [[0 1 2 3 4]
109
+ [0 1 2 3 4]
110
+ [0 1 2 3 4]
111
+ [0 1 2 3 4]
112
+ [0 1 2 3 4 ]]
111
113
112
114
Setting ``axis=0`` above would result in the transpose of the output.
113
115
"""
@@ -218,14 +220,14 @@ def _general_dot(
218
220
from pytensor.tensor.einsum import _general_dot
219
221
import numpy as np
220
222
221
- A = pt.tensor(shape = (3, 4, 5))
222
- B = pt.tensor(shape = (3, 5, 2))
223
+ A = pt.tensor(shape= (3, 4, 5))
224
+ B = pt.tensor(shape= (3, 5, 2))
223
225
224
226
result = _general_dot((A, B), axes=[[2], [1]], batch_axes=[[0], [0]])
225
227
226
228
A_val = np.empty((3, 4, 5))
227
229
B_val = np.empty((3, 5, 2))
228
- print(result.shape.eval({A:A_val, B:B_val}))
230
+ print(tuple( result.shape.eval({A:A_val, B:B_val}) ))
229
231
230
232
.. testoutput::
231
233
0 commit comments