tensorflow/compiler/xla/tests/broadcast_simple_test.cc
// Tests implicit broadcasting of PREDs.
Tests implicit broadcasting of PREDs.
Tests implicit broadcasting of PREDs .
XLA_TEST_F(BroadcastSimpleTest, BooleanAnd2DTo3D_Pred) {
  XlaBuilder b(TestName());
  Array2D<bool> x_vals(2, 1);
  x_vals(0, 0) = true;
  x_vals(1, 0) = false;
  Array3D<bool> y_vals(2, 2, 1);
  y_vals(0, 0, 0) = false;
  y_vals(0, 1, 0) = false;
  y_vals(1, 0, 0) = true;
  y_vals(1, 1, 0) = true;
  XlaOp x, y;
  auto x_data = CreateR2Parameter<bool>(x_vals, 0, "x", &b, &x);
  auto y_data = CreateR3Parameter<bool>(y_vals, 1, "y", &b, &y);
  And(x, y, {1, 2});
  Array3D<bool> expected(2, 2, 1);
  expected(0, 0, 0) = false;
  expected(0, 1, 0) = false;
  expected(1, 0, 0) = true;
  expected(1, 1, 0) = false;
  ComputeAndCompareR3<bool>(&b, expected, {x_data.get(), y_data.get()});
}
XLA_TEST_F ( BroadcastSimpleTest , BooleanAnd2DTo3D_Pred ) { XlaBuilder b ( TestName ( ) ) ; Array2D < bool > x_vals ( 2 , 1 ) ; x_vals ( 0 , 0 ) = true ; x_vals ( 1 , 0 ) = false ; Array3D < bool > y_vals ( 2 , 2 , 1 ) ; y_vals ( 0 , 0 , 0 ) = false ; y_vals ( 0 , 1 , 0 ) = false ; y_vals ( 1 , 0 , 0 ) = true ; y_vals ( 1 , 1 , 0 ) = true ; XlaOp x , y ; auto x_data = CreateR2Parameter < bool > ( x_vals , 0 , " " , & b , & x ) ; auto y_data = CreateR3Parameter < bool > ( y_vals , 1 , " " , & b , & y ) ; And ( x , y , { 1 , 2 } ) ; Array3D < bool > expected ( 2 , 2 , 1 ) ; expected ( 0 , 0 , 0 ) = false ; expected ( 0 , 1 , 0 ) = false ; expected ( 1 , 0 , 0 ) = true ; expected ( 1 , 1 , 0 ) = false ; ComputeAndCompareR3 < bool > ( & b , expected , { x_data . get ( ) , y_data . get ( ) } ) ; }
Tests implicit broadcasting of PREDs.
Tests implicit broadcasting of PREDs .
/*broadcast_dimensions=*/