Skip to content

Commit ecffe53

Browse files
zou3519soumith
authored andcommitted
Fix convolution type mismatch error message (#5815)
1 parent 404b8e9 commit ecffe53

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

aten/src/ATen/native/Convolution.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,12 @@ at::Tensor _convolution(
352352
#if AT_CUDNN_ENABLED()
353353
if (input.type() != weight.type()){
354354
std::stringstream ss;
355-
ss << "Input type (" << input.toString() << ") and weight type (" << weight.toString() << ") should be the same";
355+
ss << "Input type (" << input.type().toString() << ") and weight type (" << weight.type().toString() << ") should be the same";
356356
throw std::runtime_error(ss.str());
357357
}
358358
if (bias.defined() && input.type() != bias.type()){
359359
std::stringstream ss;
360-
ss << "Input type (" << input.toString() << ") and bias type (" << bias.toString() << ") should be the same";
360+
ss << "Input type (" << input.type().toString() << ") and bias type (" << bias.type().toString() << ") should be the same";
361361
throw std::runtime_error(ss.str());
362362
}
363363

torch/csrc/Exceptions.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,38 @@ std::string processErrorMsg(std::string str) {
3232

3333
// Translate Aten types to their respective pytorch ones
3434
std::vector<std::pair<std::string, std::string>> changes {
35+
{"Variable[SparseCUDAByteType]", "torch.cuda.sparse.ByteTensor"},
36+
{"Variable[SparseCUDACharType]", "torch.cuda.sparse.CharTensor"},
37+
{"Variable[SparseCUDADoubleType]", "torch.cuda.sparse.DoubleTensor"},
38+
{"Variable[SparseCUDAFloatType]", "torch.cuda.sparse.FloatTensor"},
39+
{"Variable[SparseCUDAIntType]", "torch.cuda.sparse.IntTensor"},
40+
{"Variable[SparseCUDALongType]", "torch.cuda.sparse.LongTensor"},
41+
{"Variable[SparseCUDAShortType]", "torch.cuda.sparse.ShortTensor"},
42+
{"Variable[SparseCUDAHalfType]", "torch.cuda.sparse.HalfTensor"},
43+
{"Variable[SparseCPUByteType]", "torch.sparse.ByteTensor"},
44+
{"Variable[SparseCPUCharType]", "torch.sparse.CharTensor"},
45+
{"Variable[SparseCPUDoubleType]", "torch.sparse.DoubleTensor"},
46+
{"Variable[SparseCPUFloatType]", "torch.sparse.FloatTensor"},
47+
{"Variable[SparseCPUIntType]", "torch.sparse.IntTensor"},
48+
{"Variable[SparseCPULongType]", "torch.sparse.LongTensor"},
49+
{"Variable[SparseCPUShortType]", "torch.sparse.ShortTensor"},
50+
{"Variable[SparseCPUHalfType]", "torch.sparse.HalfTensor"},
51+
{"Variable[CUDAByteType]", "torch.cuda.ByteTensor"},
52+
{"Variable[CUDACharType]", "torch.cuda.CharTensor"},
53+
{"Variable[CUDADoubleType]", "torch.cuda.DoubleTensor"},
54+
{"Variable[CUDAFloatType]", "torch.cuda.FloatTensor"},
55+
{"Variable[CUDAIntType]", "torch.cuda.IntTensor"},
56+
{"Variable[CUDALongType]", "torch.cuda.LongTensor"},
57+
{"Variable[CUDAShortType]", "torch.cuda.ShortTensor"},
58+
{"Variable[CUDAHalfType]", "torch.cuda.HalfTensor"},
59+
{"Variable[CPUByteType]", "torch.ByteTensor"},
60+
{"Variable[CPUCharType]", "torch.CharTensor"},
61+
{"Variable[CPUDoubleType]", "torch.DoubleTensor"},
62+
{"Variable[CPUFloatType]", "torch.FloatTensor"},
63+
{"Variable[CPUIntType]", "torch.IntTensor"},
64+
{"Variable[CPULongType]", "torch.LongTensor"},
65+
{"Variable[CPUShortType]", "torch.ShortTensor"},
66+
{"Variable[CPUHalfType]", "torch.HalfTensor"},
3567
{"SparseCUDAByteType", "torch.cuda.sparse.ByteTensor"},
3668
{"SparseCUDACharType", "torch.cuda.sparse.CharTensor"},
3769
{"SparseCUDADoubleType", "torch.cuda.sparse.DoubleTensor"},

0 commit comments

Comments
 (0)