mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-19 19:00:47 +00:00
Relax shape validation checks. Log a warning instead of returning an error. (#1476)
* Mention OrtCreateSessionFromArray in C API doc * Relax shape validation checks. Log a warning instead of returning an error.
This commit is contained in:
parent
c5f2f0f15b
commit
4aa4ca1502
1 changed files with 8 additions and 4 deletions
|
|
@ -566,9 +566,12 @@ common::Status InferenceSession::CheckShapes(const std::string& input_name,
|
|||
auto input_shape_sz = input_shape.NumDimensions();
|
||||
auto expected_shape_sz = expected_shape.NumDimensions();
|
||||
if (input_shape_sz != expected_shape_sz) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "Invalid rank for input: ",
|
||||
input_name,
|
||||
" Got: ", input_shape_sz, " Expected: ", expected_shape_sz);
|
||||
std::ostringstream ostr;
|
||||
ostr << "Invalid rank for input: " << input_name
|
||||
<< " Got: " << input_shape_sz << " Expected: " << expected_shape_sz
|
||||
<< " Please fix either the inputs or the model.";
|
||||
LOGS(*session_logger_, WARNING) << ostr.str();
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
std::vector<int> invalid_dim_indices;
|
||||
|
|
@ -588,7 +591,8 @@ common::Status InferenceSession::CheckShapes(const std::string& input_name,
|
|||
int idx = invalid_dim_indices[i];
|
||||
ostr << " index: " << idx << " Got: " << input_shape[idx] << " Expected: " << expected_shape[idx] << "\n";
|
||||
}
|
||||
return Status(ONNXRUNTIME, INVALID_ARGUMENT, ostr.str());
|
||||
ostr << " Please fix either the inputs or the model.";
|
||||
LOGS(*session_logger_, WARNING) << ostr.str();
|
||||
}
|
||||
|
||||
return Status::OK();
|
||||
|
|
|
|||
Loading…
Reference in a new issue