Skip to content

Conversation

davidbrochart
Copy link
Member

No description provided.

@davidbrochart
Copy link
Member Author

Looks like we can't assign an xarray to a chunked file array.

@davidbrochart
Copy link
Member Author

OK so this is because:

// not correct:
auto a = xt::arange(4 * 4).reshape({4, 4});
// correct:
auto a = xt::arange(4 * 4);
a.reshape({4, 4});

This is a different behavior than NumPy, where you do:

a = np.arange(4 * 4).reshape(4, 4)

@davidbrochart
Copy link
Member Author

/usr/share/miniconda/envs/xtensor-io/include/xtensor/xnoalias.hpp:165:32: error: invalid initialization of non-const reference of type 'xt::xchunked_array<xt::xchunk_store_manager<xt::xfile_array_container<xt::xarray_container<xt::uvector<double, std::allocator<double> >, xt::layout_type::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>, xt::xio_disk_handler<xt::xio_binary_config> >, xt::xindex_path>, xt::empty_extension>&' from an rvalue of type 'void'
  165 |         return m_array.assign(e);
      |               

@JohanMabille
Copy link
Member

The root cause is that noalias does not work with chunked_array. This has to be fixed in xtensor.

@JohanMabille
Copy link
Member

xtensor-stack/xtensor#2256 should fix it.

@davidbrochart
Copy link
Member Author

xtensor-stack/xtensor#2256 should fix it.

It fixes it. I'll remove the dependency on master in this PR when we get an xtensor release.

@JohanMabille
Copy link
Member

Let's fix it after the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants