pub struct AttributeProto {Show 18 fields
pub name: String,
pub ref_attr_name: String,
pub doc_string: String,
pub type: i32,
pub f: f32,
pub i: i64,
pub s: Vec<u8>,
pub t: Option<TensorProto>,
pub g: Option<GraphProto>,
pub sparse_tensor: Option<SparseTensorProto>,
pub tp: Option<TypeProto>,
pub floats: Vec<f32>,
pub ints: Vec<i64>,
pub strings: Vec<Vec<u8>>,
pub tensors: Vec<TensorProto>,
pub graphs: Vec<GraphProto>,
pub sparse_tensors: Vec<SparseTensorProto>,
pub type_protos: Vec<TypeProto>,
}Expand description
Attributes
A named attribute containing either singular float, integer, string, graph, and tensor values, or repeated float, integer, string, graph, and tensor values. An AttributeProto MUST contain the name field, and only one of the following content fields, effectively enforcing a C/C++ union equivalent.
Fields§
§name: StringThe name field MUST be present for this version of the IR.
namespace Attribute
ref_attr_name: Stringif ref_attr_name is not empty, ref_attr_name is the attribute name in parent function. In this case, this AttributeProto does not contain data, and it’s a reference of attribute in parent scope. NOTE: This should ONLY be used in function (sub-graph). It’s invalid to be used in main graph.
doc_string: StringA human-readable documentation for this attribute. Markdown is allowed.
type: i32The type field MUST be present for this version of the IR. For 0.0.1 versions of the IR, this field was not defined, and implementations needed to use has_field heuristics to determine which value field was in use. For IR_VERSION 0.0.2 or later, this field MUST be set and match the f|i|s|t|… field in use. This change was made to accommodate proto3 implementations.
discriminator that indicates which field below is in use
f: f32Exactly ONE of the following fields must be present for this version of the IR
float
i: i64int
s: Vec<u8>UTF-8 string
t: Option<TensorProto>tensor value
g: Option<GraphProto>graph
sparse_tensor: Option<SparseTensorProto>sparse tensor value
tp: Option<TypeProto>Do not use field below, it’s deprecated. optional ValueProto v = 12; // value - subsumes everything but graph
type proto
floats: Vec<f32>list of floats
ints: Vec<i64>list of ints
strings: Vec<Vec<u8>>list of UTF-8 strings
tensors: Vec<TensorProto>list of tensors
graphs: Vec<GraphProto>list of graph
sparse_tensors: Vec<SparseTensorProto>list of sparse tensors
type_protos: Vec<TypeProto>list of type protos
Implementations§
Source§impl AttributeProto
impl AttributeProto
Sourcepub fn type(&self) -> AttributeType
pub fn type(&self) -> AttributeType
Returns the enum value of type, or the default if the field is set to an invalid enum value.
Sourcepub fn set_type(&mut self, value: AttributeType)
pub fn set_type(&mut self, value: AttributeType)
Sets type to the provided enum value.
Trait Implementations§
Source§impl Clone for AttributeProto
impl Clone for AttributeProto
Source§fn clone(&self) -> AttributeProto
fn clone(&self) -> AttributeProto
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AttributeProto
impl Debug for AttributeProto
Source§impl Default for AttributeProto
impl Default for AttributeProto
Source§fn default() -> AttributeProto
fn default() -> AttributeProto
Source§impl Message for AttributeProto
impl Message for AttributeProto
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.Source§impl PartialEq for AttributeProto
impl PartialEq for AttributeProto
Source§fn eq(&self, other: &AttributeProto) -> bool
fn eq(&self, other: &AttributeProto) -> bool
self and other values to be equal, and is used by ==.