tensorflow/core/kernels/roll_op_test.cc
// isd - (inner shift dimension) The inner most dimension to be shifted.
//    All outer dimensions will also be shifted for testing.
(inner shift dimension) The inner most dimension to be shifted.
All outer dimensions will also be shifted for testing.
( inner shift dimension ) The inner most dimension to be shifted . All outer dimensions will also be shifted for testing .
static Graph* RollGraph(const TensorShape& shape, int isd) {
  Graph* g = new Graph(OpRegistry::Global());
  Tensor input(DT_FLOAT, shape);
  input.flat<float>().setRandom();
  const int dims = static_cast<int>(input.dims());
  Tensor shift(DT_INT32, TensorShape({dims}));
  for (int i = 0; i < dims; i++) {
    shift.flat<int32>()(i) = (i <= isd) ? 2 : 0;
  }
  Tensor axis(DT_INT32, TensorShape({dims}));
  for (int i = 0; i < dims; i++) {
    axis.flat<int32>()(i) = i;
  }
  test::graph::Roll(g, test::graph::Constant(g, input),
                    test::graph::Constant(g, shift),
                    test::graph::Constant(g, axis));
  return g;
}
static Graph * RollGraph ( const TensorShape & shape , int isd ) { Graph * g = new Graph ( OpRegistry :: Global ( ) ) ; Tensor input ( DT_FLOAT , shape ) ; input . flat < float > ( ) . setRandom ( ) ; const int dims = static_cast < int > ( input . dims ( ) ) ; Tensor shift ( DT_INT32 , TensorShape ( { dims } ) ) ; for ( int i = 0 ; i < dims ; i ++ ) { shift . flat < int32 > ( ) ( i ) = ( i <= isd ) ? 2 : 0 ; } Tensor axis ( DT_INT32 , TensorShape ( { dims } ) ) ; for ( int i = 0 ; i < dims ; i ++ ) { axis . flat < int32 > ( ) ( i ) = i ; } test :: graph :: Roll ( g , test :: graph :: Constant ( g , input ) , test :: graph :: Constant ( g , shift ) , test :: graph :: Constant ( g , axis ) ) ; return g ; }
isd - (inner shift dimension) The inner most dimension to be shifted.
isd - ( inner shift dimension ) The inner most dimension to be shifted .
// shift the inner shift dimension and all outer dimensions