OrValue

class onnxscript.rewriter.pattern.OrValue(values: Sequence[ValuePattern], name: str | None = None, tag_var: str | None = None, tag_values: Sequence[Any] | None = None)[source]

Creates an OR pattern.

Parameters:
  • values – A sequence of value patterns to match against.

  • name – An optional variable name for the pattern. Defaults to None. If present, this name will be bound to the value matched by the pattern.

  • tag_var – An optional variable name for the tag. Defaults to None. If present, it will be bound to a value (from tag_values) indicating which alternative was matched.

  • tag_values – An optional sequence of values to bind to the tag_var. Defaults to None. If present, the length of tag_values must match the number of alternatives in values. In a successful match, tag-var will be bound to the i-th value in tag_values if the i-th alternative pattern matched. If omitted, the default value of (0, 1, 2, …) will be used.