We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 72a461a commit 451c27bCopy full SHA for 451c27b
src/decoding.cc
@@ -70,9 +70,14 @@ namespace ctranslate2 {
70
StorageView& ids) {
71
if (!decoder.output_layer_is_updated())
72
return;
73
+ ctranslate2::Device device = ids.device();
74
+ if (device != Device::CPU)
75
+ ids = ids.to(Device::CPU);
76
auto* ids_data = ids.data<int32_t>();
77
for (dim_t i = 0; i < ids.size(); ++i)
78
ids_data[i] = decoder.to_original_word_id(ids_data[i]);
79
+ if (ids.device() != device)
80
+ ids = ids.to(device);
81
}
82
83
template <typename T>
0 commit comments