wkcn commented on a change in pull request #17204: Enhancements for MXTensor
for custom operators
URL: https://github.com/apache/incubator-mxnet/pull/17204#discussion_r363061583
##########
File path: include/mxnet/lib_api.h
##########
@@ -277,6 +289,14 @@ struct MXTensor {
return size;
}
+ /*! \brief helper function to compare two MXTensors */
+ inline bool operator==(const MXTensor &oth) {
Review comment:
Thank you for the explanation in detail!
1. If two tensors have the same data pointer then they will have the same
data values also.
It is right. However, if two tensors have the same data values, they may not
have the same data pointer. I did a simple test on C++ vector.
```c++
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> a{1,2,3};
vector<int> b{1,2,3};
cout << (a == b) << endl; // 1
cout << (a.data() == b.data()) << endl; // 0
return 0;
}
```
2. we don't need to be consistent with NDarray API here.
Agree : )
----------------------------------------------------------------
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]
With regards,
Apache Git Services