tensorflow/compiler/xla/tests/reduce_test.cc
// Max-reduces a matrix among dimension 1 and 0.
Max-reduces a matrix among dimension 1 and 0.
Max - reduces a matrix among dimension 1 and 0 .
XLA_TEST_F(ReduceTest, MaxReduce2DToR0) {
  XlaBuilder builder(TestName());
  auto max = CreateScalarMaxComputation(F32, &builder);
  Array2D<float> input(300, 250);
  input.FillRandom(214.0f);
  auto input_literal = LiteralUtil::CreateR2FromArray2D(input);
  Reduce(ConstantLiteral(&builder, input_literal),
         ConstantR0<float>(&builder, FLT_MIN), max, {0, 1});
  auto input_max = FLT_MIN;
  input.Each(
      [&](int64_t, int64_t, float* v) { input_max = std::max(input_max, *v); });
  ComputeAndCompareR0<float>(&builder, input_max, {}, ErrorSpec(0.0001));
}
XLA_TEST_F ( ReduceTest , MaxReduce2DToR0 ) { XlaBuilder builder ( TestName ( ) ) ; auto max = CreateScalarMaxComputation ( F32 , & builder ) ; Array2D < float > input ( 300 , 250 ) ; input . FillRandom ( 214.0f ) ; auto input_literal = LiteralUtil :: CreateR2FromArray2D ( input ) ; Reduce ( ConstantLiteral ( & builder , input_literal ) , ConstantR0 < float > ( & builder , FLT_MIN ) , max , { 0 , 1 } ) ; auto input_max = FLT_MIN ; input . Each ( [ & ] ( int64_t , int64_t , float * v ) { input_max = std :: max ( input_max , * v ) ; } ) ; ComputeAndCompareR0 < float > ( & builder , input_max , { } , ErrorSpec ( 0.0001 ) ) ; }
Max-reduces a matrix among dimension 1 and 0.
Max - reduces a matrix among dimension 1 and 0 .