@@ -141,14 +141,15 @@ auto ConvParams::is_depthwise(
141141static void check_input_shape_forward (const at::Tensor& input,
142142 const at::Tensor& weight, const at::Tensor& bias,
143143 int64_t groups, bool transposed) {
144- int k = input.ndimension ();
144+ int64_t k = input.ndimension ();
145+ int64_t weight_dim = weight.ndimension ();
145146
146- if (weight. ndimension () != k) {
147- std::stringstream ss;
148- ss << " Expected " << k << " -dimensional input for " << k
149- << " -dimensional weight " << weight.sizes () << " , but got input of size "
150- << input.sizes () << " instead" ;
151- throw std::runtime_error (ss.str ());
147+ if (weight_dim != k) {
148+ std::stringstream ss;
149+ ss << " Expected " << weight_dim << " -dimensional input for " << weight_dim
150+ << " -dimensional weight " << weight.sizes () << " , but got input of size "
151+ << input.sizes () << " instead" ;
152+ throw std::runtime_error (ss.str ());
152153 }
153154 if (weight.size (0 ) < groups) {
154155 std::stringstream ss;
@@ -266,10 +267,10 @@ at::Tensor convolution(
266267}
267268
268269static inline std::vector<int64_t > convolution_expand_param_if_needed (
269- IntList list_param, const char *param_name, size_t expected_dim) {
270+ IntList list_param, const char *param_name, int64_t expected_dim) {
270271 if (list_param.size () == 1 ) {
271272 return std::vector<int64_t >(expected_dim, list_param[0 ]);
272- } else if (list_param.size () != expected_dim) {
273+ } else if (( int64_t ) list_param.size () != expected_dim) {
273274 std::ostringstream ss;
274275 ss << " expected " << param_name << " to be a single integer value or a "
275276 << " list of " << expected_dim << " values to match the convolution "
0 commit comments