diff --git a/include/aidge/data/Tensor.hpp b/include/aidge/data/Tensor.hpp index 6c256746dc626cd30e5cb8928e65ca56fa8d8b38..6c51af6ab188b16a5eea83a6a144c7527075f2fc 100644 --- a/include/aidge/data/Tensor.hpp +++ b/include/aidge/data/Tensor.hpp @@ -446,9 +446,15 @@ class Tensor : public Data, constexpr std::size_t sizeM1() const { return mSizeM1; } /** - * @brief Change the shape of the Tensor object according to the given argument. - * @tparam DIM new dimensions. - * @param dims + * @brief Change the dimensions of the Tensor object according to the given argument. + * If the overall size is not changed (meaning we actually only performed a + * reshape), data is garanteed to remain valid. + * Otherwise, no garantee is provided regarding the validy of previous data + * (unlike std::vector). If the new overall size is larger than the previous + * one, all previous data is invalided. Otherwise, previous data may or may + * not remain valid, depending on the backend implementation. + * @tparam DIM Number of dimensions. + * @param dims New dimensions */ template <std::array<DimSize_t, 1>::size_type DIM> // deducing std::array size_type and declaring DIM accordingly void resize(const std::array<DimSize_t, DIM> &dims) { @@ -457,6 +463,16 @@ class Tensor : public Data, computeSize(); } + /** + * @brief Change the dimensions of the Tensor object according to the given argument. + * If the overall size is not changed (meaning we actually only performed a + * reshape), data is garanteed to remain valid. + * Otherwise, no garantee is provided regarding the validy of previous data + * (unlike std::vector). If the new overall size is larger than the previous + * one, all previous data is invalided. Otherwise, previous data may or may + * not remain valid, depending on the backend implementation. + * @param dims New dimensions + */ void resize(const std::vector<DimSize_t> &dims) { mDims = dims; computeSize();