Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Chu <justinchu@microsoft.com>
  • Loading branch information
justinchuby committed Sep 15, 2023
1 parent 1bb9254 commit 21a952e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions onnx/defs/math/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@

namespace ONNX_NAMESPACE {
template <typename T>
T GetScalarValueFromTensor(const TensorProto* t) {
T GetScalarValueFromTensor(const ONNX_NAMESPACE::TensorProto* t) {
if (t == nullptr) {
return T{};
}

auto data_type = t->data_type();
switch (data_type) {
case TensorProto::FLOAT:
case ONNX_NAMESPACE::TensorProto::FLOAT:
return static_cast<T>(ONNX_NAMESPACE::ParseData<float>(t).at(0));
case TensorProto::DOUBLE:
case ONNX_NAMESPACE::TensorProto::DOUBLE:
return static_cast<T>(ONNX_NAMESPACE::ParseData<double>(t).at(0));
case TensorProto::INT32:
case ONNX_NAMESPACE::TensorProto::INT32:
return static_cast<T>(ONNX_NAMESPACE::ParseData<int32_t>(t).at(0));
case TensorProto::INT64:
case ONNX_NAMESPACE::TensorProto::INT64:
return static_cast<T>(ONNX_NAMESPACE::ParseData<int64_t>(t).at(0));
default:
fail_shape_inference("Unsupported input data type of ", data_type);
Expand Down
2 changes: 1 addition & 1 deletion onnx/defs/math/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

namespace ONNX_NAMESPACE {
template <typename T>
T GetScalarValueFromTensor(const TensorProto* t);
T GetScalarValueFromTensor(const ONNX_NAMESPACE::TensorProto* t);
} // namespace ONNX_NAMESPACE

0 comments on commit 21a952e

Please sign in to comment.