tensorflow/compiler/tf2xla/kernels/conv_op_helpers.cc
// Returns the expanded size of a filter used for depthwise convolution.
// If `shape` is [H, W, ..., M, N] returns [H, W, ..., 1, M*N].
Returns the expanded size of a filter used for depthwise convolution.
Returns the expanded size of a filter used for depthwise convolution .
xla::Shape GroupedFilterShapeForDepthwiseConvolution(
    const xla::Shape& filter_shape) {
  int64_t input_feature_dim = filter_shape.dimensions_size() - 2;
  int64_t output_feature_dim = filter_shape.dimensions_size() - 1;
  int64_t depthwise_multiplier = filter_shape.dimensions(output_feature_dim);
  int64_t input_feature = filter_shape.dimensions(input_feature_dim);
  xla::Shape grouped_filter_shape = filter_shape;
  grouped_filter_shape.set_dimensions(input_feature_dim, 1);
  grouped_filter_shape.set_dimensions(output_feature_dim,
                                      depthwise_multiplier * input_feature);
  return grouped_filter_shape;
}
xla :: Shape GroupedFilterShapeForDepthwiseConvolution ( const xla :: Shape & filter_shape ) { int64_t input_feature_dim = filter_shape . dimensions_size ( ) - 2 ; int64_t output_feature_dim = filter_shape . dimensions_size ( ) - 1 ; int64_t depthwise_multiplier = filter_shape . dimensions ( output_feature_dim ) ; int64_t input_feature = filter_shape . dimensions ( input_feature_dim ) ; xla :: Shape grouped_filter_shape = filter_shape ; grouped_filter_shape . set_dimensions ( input_feature_dim , 1 ) ; grouped_filter_shape . set_dimensions ( output_feature_dim , depthwise_multiplier * input_feature ) ; return grouped_filter_shape ; }
Returns the expanded size of a filter used for depthwise convolution.
Returns the expanded size of a filter used for depthwise convolution .
// Create a [H, W, ..., 1, M*N] reshape of the filter.