Skip to content

Commit

Permalink
Drop ParseScalar definition
Browse files Browse the repository at this point in the history
  • Loading branch information
adityagoel4512 committed Oct 17, 2023
1 parent c697280 commit de75954
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
3 changes: 0 additions & 3 deletions onnxruntime/core/framework/tensorprotoutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,6 @@ inline const ONNX_NAMESPACE::TensorShapeProto& GetShape(const ONNX_NAMESPACE::Ty
template <typename T>
const std::vector<T> ParseData(const ONNX_NAMESPACE::TensorProto& ten_proto);

template <typename T>
const T ParseScalar(const ONNX_NAMESPACE::TensorProto& ten_proto);

inline bool HasRawData(const ONNX_NAMESPACE::TensorProto& ten_proto) {
// Can not be UNDEFINED and can not be STRING but test for STRING is usually performed separately
// to return an error
Expand Down
15 changes: 8 additions & 7 deletions onnxruntime/core/providers/cpu/ml/label_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,15 @@ class LabelEncoder_4 final : public OpKernel {
}
}
Status Compute(OpKernelContext* context) const override {
const auto* tensor_pointer = context->Input<Tensor>(0);
if (tensor_pointer == nullptr) return Status(common::ONNXRUNTIME, common::FAIL, "input count mismatch");
const Tensor& X = *tensor_pointer;
const TensorShape& shape = X.Shape();
Tensor& Y = *context->Output(0, shape);
const auto* X = context->Input<Tensor>(0);
if (nullptr == X) {
return Status(common::ONNXRUNTIME, common::FAIL, "input count mismatch");
}
const TensorShape& shape = X->Shape();
auto* Y = context->Output(0, shape);

auto input = X.template DataAsSpan<TKey>();
auto output = Y.template MutableDataAsSpan<TValue>();
auto input = X->template DataAsSpan<TKey>();
auto output = Y->template MutableDataAsSpan<TValue>();

for (int64_t i = 0; i < shape.Size(); ++i) {
const auto found = _map.find(input[onnxruntime::narrow<size_t>(i)]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,6 @@
"^test_resize_upsample_sizes_nearest_not_larger_cuda",
"^test_resize_upsample_sizes_nearest_round_prefer_ceil_asymmetric_cuda",
// onnx 1.15 (opset 20) new and updated op tests
"^test_ai_onnx_ml_label_encoder_string_int",
"^test_ai_onnx_ml_label_encoder_string_int_no_default",
"^test_ai_onnx_ml_label_encoder_tensor_mapping",
"^test_ai_onnx_ml_label_encoder_tensor_value_only_mapping",
"^test_gridsample_aligncorners_true",
"^test_gridsample_bicubic_align_corners_0_additional_1",
"^test_gridsample_bicubic_align_corners_1_additional_1",
Expand Down

0 comments on commit de75954

Please sign in to comment.