Skip to main content

Version

Enum Version 

Source
#[repr(i32)]
pub enum Version {
Show 13 variants StartVersion = 0, IrVersion20171010 = 1, IrVersion20171030 = 2, IrVersion2017113 = 3, IrVersion2019122 = 4, IrVersion2019318 = 5, IrVersion2019919 = 6, IrVersion202058 = 7, IrVersion2021730 = 8, IrVersion202355 = 9, IrVersion2024325 = 10, IrVersion20250512 = 11, IrVersion = 12,
}
Expand description

Versioning

ONNX versioning is specified in docs/IR.md and elaborated on in docs/Versioning.md

To be compatible with both proto2 and proto3, we will use a version number that is not defined by the default value but an explicit enum number.

Variants§

§

StartVersion = 0

proto3 requires the first enum value to be zero. We add this just to appease the compiler.

§

IrVersion20171010 = 1

The version field is always serialized and we will use it to store the version that the graph is generated from. This helps us set up version control. For the IR, we are using simple numbers starting with 0x00000001, which was the version we published on Oct 10, 2017.

§

IrVersion20171030 = 2

IR_VERSION 2 published on Oct 30, 2017

  • Added type discriminator to AttributeProto to support proto3 users
§

IrVersion2017113 = 3

IR VERSION 3 published on Nov 3, 2017

  • For operator versioning:
    • Added new message OperatorSetIdProto
    • Added opset_import in ModelProto
  • For vendor extensions, added domain in NodeProto
§

IrVersion2019122 = 4

IR VERSION 4 published on Jan 22, 2019

  • Relax constraint that initializers should be a subset of graph inputs
  • Add type BFLOAT16
§

IrVersion2019318 = 5

IR VERSION 5 published on March 18, 2019

  • Add message TensorAnnotation.
  • Add quantization annotation in GraphProto to map tensor with its scale and zero point quantization parameters.
§

IrVersion2019919 = 6

IR VERSION 6 published on Sep 19, 2019

  • Add support for sparse tensor constants stored in model.
    • Add message SparseTensorProto
    • Add sparse initializers
§

IrVersion202058 = 7

IR VERSION 7 published on May 8, 2020

  • Add support to allow function body graph to rely on multiple external operator sets.
  • Add a list to promote inference graph’s initializers to global and mutable variables. Global variables are visible in all graphs of the stored models.
  • Add message TrainingInfoProto to store initialization method and training algorithm. The execution of TrainingInfoProto can modify the values of mutable variables.
  • Implicitly add inference graph into each TrainingInfoProto’s algorithm.
§

IrVersion2021730 = 8

IR VERSION 8 published on July 30, 2021 Introduce TypeProto.SparseTensor Introduce TypeProto.Optional Added a list of FunctionProtos local to the model Deprecated since_version and operator status from FunctionProto

§

IrVersion202355 = 9

IR VERSION 9 published on May 5, 2023 Added AttributeProto to FunctionProto so that default attribute values can be set. Added FLOAT8E4M3FN, FLOAT8E4M3FNUZ, FLOAT8E5M2, FLOAT8E5M2FNUZ.

§

IrVersion2024325 = 10

IR VERSION 10 published on March 25, 2024 Added UINT4, INT4, overload field for functions and metadata_props on multiple proto definitions.

§

IrVersion20250512 = 11

IR VERSION 11 published on May 12, 2025 Added FLOAT4E2M1, multi-device protobuf classes.

§

IrVersion = 12

IR VERSION 12 published on TBD Added FLOAT8E8M0.

Implementations§

Source§

impl Version

Source

pub fn is_valid(value: i32) -> bool

Returns true if value is a variant of Version.

Source

pub fn from_i32(value: i32) -> Option<Version>

👎Deprecated:

Use the TryFrom<i32> implementation instead

Converts an i32 to a Version, or None if value is not a valid variant.

Source§

impl Version

Source

pub fn as_str_name(&self) -> &'static str

String value of the enum field names used in the ProtoBuf definition.

The values are not transformed in any way and thus are considered stable (if the ProtoBuf definition does not change) and safe for programmatic use.

Source

pub fn from_str_name(value: &str) -> Option<Version>

Creates an enum from field names used in the ProtoBuf definition.

Trait Implementations§

Source§

impl Clone for Version

Source§

fn clone(&self) -> Version

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Version

Source§

impl Debug for Version

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Version

Source§

fn default() -> Version

Returns the “default value” for a type. Read more
Source§

impl Eq for Version

Source§

impl Hash for Version

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Version

Source§

fn cmp(&self, other: &Version) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Version

Source§

fn eq(&self, other: &Version) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Version

Source§

fn partial_cmp(&self, other: &Version) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Version

Source§

impl TryFrom<i32> for Version

Source§

type Error = UnknownEnumValue

The type returned in the event of a conversion error.
Source§

fn try_from(value: i32) -> Result<Version, UnknownEnumValue>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedComponent for T
where T: Any + Send + Sync,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more