tensorflow/compiler/mlir/tensorflow/transforms/tpu_space_to_depth_pass.cc
// Gets block size that is equal to stride from spatial dimension
// from convolution.
// Space to depth transform won't be triggered if block size <= 1.
Gets block size that is equal to stride from spatial dimension
from convolution.
Space to depth transform won't be triggered if block size <= 1.
Gets block size that is equal to stride from spatial dimension from convolution . Space to depth transform won ' t be triggered if block size < = 1 .
int32_t GetConv2DBlockSize(TF::Conv2DOp conv2d) {
  SmallVector<int32_t, 4> strides(4, 1);
  for (int i = 0; i < 3; ++i) {
    strides[i] = conv2d.strides()[i].cast<mlir::IntegerAttr>().getInt();
  }
  if (strides[0] != 1 || strides[3] != 1) return 1;
  if (strides[1] != strides[2]) return 1;
  return strides[1];
}
int32_t GetConv2DBlockSize ( TF :: Conv2DOp conv2d ) { SmallVector < int32_t , 4 > strides ( 4 , 1 ) ; for ( int i = 0 ; i < 3 ; ++ i ) { strides [ i ] = conv2d . strides ( ) [ i ] . cast < mlir :: IntegerAttr > ( ) . getInt ( ) ; } if ( strides [ 0 ] != 1 || strides [ 3 ] != 1 ) return 1 ; if ( strides [ 1 ] != strides [ 2 ] ) return 1 ; return strides [ 1 ] ; }
Gets block size that is equal to stride from spatial dimension
from convolution.
Gets block size that is equal to stride from spatial dimension from convolution .
// Space to depth only supports striding at spatial dimension. // Space to depth only supports height_stride == width_stride case.