pytensor¶
- template <class T, std::size_t N>
-
class
xt::
pytensor
¶ Multidimensional container providing the xtensor container semantics wrapping a numpy array.
pytensor is similar to the xtensor container in that it has a static dimensionality.
Unlike with the pyarray container, pytensor cannot be reshaped with a different number of dimensions and reshapes are not reflected on the Python side. However, pytensor has benefits compared to pyarray in terms of performances. pytensor shapes are stack-allocated which makes iteration upon pytensor faster than with pyarray.
- See
- pyarray
- Template Parameters
T
: The type of the element stored in the pyarray.
Inherits from xt::pycontainer< pytensor< T, N > >, xcontainer_semantic< pytensor< T, N > >
Constructors
-
pytensor
()¶ Allocates an uninitialized pytensor that holds 1 element.
-
pytensor
(nested_initializer_list_t<T, N> t)¶ Allocates a pytensor with a nested initializer list.
-
pytensor
(const shape_type &shape, layout_type l = layout_type::row_major)¶ Allocates an uninitialized pytensor with the specified shape and layout.
- Parameters
shape
: the shape of the pytensorl
: the layout_type of the pytensor
-
pytensor
(const shape_type &shape, const_reference value, layout_type l = layout_type::row_major)¶ Allocates a pytensor with the specified shape and layout.
Elements are initialized to the specified value.
- Parameters
shape
: the shape of the pytensorvalue
: the value of the elementsl
: the layout_type of the pytensor
-
pytensor
(const shape_type &shape, const strides_type &strides, const_reference value)¶ Allocates an uninitialized pytensor with the specified shape and strides.
Elements are initialized to the specified value.
- Parameters
shape
: the shape of the pytensorstrides
: the strides of the pytensorvalue
: the value of the elements
-
pytensor
(const shape_type &shape, const strides_type &strides)¶ Allocates an uninitialized pytensor with the specified shape and strides.
- Parameters
shape
: the shape of the pytensorstrides
: the strides of the pytensor