MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TensorsAreCloseImpl

Function TensorsAreCloseImpl

tensorflow/compiler/tests/randomized_tests.cc:749–763  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

747
748template <typename T>
749Status TensorsAreCloseImpl(const Tensor& x, const Tensor& y, double atol,
750 double rtol) {
751 auto Tx = x.flat<T>();
752 auto Ty = y.flat<T>();
753 for (int i = 0; i < Tx.size(); ++i) {
754 if (!IsClose(Tx(i), Ty(i), atol, rtol)) {
755 return errors::InvalidArgument(
756 absl::StrCat(i, "-th tensor element isn't close: ", Str(Tx(i)),
757 " vs. ", Str(Ty(i)), ". x = ", x.DebugString(),
758 "y = ", y.DebugString(), "atol = ", atol,
759 " rtol = ", rtol, " tol = ", atol + rtol * Abs(Tx(i))));
760 }
761 }
762 return Status::OK();
763}
764
765template <typename T>
766Status TensorsAreEqualImpl(const Tensor& x, const Tensor& y) {

Callers

nothing calls this directly

Calls 7

IsCloseFunction · 0.85
InvalidArgumentFunction · 0.85
StrFunction · 0.85
AbsFunction · 0.70
StrCatFunction · 0.50
sizeMethod · 0.45
DebugStringMethod · 0.45

Tested by

no test coverage detected