Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ mimalloc;https://github.com/microsoft/mimalloc/archive/refs/tags/v2.1.1.zip;d5ee
mp11;https://github.com/boostorg/mp11/archive/refs/tags/boost-1.82.0.zip;9bc9e01dffb64d9e0773b2e44d2f22c51aace063
# ONNX 1.23.2 final release (opset 28).
# The 7 CI requirements.txt files are pinned to onnx==1.23.2.
# ONNX_VERSION=1.23.2
onnx;https://github.com/onnx/onnx/archive/refs/tags/v1.23.2.zip;8846de32ab45e653c2cd651d8d6c4c299fb1583d
# Use the latest commit of 10.9-GA
onnx_tensorrt;https://github.com/onnx/onnx-tensorrt/archive/d5dce67db7c2e64b07e055571f5ec06f7f254de2.zip;01114d3b67650857281fa50faa2e412130a63b69
Expand Down
14 changes: 8 additions & 6 deletions cmake/onnxruntime_unittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1989,13 +1989,15 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
# coverage gap this feature exists to close.
# ---------------------------------------------------------------------------
if (onnxruntime_MATERIALIZE_ONNX_NODE_TESTS AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
# Derive the expected wheel version from the archive URL so this also works with installed ONNX packages.
string(REGEX MATCH "v([0-9]+\\.[0-9]+\\.[0-9]+)" _onnx_url_version "${DEP_URL_onnx}")
if(CMAKE_MATCH_1)
set(_onnx_pinned_version ${CMAKE_MATCH_1})
# Commit-pinned archives do not encode a release version in DEP_URL_onnx. Keep the
# expected wheel version in deps.txt alongside the exact archive pin.
file(STRINGS "${REPO_ROOT}/cmake/deps.txt" _onnx_version_line REGEX "^# ONNX_VERSION=")
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" _onnx_pinned_version "${_onnx_version_line}")
if(_onnx_pinned_version)
string(STRIP "${_onnx_pinned_version}" _onnx_pinned_version)
else()
message(FATAL_ERROR "Could not parse the pinned ONNX version from DEP_URL_onnx='${DEP_URL_onnx}' "
"(expected a vX.Y.Z tag). Fix cmake/deps.txt or this parser.")
message(FATAL_ERROR "Could not parse ONNX_VERSION=X.Y.Z from cmake/deps.txt. "
"Fix the ONNX dependency metadata or this parser.")
endif()

# Python interpreter is not guaranteed for static test-only builds (the top-level
Expand Down
30 changes: 20 additions & 10 deletions docs/OperatorKernels.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions include/onnxruntime/core/session/onnxruntime_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ typedef enum ONNXTensorElementDataType {
// Float8E8M0 type introduced in ONNX 1.21. 8-bit float with 8 exponent bits, 0 mantissa bits, no sign bit.
ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E8M0, // Non-IEEE floating-point format, all values are powers of two
// Float6 types introduced in ONNX 1.23.
// ORT tensor storage uses one byte per element. TensorProto typed serialization uses int32_data;
// TensorProto raw_data uses bit-packed 6-bit values.
// Float6 types introduced in ONNX 1.23. ORT tensor storage uses one byte per element.
// TensorProto typed serialization uses int32_data; raw_data uses bit-packed 6-bit values.
ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT6E2M3,
ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT6E3M2,
} ONNXTensorElementDataType;
Expand Down
2 changes: 1 addition & 1 deletion js/web/docs/webgpu-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Do not modify directly.*
| DepthToSpace | ai.onnx(11-12,13+); com.ms.internal.nhwc(11-12,13+) | |
| DequantizeLinear | ai.onnx(10-12,13-18,19-20,21+) | |
| Div | ai.onnx(7-12,13,14+) | |
| Einsum | ai.onnx(12+) | |
| Einsum | ai.onnx(12-27,28+) | |
| Elu | ai.onnx(6+) | |
| Equal | ai.onnx(7-10,11-12,13-18,19+) | |
| Erf | ai.onnx(9-12,13+) | |
Expand Down
6 changes: 5 additions & 1 deletion onnxruntime/core/providers/cpu/activation/activations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ REGISTER_VERSIONED_UNARY_ELEMENTWISE_KERNEL(Softsign, 1, 21);
REGISTER_UNARY_ELEMENTWISE_KERNEL(Softsign, 22);
REGISTER_VERSIONED_UNARY_ELEMENTWISE_TYPED_KERNEL(Tanh, 6, 12, float);
REGISTER_VERSIONED_UNARY_ELEMENTWISE_TYPED_KERNEL(Tanh, 6, 12, double);
REGISTER_UNARY_ELEMENTWISE_KERNEL(Celu, 12);
REGISTER_VERSIONED_UNARY_ELEMENTWISE_KERNEL(Celu, 12, 27);
REGISTER_UNARY_ELEMENTWISE_TYPED_KERNEL(Celu, 28, float);
REGISTER_UNARY_ELEMENTWISE_TYPED_KERNEL(Celu, 28, double);
REGISTER_UNARY_ELEMENTWISE_TYPED_KERNEL(Celu, 28, MLFloat16);
REGISTER_UNARY_ELEMENTWISE_TYPED_KERNEL(Celu, 28, BFloat16);
REGISTER_UNARY_ELEMENTWISE_TYPED_KERNEL(Tanh, 13, float);
REGISTER_UNARY_ELEMENTWISE_TYPED_KERNEL(Tanh, 13, double);
REGISTER_VERSIONED_UNARY_ELEMENTWISE_KERNEL(ThresholdedRelu, 10, 21);
Expand Down
54 changes: 54 additions & 0 deletions onnxruntime/core/providers/cpu/activation/activations.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#pragma once

#include <algorithm>
#include <cmath>

#include "core/common/float16.h"
#include "core/common/common.h"
#include "core/platform/threadpool.h"
#include "core/framework/op_kernel.h"
Expand Down Expand Up @@ -30,6 +34,56 @@ struct Celu : public ElementWiseRangedTransform<T> {
}
};

