tqchen commented on code in PR #18276:
URL: https://github.com/apache/tvm/pull/18276#discussion_r2328417231


##########
ffi/include/tvm/ffi/container/tensor.h:
##########
@@ -244,6 +244,23 @@ class Tensor : public ObjectRef {
     }
     return *(obj->shape_data_);
   }
+  /*!
+   * \brief Get the strides of the Tensor.
+   * \return The strides of the Tensor.
+   */
+  tvm::ffi::Shape strides() const {
+    TensorObj* obj = get_mutable();
+    if (obj->strides == nullptr) {
+      Shape strides = Shape(details::MakeStridesFromShape(obj->ndim, 
obj->shape));
+      obj->strides = const_cast<int64_t*>(strides.data());
+      obj->stride_data_ = std::move(strides);

Review Comment:
   you cannot return a moved strides, instead return strides_data_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to