Skip to content

Commit

Permalink
fix (#2972)
Browse files Browse the repository at this point in the history
Signed-off-by: chentong319 <[email protected]>
Co-authored-by: Tung D. Le <[email protected]>
  • Loading branch information
chentong319 and tungld authored Oct 11, 2024
1 parent e47bbcc commit f312f72
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions utils/RunONNXLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ OMTensorList *omTensorListCreateFromInputSignature(
}
// Create a randomly initialized tensor of the right shape.
OMTensor *tensor = nullptr;
if (type.equals("float") || type.equals("f32") || type.equals("i32")) {
if (type.compare("float") == 0 || type.compare("f32") == 0 ||
type.compare("i32") == 0) {
// Treat floats/f32 and i32 alike as they take the same memory footprint.
float *data = nullptr;
if (dataPtrList) {
Expand All @@ -372,8 +373,8 @@ OMTensorList *omTensorListCreateFromInputSignature(
assert(data && "failed to allocate data");
}
tensor = OM_TENSOR_CREATE(data, shape, rank, ONNX_TYPE_FLOAT, true);
} else if (type.equals("double") || type.equals("f64") ||
type.equals("i64")) {
} else if (type.compare("double") == 0 || type.compare("f64") == 0 ||
type.compare("i64") == 0) {
// Treat floats/f64 and i64 alike as they take the same memory footprint.
double *data = nullptr;
if (dataPtrList) {
Expand All @@ -383,7 +384,7 @@ OMTensorList *omTensorListCreateFromInputSignature(
assert(data && "failed to allocate data");
}
tensor = OM_TENSOR_CREATE(data, shape, rank, ONNX_TYPE_DOUBLE, true);
} else if (type.equals("string")) {
} else if (type.compare("string") == 0) {
// Add the handling of string type. "string" is the type in function
// signature.
char **data = nullptr;
Expand Down

0 comments on commit f312f72

Please sign in to comment.