mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-05 04:17:53 +00:00
layernorm throw error if input has no data (#9837)
This commit is contained in:
parent
9e75ebf0dc
commit
bf716e667c
2 changed files with 14 additions and 0 deletions
|
|
@ -41,6 +41,14 @@ Status SkipLayerNorm<T>::ComputeInternal(OpKernelContext* ctx) const {
|
|||
|
||||
Tensor* output = ctx->Output(0, input->Shape());
|
||||
|
||||
if (input->SizeInBytes() == 0) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "Inputs 'input' has no data from upstream nodes");
|
||||
}
|
||||
|
||||
if (skip->SizeInBytes() == 0) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "Inputs 'skip' has no data from upstream nodes");
|
||||
}
|
||||
|
||||
const auto& input_dims = input->Shape().GetDims();
|
||||
if (input_dims.size() != 3) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT,
|
||||
|
|
|
|||
|
|
@ -61,6 +61,12 @@ Status LayerNorm<T, U, simplified>::ComputeInternal(OpKernelContext* ctx) const
|
|||
auto bias_data = (simplified || (nullptr == bias)) ? nullptr : reinterpret_cast<const CudaT*>(bias->template Data<T>());
|
||||
|
||||
const TensorShape& x_shape = X->Shape();
|
||||
// Sometimes due to conversion issue, the input 'X' has no data which is a case that cuda kernel cannot handle.
|
||||
// Provide more error infomation here instead of CUDA errors.
|
||||
if (X->SizeInBytes() == 0) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "Inputs 'X' has no data from upstream nodes");
|
||||
}
|
||||
|
||||
const int64_t axis = HandleNegativeAxis(axis_, x_shape.NumDimensions());
|
||||
|
||||
int n1 = gsl::narrow<int>(x_shape.SizeToDimension(axis));
|
||||
|
|
|
|||
Loading…
Reference in a new issue