Fix error message formatting in AT_CHECK/AT_ERROR (#16067)
authorvishwakftw <cs15btech11043@iith.ac.in>
Wed, 16 Jan 2019 19:12:47 +0000 (11:12 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 16 Jan 2019 19:34:13 +0000 (11:34 -0800)
Summary:
Changelog:

- Fix formatting for error messages in prelu, EmbeddingBag, RNN

Fixes https://github.com/pytorch/pytorch/issues/16043
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16067

Differential Revision: D13693286

Pulled By: soumith

fbshipit-source-id: b0760d13c9a45e82dababfc44dabe648e5345ca3

aten/src/ATen/native/Activation.cpp
aten/src/ATen/native/cuda/Activation.cu
aten/src/ATen/native/cuda/EmbeddingBag.cu
aten/src/ATen/native/cudnn/RNN.cpp

index d4c018e..acbad68 100644 (file)
@@ -168,8 +168,8 @@ Tensor prelu_cpu(const Tensor& self, const Tensor& weight_) {
       input_stride1 = strides[1];
     }
     AT_CHECK(channel_size == weight_num,
-      "Mismatch of parameter numbers and input channel size. Found parameter numbers = %d, and channel size = %d.",
-      weight_num, channel_size);
+      "Mismatch of parameter numbers and input channel size. Found parameter numbers = ", weight_num,
+      " and channel size = ", channel_size, ".");
 
     AT_DISPATCH_FLOATING_TYPES(input.type(), "prelu_cpu", [&] {
       prelu_cpu_kernel_multi_weights<scalar_t>(
@@ -295,8 +295,8 @@ std::tuple<Tensor, Tensor> prelu_backward_cpu(const Tensor& grad_out_, const Ten
       input_stride1 = strides[1];
     }
     AT_CHECK(channel_size == weight_num,
-      "Mismatch of parameter numbers and input channel size. Found parameter numbers = %d, and channel size = %d.",
-      weight_num, channel_size);
+      "Mismatch of parameter numbers and input channel size. Found parameter numbers = ", weight_num,
+      " and channel size = ", channel_size, ".");
 
     AT_DISPATCH_FLOATING_TYPES(input.type(), "prelu_backward_cpu", [&] {
       prelu_cpu_backward_kernel_multi_weights<scalar_t>(
index 6660736..b4b7894 100644 (file)
@@ -82,8 +82,8 @@ Tensor prelu_cuda(const Tensor& self, const Tensor& weight_) {
       input_stride1 = strides[1];
     }
     AT_CHECK(channel_size == weight_num,
-      "Mismatch of parameter numbers and input channel size. Found parameter numbers = %d, and channel size = %d.",
-      weight_num, channel_size);
+      "Mismatch of parameter numbers and input channel size. Found parameter numbers = ", weight_num,
+      " and channel size = ", channel_size, ".");
 
     // config to run cuda kernel
     int64_t input_numel = input.numel();
@@ -198,8 +198,8 @@ std::tuple<Tensor, Tensor> prelu_backward_cuda(const Tensor& grad_out_, const Te
       input_stride1 = strides[1];
     }
     AT_CHECK(channel_size == weight_num,
-      "Mismatch of parameter numbers and input channel size. Found parameter numbers = %d, and channel size = %d.",
-      weight_num, channel_size);
+      "Mismatch of parameter numbers and input channel size. Found parameter numbers = ", weight_num,
+      " and channel size = ", channel_size, ".");
 
     // config to run cuda kernel
     int64_t input_numel = input.numel();
index 830277d..4721611 100644 (file)
@@ -396,7 +396,7 @@ Tensor _embedding_bag_dense_backward_cuda(const Tensor &grad_, const Tensor &ind
 
     default:
       AT_ERROR(
-          "Unknown mode for embedding_bag_backward_cuda %d", mode);
+          "Unknown mode for embedding_bag_backward_cuda ", mode);
   }
 }
 
index a6642cd..46f3b79 100644 (file)
@@ -375,7 +375,7 @@ namespace {
       case CUDNN_RNN_TANH:
         return 2;
       default:
-        AT_ERROR("unknown cuDNN RNN mode %d", mode);
+        AT_ERROR("unknown cuDNN RNN mode ", mode);
     }
   }