Skip to content

Issue with RMS Normalization when scale is a scalar #26432

@justinchuby

Description

@justinchuby

ONNX spec states "Scale tensor shape should be broadcastable to the normalized shape," which should mean a scalar weight should be acceptable as the scale input. ORT rejects this input with error

onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Non-zero status code returned while running RMSNormalization node. Name:'node_rms_norm' Status Message: Size of scale and bias (if provided) must match X.shape[axis:], or scale and bias (with same shape) can be broadcasted to X when axis is 2. X.shape={2,5,3} scale.shape={} bias.shape={} and axis=2

Ref:

: LayerNormImpl(op_kernel_info, /* simplified */ true) {}

Ref:

if (params.broadcast_param == kLayerNormInvalidInput) {

cc @titaiwangms @gramalingam

Also @gramalingam : would it be a good idea to make scale optional? We can do a batch update on the normalization ops to make scale and bias optional in opset 25: onnx/onnx#6552

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions