torch/csrc/jit/test_jit.cpp
// given the difference of output vs expected tensor, check whether the
// difference is within a relative tolerance range. This is a standard way of
// matching tensor values upto certain precision
given the difference of output vs expected tensor, check whether the
difference is within a relative tolerance range. This is a standard way of
matching tensor values upto certain precision
given the difference of output vs expected tensor check whether the difference is within a relative tolerance range . This is a standard way of matching tensor values upto certain precision
bool checkRtol(const at::Tensor& diff, const std::vector<at::Tensor> inputs) {
  double maxValue = 0.0;
  for (auto& tensor : inputs) {
    maxValue = fmax(tensor.abs().max().toCFloat(), maxValue);
  }
  return diff.abs().max().toCFloat() < 2e-6 * maxValue;
}
bool checkRtol ( const at :: Tensor & diff , const std :: vector < at :: Tensor > inputs ) { double maxValue = 0.0 ; for ( auto & tensor : inputs ) { maxValue = fmax ( tensor . abs ( ) . max ( ) . toCFloat ( ) , maxValue ) ; } return diff . abs ( ) . max ( ) . toCFloat ( ) < 2e-6 * maxValue ; }
given the difference of output vs expected tensor, check whether the
difference is within a relative tolerance range.
given the difference of output vs expected tensor check whether the difference is within a relative tolerance range .