Upgrade FDASSERT (#97)

* upgrade FDASSERT

* Optimize error message of FDTensor function

* upgrade FDASSERT

Co-authored-by: Jason <jiangjiajun@baidu.com>
This commit is contained in:
Jack Zhou
2022-08-11 19:42:31 +08:00
committed by GitHub
parent d900e8d35e
commit 5c6b3d6150
5 changed files with 54 additions and 32 deletions

View File

@@ -114,8 +114,11 @@ void SoftmaxKernel(const FDTensor& x, FDTensor* out, int axis) {
}
void Softmax(const FDTensor& x, FDTensor* out, int axis) {
FDASSERT(std::abs(axis) < x.shape.size(),
"The given axis should be smaller than the input's dimension");
FDASSERT(
std::abs(axis) < x.shape.size(),
"The absolute given axis should be smaller than the input's "
"dimension. Expected absolute axis is smaller than %d, but receive %d.",
x.shape.size(), std::abs(axis));
FD_VISIT_FLOAT_TYPES(x.dtype, "SoftmaxKernel",
([&] { SoftmaxKernel<data_t>(x, out, axis); }));
}