tensorflow/compiler/mlir/tensorflow/transforms/tpu_space_to_depth_pass.cc
// Transforms input shape for the first convolution.
Transforms input shape for the first convolution.
Transforms input shape for the first convolution .
void HandleConv2DInput(TF::Conv2DOp conv2d, int64_t block_size) {
  auto input = conv2d.input();
  auto input_shape = input.getType().cast<RankedTensorType>().getShape();
  SmallVector<int64_t, 4> transform_shape = {
      input_shape[0], input_shape[1] / block_size, input_shape[2] / block_size,
      input_shape[3] * block_size * block_size};
  auto transform_result_type =
      RankedTensorType::get(transform_shape, getElementTypeOrSelf(input));
  input.setType(transform_result_type);
}
void HandleConv2DInput ( TF :: Conv2DOp conv2d , int64_t block_size ) { auto input = conv2d . input ( ) ; auto input_shape = input . getType ( ) . cast < RankedTensorType > ( ) . getShape ( ) ; SmallVector < int64_t , 4 > transform_shape = { input_shape [ 0 ] , input_shape [ 1 ] / block_size , input_shape [ 2 ] / block_size , input_shape [ 3 ] * block_size * block_size } ; auto transform_result_type = RankedTensorType :: get ( transform_shape , getElementTypeOrSelf ( input ) ) ; input . setType ( transform_result_type ) ; }
Transforms input shape for the first convolution.
Transforms input shape for the first convolution .