tensorflow/compiler/mlir/tensorflow/transforms/tpu_space_to_depth_pass.cc
// Builds a SpaceToDepthOp with the given get_layout op and input.
Builds a SpaceToDepthOp with the given get_layout op and input.
Builds a SpaceToDepthOp with the given get_layout op and input .
TF::SpaceToDepthOp BuildSpaceToDepth(tf_device::ClusterFuncOp cluster_func,
                                     Value input, int32_t block_size,
                                     ArrayRef<int64_t> input_shape) {
  auto input_op = input.getDefiningOp();
  OpBuilder builder(input_op);
  builder.setInsertionPointAfter(input_op);
  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));
  return builder.create<TF::SpaceToDepthOp>(
      cluster_func.getLoc(), transform_result_type, input, block_size);
}
TF :: SpaceToDepthOp BuildSpaceToDepth ( tf_device :: ClusterFuncOp cluster_func , Value input , int32_t block_size , ArrayRef < int64_t > input_shape ) { auto input_op = input . getDefiningOp ( ) ; OpBuilder builder ( input_op ) ; builder . setInsertionPointAfter ( input_op ) ; 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 ) ) ; return builder . create < TF :: SpaceToDepthOp > ( cluster_func . getLoc ( ) , transform_result_type , input , block_size ) ; }
Builds a SpaceToDepthOp with the given get_layout op and input.
Builds a SpaceToDepthOp with the given get_layout op and input .