Commit e22ac6b3 by Sergei Grechanik Committed by Tianqi Chen

[TVM] Fix operator!= for Tensor (#1753)

parent d1e048b7
...@@ -45,6 +45,12 @@ class Tensor : public NodeRef { ...@@ -45,6 +45,12 @@ class Tensor : public NodeRef {
* \return whether the two tensors equals each other. * \return whether the two tensors equals each other.
*/ */
inline bool operator==(const Tensor& other) const; inline bool operator==(const Tensor& other) const;
/*!
* \brief check if two tensors are different.
* \param other tensor to be checked.
* \return whether the two tensors are different.
*/
inline bool operator!=(const Tensor& other) const;
/*! \return The dimension of the tensor */ /*! \return The dimension of the tensor */
inline size_t ndim() const; inline size_t ndim() const;
/*! /*!
...@@ -184,6 +190,10 @@ inline bool Tensor::operator==(const Tensor& other) const { ...@@ -184,6 +190,10 @@ inline bool Tensor::operator==(const Tensor& other) const {
} }
} }
inline bool Tensor::operator!=(const Tensor& other) const {
return !(*this == other);
}
// macro to turn every operation of slice to expression // macro to turn every operation of slice to expression
#define DEFINE_OVERLOAD_SLICE_UNARY_OP(Op) \ #define DEFINE_OVERLOAD_SLICE_UNARY_OP(Op) \
inline Expr operator Op (const Tensor::Slice& a) { \ inline Expr operator Op (const Tensor::Slice& a) { \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment