message: Add a TF_DEBUG_TRT_ALLOW_INEFFICIENT_TRANSPOSE debug flag
  If set, TF_DEBUG_TRT_ALLOW_INEFFICIENT_TRANSPOSE lets the TensorRT bridge lower
  inefficient transpose operations.
diff: @@ -54,6 +54,7 @@ limitations under the License.
  #include "tensorflow/core/platform/tensor_coding.h"
  #include "tensorflow/core/platform/types.h"
  #include "tensorflow/core/public/version.h"
  +#include "tensorflow/core/util/env_var.h"
  #include "tensorflow/core/util/strided_slice_op.h"
  #if GOOGLE_CUDA
  @@ -2225,6 +2226,21 @@ Status ConvertConv2DHelper(OpConverterParams* params, int group,
  return Status::OK();
  }
  +bool AllowInefficientTranspose() {
  + static bool result = [] {
  + bool value;
  + Status status =
  + ReadBoolFromEnvVar("TF_DEBUG_TRT_ALLOW_INEFFICIENT_TRANSPOSE",
  + /*default_value=*/false, &value);
  + if (!status.ok()) {
  + LOG(ERROR) << status;
  + }
  + return value;
  + }();
  +
  + return result;
  +}
  +
  Status ConvertTranspose(OpConverterParams* params) {
  const auto& inputs = params->inputs;
  TF_RETURN_IF_ERROR(
  @@ -2251,7 +2267,7 @@ Status ConvertTranspose(OpConverterParams* params) {
  // So check tensor size, and don't convert if it is too large.
  constexpr int64_t kMaxEfficientTranspose = 2500000;
  int64_t tensor_size = TrtTensorDimsNumElements(input_tensor->getDimensions());
  - if (tensor_size > kMaxEfficientTranspose) {
  + if (!AllowInefficientTranspose() && tensor_size > kMaxEfficientTranspose) {
  return errors::Unimplemented(StrCat("Transpose too large:", tensor_size));
  }
  