Skip to content

Adapting std::array and using in expression results in xtensor, not xtensor_fixed #2337

Open
@vakokako

Description

@vakokako

Take a look at this example:

std::array shape{3, 4, 5};
auto shape_adapt = xt::adapt(shape);
auto tensor = xt::eval(2 * shape_adapt);

The resulting type of tensor is xtensor_container, which is vector underneath. So we went from array to vector.

This is a very common use case for working with tensor shapes and would optimize quite a bit. Currently we go for std::transform and xtl::make_sequence in these cases, which is not so nice. Adapting shapes would be much nicer))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions