pub struct AttributeProto {Show 17 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 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: String
The name field MUST be present for this version of the IR.
namespace Attribute
ref_attr_name: String
if 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: String
A human-readable documentation for this attribute. Markdown is allowed.
type: i32
The 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 hueristics 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 accomodate proto3 implementations.
discriminator that indicates which field below is in use
f: f32
Exactly ONE of the following fields must be present for this version of the IR
float
i: i64
int
s: Vec<u8>
UTF-8 string
t: Option<TensorProto>
tensor value
g: Option<GraphProto>
graph
sparse_tensor: Option<SparseTensorProto>
sparse tensor value
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 · 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§impl Message for AttributeProto
impl Message for AttributeProto
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
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<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
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<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
Source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
Source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
. Read moreSource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
.Source§impl PartialEq for AttributeProto
impl PartialEq for AttributeProto
impl StructuralPartialEq for AttributeProto
Auto Trait Implementations§
impl Freeze for AttributeProto
impl RefUnwindSafe for AttributeProto
impl Send for AttributeProto
impl Sync for AttributeProto
impl Unpin for AttributeProto
impl UnwindSafe for AttributeProto
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more