| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -744,6 +744,11 @@ namespace xt | |||
| 744 | 744 | template <class T, layout_type L> | |
| 745 | 745 | inline void pyarray<T, L>::init_from_python() | |
| 746 | 746 | { | |
| 747 | + if (!static_cast<bool>(*this)) | ||
| 748 | + { | ||
| 749 | + return; | ||
| 750 | + } | ||
| 751 | + | ||
| 747 | 752 | m_shape = inner_shape_type(reinterpret_cast<size_type*>(PyArray_SHAPE(this->python_array())), | |
| 748 | 753 | static_cast<size_type>(PyArray_NDIM(this->python_array()))); | |
| 749 | 754 | m_strides = inner_strides_type(reinterpret_cast<difference_type*>(PyArray_STRIDES(this->python_array())), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -442,6 +442,11 @@ namespace xt | |||
| 442 | 442 | template <class T, std::size_t N, layout_type L> | |
| 443 | 443 | inline void pytensor<T, N, L>::init_from_python() | |
| 444 | 444 | { | |
| 445 | + if (!static_cast<bool>(*this)) | ||
| 446 | + { | ||
| 447 | + return; | ||
| 448 | + } | ||
| 449 | + | ||
| 445 | 450 | if (PyArray_NDIM(this->python_array()) != N) | |
| 446 | 451 | { | |
| 447 | 452 | throw std::runtime_error("NumPy: ndarray has incorrect number of dimensions"); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments