Skip to content

Commit

Permalink
[android] improve unsupported scalar type error message for android
Browse files Browse the repository at this point in the history
Summary: Android only support a few scalar types as model return value. This diff improved the error message so user can know which type is not supported.

Test Plan: verified unsupported scalar type is printed

Differential Revision: D35104788

Pull Request resolved: pytorch#74660
Approved by: https://github.com/kit1980
  • Loading branch information
linbinyu authored and pytorchmergebot committed Mar 25, 2022
1 parent edf2deb commit 1c4eb3a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion android/pytorch_android/src/main/cpp/pytorch_jni_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ class TensorHybrid : public facebook::jni::HybridClass<TensorHybrid> {
} else {
facebook::jni::throwNewJavaException(
facebook::jni::gJavaLangIllegalArgumentException,
"at::Tensor scalar type is not supported on java side");
"at::Tensor scalar type %s is not supported on java side",
c10::toString(scalarType));
}

const auto& tensorShape = tensor.sizes();
Expand Down

0 comments on commit 1c4eb3a

Please sign in to comment.