Struct tfrecord::protobuf::HistogramProto
source · pub struct HistogramProto {
pub min: f64,
pub max: f64,
pub num: f64,
pub sum: f64,
pub sum_squares: f64,
pub bucket_limit: Vec<f64>,
pub bucket: Vec<f64>,
}
Expand description
Serialization format for histogram module in tsl/lib/histogram/histogram.h
Fields§
§min: f64
§max: f64
§num: f64
§sum: f64
§sum_squares: f64
§bucket_limit: Vec<f64>
Parallel arrays encoding the bucket boundaries and the bucket values. bucket(i) is the count for the bucket i. The range for a bucket is: i == 0: -DBL_MAX .. bucket_limit(0) i != 0: bucket_limit(i-1) .. bucket_limit(i)
bucket: Vec<f64>
Implementations§
source§impl HistogramProto
impl HistogramProto
sourcepub fn new<'a, L>(bucket_limit: L) -> Result<Self>where
L: Into<Cow<'a, [f64]>>,
pub fn new<'a, L>(bucket_limit: L) -> Result<Self>where L: Into<Cow<'a, [f64]>>,
Create a histogram with bucket limits.
The bucket_limit
must be an ordered sequence of finite values.
Otherwise it returns an error. The range of each bucket is defined by
- i == 0: f64::MIN..
limit[0]
- i > 0:
limit[i-1]
..limit[i]
sourcepub fn tf_default() -> Self
pub fn tf_default() -> Self
Create a histogram with TensorFlow’s default bucket limits.
sourcepub fn add(&mut self, value: f64, count: f64)
pub fn add(&mut self, value: f64, count: f64)
Add counts to the bucket containing the value.
Panics
It panics if value
is not finite, or count
is not finite or not non-negative.
sourcepub fn try_add_one(&mut self, value: f64) -> Result<()>
pub fn try_add_one(&mut self, value: f64) -> Result<()>
Add one count to the bucket containing the value.
value
must be finite. Otherwise it returns an error.
sourcepub fn try_add(&mut self, value: f64, count: f64) -> Result<()>
pub fn try_add(&mut self, value: f64, count: f64) -> Result<()>
Add counts to the bucket containing the value.
value
must be finite, and count
must be finite and non-negative.
Otherwise it returns an error.
sourcepub fn try_iter(&self) -> Result<impl Iterator<Item = (f64, f64)> + '_>
pub fn try_iter(&self) -> Result<impl Iterator<Item = (f64, f64)> + '_>
Create an iterator of (limit, count)
.
If returns an error if the lenghs of bucket_limit
and bucket
differ.
sourcepub fn iter(&self) -> impl Iterator<Item = (f64, f64)> + '_
pub fn iter(&self) -> impl Iterator<Item = (f64, f64)> + '_
Create an iterator of (limit, count)
.
Panics
It panics if the lenghs of bucket_limit
and bucket
differ.
sourcepub fn try_from_iter<T, I>(iter: I) -> Result<Self, Error>where
T: ToPrimitive,
I: IntoIterator<Item = T>,
pub fn try_from_iter<T, I>(iter: I) -> Result<Self, Error>where T: ToPrimitive, I: IntoIterator<Item = T>,
Create a histogram from an iterator of values, with TensorFlow’s default bucket limits.
Trait Implementations§
source§impl Clone for HistogramProto
impl Clone for HistogramProto
source§fn clone(&self) -> HistogramProto
fn clone(&self) -> HistogramProto
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for HistogramProto
impl Debug for HistogramProto
source§impl Default for HistogramProto
impl Default for HistogramProto
source§impl<'de> Deserialize<'de> for HistogramProto
impl<'de> Deserialize<'de> for HistogramProto
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl<A> FromIterator<A> for HistogramProtowhere
A: ToPrimitive,
impl<A> FromIterator<A> for HistogramProtowhere A: ToPrimitive,
source§fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> Self
source§impl IntoHistogram for HistogramProto
impl IntoHistogram for HistogramProto
fn try_into_histogram(self) -> Result<HistogramProto>
source§impl Message for HistogramProto
impl Message for HistogramProto
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>where B: BufMut, Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8, Global>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8, Global>where Self: Sized,
source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where B: BufMut, Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8, Global>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8, Global>where Self: Sized,
source§fn decode<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode<B>(buf: B) -> Result<Self, DecodeError>where B: Buf, Self: Default,
source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>where B: Buf, Self: Default,
source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where B: Buf, Self: Sized,
self
. Read moresource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where B: Buf, Self: Sized,
self
.source§impl PartialEq<HistogramProto> for HistogramProto
impl PartialEq<HistogramProto> for HistogramProto
source§fn eq(&self, other: &HistogramProto) -> bool
fn eq(&self, other: &HistogramProto) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for HistogramProto
impl Serialize for HistogramProto
impl StructuralPartialEq for HistogramProto
Auto Trait Implementations§
impl RefUnwindSafe for HistogramProto
impl Send for HistogramProto
impl Sync for HistogramProto
impl Unpin for HistogramProto
impl UnwindSafe for HistogramProto
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
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere R: Read + ReadEndian<P>, P: Default,
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.