switch to row_major default by wolfv · Pull Request #195 · xtensor-stack/xtensor-python · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions docs/source/array_tensor.rst
8 changes: 4 additions & 4 deletions include/xtensor-python/pyarray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace xt
{
template <class T, layout_type L = layout_type::dynamic>
template <class T, layout_type L = layout_type::row_major>
class pyarray;
}

Expand Down Expand Up @@ -682,7 +682,7 @@ namespace xt

if (!tmp)
{
throw std::runtime_error("NumPy: unable to create ndarray");
throw std::runtime_error("pyarray: unable to create ndarray");
}

this->m_ptr = tmp.release().ptr();
Expand Down Expand Up @@ -771,7 +771,7 @@ namespace xt

if (!tmp)
{
throw std::runtime_error("NumPy: unable to create ndarray");
throw std::runtime_error("pyarray: unable to create ndarray");
}

this->m_ptr = tmp.release().ptr();
Expand All @@ -793,7 +793,7 @@ namespace xt

if (L != layout_type::dynamic && !do_strides_match(m_shape, m_strides, L, 1))
{
throw std::runtime_error("NumPy: passing container with bad strides for layout (is it a view?).");
throw std::runtime_error("pyarray: passing container with wrong strides for static layout. If you are trying to pass a view, set the pytensor layout template parameter to `layout_type::dynamic`, or `layout_type::column_major` for col major.");
}

m_backstrides = backstrides_type(*this);
Expand Down
8 changes: 4 additions & 4 deletions include/xtensor-python/pytensor.hpp