From aedb5d42c8a270ea0b713a47c48a9b8a8fbfb295 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:19:03 -0800 Subject: [PATCH 1/8] Update convolution_helper.h --- torch_xla/csrc/convolution_helper.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/torch_xla/csrc/convolution_helper.h b/torch_xla/csrc/convolution_helper.h index d8983d58302d..8152cde1985f 100644 --- a/torch_xla/csrc/convolution_helper.h +++ b/torch_xla/csrc/convolution_helper.h @@ -4,7 +4,7 @@ #include #include "tsl/lib/gtl/inlined_vector.h" -#include "tsl/platform/stringpiece.h" +#include "absl/strings/string_view.h" #include "xla/client/xla_builder.h" #include "xla/xla_data.pb.h" @@ -234,7 +234,7 @@ inline int GetTensorSpatialDimIndex(int num_dims, TensorFormat format, // The V2 version computes the same outputs with arbitrary dilation rate and // supports explicit padding. tsl::Status ConvBackpropComputeDimensionsV2( - tsl::StringPiece label, int num_spatial_dims, const xla::Shape& input_shape, + absl::string_view label, int num_spatial_dims, const xla::Shape& input_shape, const xla::Shape& filter_shape, const xla::Shape& out_backprop_shape, absl::Span dilations, const std::vector& strides, Padding padding, @@ -246,13 +246,13 @@ tsl::Status ConvBackpropComputeDimensionsV2( // Wrapper for ConvGeneralDilated with checking dims. tsl::StatusOr MakeXlaBackpropInputConvOp( - tsl::StringPiece type_string, const xla::Shape& input_shape, + absl::string_view type_string, const xla::Shape& input_shape, xla::XlaOp filter, xla::XlaOp out_backprop, const ConvOpAttrs& attrs, xla::XlaOp* input_sizes = nullptr); // Wrapper for ConvGeneralDilated with checking dims. tsl::StatusOr MakeXlaBackpropFilterConvOp( - tsl::StringPiece type_string, xla::XlaOp activations, + absl::string_view type_string, xla::XlaOp activations, const xla::Shape& filter_shape, xla::XlaOp gradients, const ConvOpAttrs& attrs); @@ -260,4 +260,4 @@ tsl::StatusOr MakeXlaBackpropFilterConvOp( } // namespace torch_xla -#endif // XLA_TORCH_XLA_CSRC_CONVOLUTION_HELPER_H_ \ No newline at end of file +#endif // XLA_TORCH_XLA_CSRC_CONVOLUTION_HELPER_H_ From 359d18b8b9d0ecefbba68074db9c8a83c7c0776d Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:20:27 -0800 Subject: [PATCH 2/8] Update convolution_helper.cpp --- torch_xla/csrc/convolution_helper.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/torch_xla/csrc/convolution_helper.cpp b/torch_xla/csrc/convolution_helper.cpp index 1c3545437395..5d6c6d38a0b9 100644 --- a/torch_xla/csrc/convolution_helper.cpp +++ b/torch_xla/csrc/convolution_helper.cpp @@ -144,7 +144,7 @@ tsl::Status GetWindowedOutputSizeVerboseV2( // Check dimension tsl::Status ConvBackpropExtractAndVerifyDimension( - tsl::StringPiece label, const xla::Shape& input_shape, + absl::string_view label, const xla::Shape& input_shape, const xla::Shape& filter_shape, const xla::Shape& output_shape, const absl::Span dilations, const std::vector& strides, Padding padding, @@ -185,7 +185,7 @@ tsl::Status ConvBackpropExtractAndVerifyDimension( // Check dimension tsl::Status ConvBackpropComputeDimensionsV2( - tsl::StringPiece label, int num_spatial_dims, const xla::Shape& input_shape, + absl::string_view label, int num_spatial_dims, const xla::Shape& input_shape, const xla::Shape& filter_shape, const xla::Shape& out_backprop_shape, absl::Span dilations, const std::vector& strides, Padding padding, @@ -293,7 +293,7 @@ xla::XlaOp TransposeFilterForGroupConvolutionBackpropInput( // Wrapper for ConvGeneralDilated and check dim. tsl::StatusOr MakeXlaBackpropInputConvOp( - tsl::StringPiece type_string, const xla::Shape& input_shape, + absl::string_view type_string, const xla::Shape& input_shape, xla::XlaOp filter, xla::XlaOp out_backprop, const ConvOpAttrs& attrs, xla::XlaOp* input_sizes) { TF_RETURN_IF_ERROR(CheckConvAttrs(attrs)); @@ -394,7 +394,7 @@ tsl::StatusOr MakeXlaBackpropInputConvOp( // Wrapper for ConvGeneralDilated and check dim. tsl::StatusOr MakeXlaBackpropFilterConvOp( - tsl::StringPiece type_string, xla::XlaOp activations, + absl::string_view type_string, xla::XlaOp activations, const xla::Shape& filter_shape, xla::XlaOp gradients, const ConvOpAttrs& attrs) { TF_RETURN_IF_ERROR(CheckConvAttrs(attrs)); @@ -551,4 +551,4 @@ tsl::StatusOr MakeXlaBackpropFilterConvOp( // -------------Convolution Helper Function End-------------------------- -} // namespace torch_xla \ No newline at end of file +} // namespace torch_xla From 9b2ba1dffb46112b2075180a80adc717feb2a8e5 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:37:13 -0800 Subject: [PATCH 3/8] format --- torch_xla/csrc/convolution_helper.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/torch_xla/csrc/convolution_helper.cpp b/torch_xla/csrc/convolution_helper.cpp index 5d6c6d38a0b9..8a0a786d6605 100644 --- a/torch_xla/csrc/convolution_helper.cpp +++ b/torch_xla/csrc/convolution_helper.cpp @@ -185,8 +185,9 @@ tsl::Status ConvBackpropExtractAndVerifyDimension( // Check dimension tsl::Status ConvBackpropComputeDimensionsV2( - absl::string_view label, int num_spatial_dims, const xla::Shape& input_shape, - const xla::Shape& filter_shape, const xla::Shape& out_backprop_shape, + absl::string_view label, int num_spatial_dims, + const xla::Shape& input_shape, const xla::Shape& filter_shape, + const xla::Shape& out_backprop_shape, absl::Span dilations, const std::vector& strides, Padding padding, TensorFormat data_format, ConvBackpropDimensions* dims, From 73427098c28d14475d3787543df5c753de7bc898 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:38:30 -0800 Subject: [PATCH 4/8] format --- torch_xla/csrc/convolution_helper.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/torch_xla/csrc/convolution_helper.h b/torch_xla/csrc/convolution_helper.h index 8152cde1985f..13af22e83662 100644 --- a/torch_xla/csrc/convolution_helper.h +++ b/torch_xla/csrc/convolution_helper.h @@ -3,8 +3,8 @@ #include -#include "tsl/lib/gtl/inlined_vector.h" #include "absl/strings/string_view.h" +#include "tsl/lib/gtl/inlined_vector.h" #include "xla/client/xla_builder.h" #include "xla/xla_data.pb.h" @@ -234,8 +234,9 @@ inline int GetTensorSpatialDimIndex(int num_dims, TensorFormat format, // The V2 version computes the same outputs with arbitrary dilation rate and // supports explicit padding. tsl::Status ConvBackpropComputeDimensionsV2( - absl::string_view label, int num_spatial_dims, const xla::Shape& input_shape, - const xla::Shape& filter_shape, const xla::Shape& out_backprop_shape, + absl::string_view label, int num_spatial_dims, + const xla::Shape& input_shape, const xla::Shape& filter_shape, + const xla::Shape& out_backprop_shape, absl::Span dilations, const std::vector& strides, Padding padding, TensorFormat data_format, ConvBackpropDimensions* dims, From 013d0edef302787e8a5ebcc4813a07a3df7543f6 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:07:04 -0800 Subject: [PATCH 5/8] Update convolution_helper.cpp --- torch_xla/csrc/convolution_helper.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/torch_xla/csrc/convolution_helper.cpp b/torch_xla/csrc/convolution_helper.cpp index 8a0a786d6605..3e0a6158e56f 100644 --- a/torch_xla/csrc/convolution_helper.cpp +++ b/torch_xla/csrc/convolution_helper.cpp @@ -144,7 +144,7 @@ tsl::Status GetWindowedOutputSizeVerboseV2( // Check dimension tsl::Status ConvBackpropExtractAndVerifyDimension( - absl::string_view label, const xla::Shape& input_shape, + std::string_view label, const xla::Shape& input_shape, const xla::Shape& filter_shape, const xla::Shape& output_shape, const absl::Span dilations, const std::vector& strides, Padding padding, @@ -185,7 +185,7 @@ tsl::Status ConvBackpropExtractAndVerifyDimension( // Check dimension tsl::Status ConvBackpropComputeDimensionsV2( - absl::string_view label, int num_spatial_dims, + std::string_view label, int num_spatial_dims, const xla::Shape& input_shape, const xla::Shape& filter_shape, const xla::Shape& out_backprop_shape, absl::Span dilations, @@ -294,7 +294,7 @@ xla::XlaOp TransposeFilterForGroupConvolutionBackpropInput( // Wrapper for ConvGeneralDilated and check dim. tsl::StatusOr MakeXlaBackpropInputConvOp( - absl::string_view type_string, const xla::Shape& input_shape, + std::string_view type_string, const xla::Shape& input_shape, xla::XlaOp filter, xla::XlaOp out_backprop, const ConvOpAttrs& attrs, xla::XlaOp* input_sizes) { TF_RETURN_IF_ERROR(CheckConvAttrs(attrs)); @@ -395,7 +395,7 @@ tsl::StatusOr MakeXlaBackpropInputConvOp( // Wrapper for ConvGeneralDilated and check dim. tsl::StatusOr MakeXlaBackpropFilterConvOp( - absl::string_view type_string, xla::XlaOp activations, + std::string_view type_string, xla::XlaOp activations, const xla::Shape& filter_shape, xla::XlaOp gradients, const ConvOpAttrs& attrs) { TF_RETURN_IF_ERROR(CheckConvAttrs(attrs)); From 43f6dfdd9f3918001138c2c04957381a1bc0ff6f Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:07:45 -0800 Subject: [PATCH 6/8] Update convolution_helper.h --- torch_xla/csrc/convolution_helper.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/torch_xla/csrc/convolution_helper.h b/torch_xla/csrc/convolution_helper.h index 13af22e83662..f6ff01560bff 100644 --- a/torch_xla/csrc/convolution_helper.h +++ b/torch_xla/csrc/convolution_helper.h @@ -2,8 +2,8 @@ #define XLA_TORCH_XLA_CSRC_CONVOLUTION_HELPER_H_ #include +#include -#include "absl/strings/string_view.h" #include "tsl/lib/gtl/inlined_vector.h" #include "xla/client/xla_builder.h" #include "xla/xla_data.pb.h" @@ -234,7 +234,7 @@ inline int GetTensorSpatialDimIndex(int num_dims, TensorFormat format, // The V2 version computes the same outputs with arbitrary dilation rate and // supports explicit padding. tsl::Status ConvBackpropComputeDimensionsV2( - absl::string_view label, int num_spatial_dims, + std::string_view label, int num_spatial_dims, const xla::Shape& input_shape, const xla::Shape& filter_shape, const xla::Shape& out_backprop_shape, absl::Span dilations, @@ -247,13 +247,13 @@ tsl::Status ConvBackpropComputeDimensionsV2( // Wrapper for ConvGeneralDilated with checking dims. tsl::StatusOr MakeXlaBackpropInputConvOp( - absl::string_view type_string, const xla::Shape& input_shape, + std::string_view type_string, const xla::Shape& input_shape, xla::XlaOp filter, xla::XlaOp out_backprop, const ConvOpAttrs& attrs, xla::XlaOp* input_sizes = nullptr); // Wrapper for ConvGeneralDilated with checking dims. tsl::StatusOr MakeXlaBackpropFilterConvOp( - absl::string_view type_string, xla::XlaOp activations, + std::string_view type_string, xla::XlaOp activations, const xla::Shape& filter_shape, xla::XlaOp gradients, const ConvOpAttrs& attrs); From b8511ef66b2cc4d044076c66544319664e574f1a Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:10:08 -0800 Subject: [PATCH 7/8] format --- torch_xla/csrc/convolution_helper.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/torch_xla/csrc/convolution_helper.h b/torch_xla/csrc/convolution_helper.h index f6ff01560bff..cc2f46204733 100644 --- a/torch_xla/csrc/convolution_helper.h +++ b/torch_xla/csrc/convolution_helper.h @@ -2,7 +2,7 @@ #define XLA_TORCH_XLA_CSRC_CONVOLUTION_HELPER_H_ #include -#include +#include #include "tsl/lib/gtl/inlined_vector.h" #include "xla/client/xla_builder.h" @@ -234,9 +234,8 @@ inline int GetTensorSpatialDimIndex(int num_dims, TensorFormat format, // The V2 version computes the same outputs with arbitrary dilation rate and // supports explicit padding. tsl::Status ConvBackpropComputeDimensionsV2( - std::string_view label, int num_spatial_dims, - const xla::Shape& input_shape, const xla::Shape& filter_shape, - const xla::Shape& out_backprop_shape, + std::string_view label, int num_spatial_dims, const xla::Shape& input_shape, + const xla::Shape& filter_shape, const xla::Shape& out_backprop_shape, absl::Span dilations, const std::vector& strides, Padding padding, TensorFormat data_format, ConvBackpropDimensions* dims, From 73bd48dbd2f6b180bb031d1c551e9411c7036d93 Mon Sep 17 00:00:00 2001 From: Manfei <41607353+ManfeiBai@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:10:39 -0800 Subject: [PATCH 8/8] format --- torch_xla/csrc/convolution_helper.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/torch_xla/csrc/convolution_helper.cpp b/torch_xla/csrc/convolution_helper.cpp index 3e0a6158e56f..584df138b5d9 100644 --- a/torch_xla/csrc/convolution_helper.cpp +++ b/torch_xla/csrc/convolution_helper.cpp @@ -185,9 +185,8 @@ tsl::Status ConvBackpropExtractAndVerifyDimension( // Check dimension tsl::Status ConvBackpropComputeDimensionsV2( - std::string_view label, int num_spatial_dims, - const xla::Shape& input_shape, const xla::Shape& filter_shape, - const xla::Shape& out_backprop_shape, + std::string_view label, int num_spatial_dims, const xla::Shape& input_shape, + const xla::Shape& filter_shape, const xla::Shape& out_backprop_shape, absl::Span dilations, const std::vector& strides, Padding padding, TensorFormat data_format, ConvBackpropDimensions* dims,