yelite commented on code in PR #12232:
URL: https://github.com/apache/tvm/pull/12232#discussion_r946776348


##########
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc:
##########
@@ -121,53 +116,41 @@ DLPackTensorExt 
create_dlpack_tensor_ext(tvm::runtime::NDArray* src, bool is_boo
 }
 
 /*
- * Create an empty NDArray with boolean type.
+ * Create an NDArray with boolean type. (One memory copy)
  * @param src DLpack extended tensor
- * @return an empty NDArray
+ * @return a new NDArray
  */
-tvm::runtime::NDArray create_empty_bool_ndarray(DLPackTensorExt* src) {
+tvm::runtime::NDArray createBoolNDarray(DLPackTensorExt* src) {
   auto& tensor = src->dl_managed_tensor->dl_tensor;
   std::vector<int64_t> shape;
   for (int64_t i = 0; i < tensor.ndim; i++) {
     shape.push_back(tensor.shape[i]);
   }
   auto ret = tvm::runtime::NDArray::Empty(shape, DataType::Bool(), 
tensor.device);
-  return ret;
-}
-
-/*
- * Create an NDArray with boolean type. (One memory copy)
- * @param src DLpack extended tensor
- * @return a new NDArray
- */
-tvm::runtime::NDArray create_bool_ndarray(DLPackTensorExt* src) {
-  auto&& ret = create_empty_bool_ndarray(src);
   ret.CopyFrom(&src->dl_managed_tensor->dl_tensor);
   return std::move(ret);
 }
 
-bool is_zero_copy(DLPackTensorExt* src) {
+bool isZeroCopy(DLPackTensorExt* src) {
   auto& dl_tensor = src->dl_managed_tensor->dl_tensor;
-  bool is_zero_copy =
-      tvm::runtime::NDArray::AbilityOfZeroCopyForDLTensor(&dl_tensor, 
dl_tensor.device);
-  return is_zero_copy;
+  return tvm::runtime::NDArray::AbilityOfZeroCopyForDLTensor(&dl_tensor, 
dl_tensor.device);
 }
 
 /*
  * Create an NDArray from DLpack extended tensor.
  * @param src DLpack extended tensor
  * @return a new NDArray
  */
-tvm::runtime::NDArray ndarray_from_dlpack(DLPackTensorExt* src) {
+tvm::runtime::NDArray ndarrayFromDLpack(DLPackTensorExt* src) {

Review Comment:
   ```suggestion
   tvm::runtime::NDArray NDArrayFromDLpack(DLPackTensorExt* src) {
   ```



##########
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc:
##########
@@ -121,53 +116,41 @@ DLPackTensorExt 
create_dlpack_tensor_ext(tvm::runtime::NDArray* src, bool is_boo
 }
 
 /*
- * Create an empty NDArray with boolean type.
+ * Create an NDArray with boolean type. (One memory copy)
  * @param src DLpack extended tensor
- * @return an empty NDArray
+ * @return a new NDArray
  */
-tvm::runtime::NDArray create_empty_bool_ndarray(DLPackTensorExt* src) {
+tvm::runtime::NDArray createBoolNDarray(DLPackTensorExt* src) {

Review Comment:
   ```suggestion
   tvm::runtime::NDArray CreateBoolNDArray(DLPackTensorExt* src) {
   ```



##########
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc:
##########
@@ -187,8 +170,8 @@ struct TVMContribTorchRuntimeModule {
   explicit TVMContribTorchRuntimeModule(tvm::runtime::Module& mod) : mod(mod) 
{}
 };
 
-bool tvm_contrib_torch_is_be_copied(DLPackTensorExt* src) {
-  return (src->is_bool) || (!tvm::contrib::is_zero_copy(src));
+bool tvm_contrib_torch_tensor_ability_of_zero_copy(DLPackTensorExt* src) {

Review Comment:
   The function name sounds like it will return True if it's able to zero copy 
the tensor but it actually returns False if it's able to zero copy. Can you 
either update the function body or function name to make it consistent



##########
src/contrib/torch/tvm_module_wrapper/RuntimeModuleWrapperTVM.cc:
##########
@@ -121,53 +116,41 @@ DLPackTensorExt 
create_dlpack_tensor_ext(tvm::runtime::NDArray* src, bool is_boo
 }
 
 /*
- * Create an empty NDArray with boolean type.
+ * Create an NDArray with boolean type. (One memory copy)
  * @param src DLpack extended tensor
- * @return an empty NDArray
+ * @return a new NDArray
  */
-tvm::runtime::NDArray create_empty_bool_ndarray(DLPackTensorExt* src) {
+tvm::runtime::NDArray createBoolNDarray(DLPackTensorExt* src) {
   auto& tensor = src->dl_managed_tensor->dl_tensor;
   std::vector<int64_t> shape;
   for (int64_t i = 0; i < tensor.ndim; i++) {
     shape.push_back(tensor.shape[i]);
   }
   auto ret = tvm::runtime::NDArray::Empty(shape, DataType::Bool(), 
tensor.device);
-  return ret;
-}
-
-/*
- * Create an NDArray with boolean type. (One memory copy)
- * @param src DLpack extended tensor
- * @return a new NDArray
- */
-tvm::runtime::NDArray create_bool_ndarray(DLPackTensorExt* src) {
-  auto&& ret = create_empty_bool_ndarray(src);
   ret.CopyFrom(&src->dl_managed_tensor->dl_tensor);
   return std::move(ret);
 }
 
-bool is_zero_copy(DLPackTensorExt* src) {
+bool isZeroCopy(DLPackTensorExt* src) {

Review Comment:
   ```suggestion
   bool IsZeroCopy(DLPackTensorExt* src) {
   ```



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