mwillsey commented on a change in pull request #6563:
URL: https://github.com/apache/incubator-tvm/pull/6563#discussion_r497732844



##########
File path: rust/tvm-rt/src/ndarray.rs
##########
@@ -184,28 +246,19 @@ impl NDArray {
     /// let ctx = Context::cpu(0);
     /// let mut ndarray = NDArray::empty(&mut shape, ctx, 
DataType::from_str("int32").unwrap());
     /// ndarray.copy_from_buffer(&mut data);
-    /// assert_eq!(ndarray.shape(), Some(&mut shape[..]));
+    /// assert_eq!(ndarray.shape(), shape);
     /// assert_eq!(ndarray.to_vec::<i32>().unwrap(), data);
     /// ```
     pub fn to_vec<T>(&self) -> Result<Vec<T>, NDArrayError> {

Review comment:
       Yeah, see above. The problem is that NDArray isn't NDArray<T>. So we 
trust the type of T given to us by `to_vec::<T>`. That makes it effectively a 
transmute of the buffer.




----------------------------------------------------------------
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.

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


Reply via email to