blob: 04bba06a91a587f098e70152e7a5f35979a24230 [file] [log] [blame]
#include <c10/core/Scalar.h>
namespace c10 {
Scalar Scalar::operator-() const {
TORCH_CHECK(!isBoolean(), "torch boolean negative, the `-` operator, is not suppported.");
if (isFloatingPoint()) {
return Scalar(-v.d);
} else if (isComplex()) {
return Scalar(-v.z);
} else {
return Scalar(-v.i);
}
}
} // namespace c10