template <>
struct Celu<MLFloat16> : public ElementWiseRangedTransform<MLFloat16> {
float alpha;
Status Init(const onnxruntime::NodeAttributes& attributes) {
return GetFloatParam("alpha", attributes, alpha);
}
GSL_SUPPRESS(r.11)
ElementWiseRangedTransform<MLFloat16>* Copy() const final {
return new Celu<MLFloat16>(*this);
}

float Cost() const final {
return 1.0f;
}
void operator()(std::ptrdiff_t first, std::ptrdiff_t last) const final {
const float typed_alpha = MLFloat16(alpha).ToFloat();
for (auto i = first; i < last; ++i) {
const float x = this->input[i].ToFloat();
this->output[i] = std::isnan(x) ? this->input[i]
: MLFloat16(std::max(0.0f, x) +
std::min(0.0f, typed_alpha * (std::exp(x / typed_alpha) - 1.0f)));
}
}
};

template <>
struct Celu<BFloat16> : public ElementWiseRangedTransform<BFloat16> {
float alpha;
Status Init(const onnxruntime::NodeAttributes& attributes) {
return GetFloatParam("alpha", attributes, alpha);
}
GSL_SUPPRESS(r.11)
ElementWiseRangedTransform<BFloat16>* Copy() const final {
return new Celu<BFloat16>(*this);
}

float Cost() const final {
return 1.0f;
}
void operator()(std::ptrdiff_t first, std::ptrdiff_t last) const final {
const float typed_alpha = BFloat16(alpha).ToFloat();
for (auto i = first; i < last; ++i) {
const float x = this->input[i].ToFloat();
this->output[i] = std::isnan(x) ? this->input[i]
: BFloat16(std::max(0.0f, x) +
std::min(0.0f, typed_alpha * (std::exp(x / typed_alpha) - 1.0f)));
}
}
};

template <typename T>
struct Elu : public ElementWiseRangedTransform<T> {
ORT_GET_FLOAT_ATTR_AND_RETURN(alpha);
Expand Down
Loading
Loading