samskalicky commented on a change in pull request #17204: Enhancements for
MXTensor for custom operators
URL: https://github.com/apache/incubator-mxnet/pull/17204#discussion_r363008407
##########
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:
writing a response together with @rondogency:
For clarity, here were checking the following items: dtype, version ID,
shape, and the pointer address of the data in memory. If two tensors have the
same data pointer then they will have the same data values also. So here the
two tensors will have the same content and will have the same tensor attributes
(shape, type, version ID) also.
I dont think we need to be consistent with NDarray API here, since users
writing custom ops wont necessarily be familiar with NDarray API. And here
we're trying to make the right API for this use-case (custom operators). Our
comparison API also checks the version number, and the NDarray API does not. So
we're already diverging from being consistent with NDArray API.
For the record, here is the similar NDarray API:
https://github.com/apache/incubator-mxnet/blob/55e222b8c97f99193f832f785cf210f876632add/include/mxnet/ndarray.h#L212-L217
----------------------------------------------------------------
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