pub struct ConstantPaddingLayerParams {
pub value: f32,
pub pad_amounts: Vec<u64>,
pub pad_to_given_output_size_mode: bool,
}Expand description
Constant padding layer. Pad the input array with a constant value, either along a single given axis or along a set of axes.
Requires 1 or 2 inputs and produces 1 output. The amount of padding can be either set as a parameter (“padAmounts”) or provided as a second input.
Output rank is same as the rank of the first input.
when “padToGivenOutputSizeMode” is False:
output_shape[i] = input_shape[i] + padAmounts[2i] + padAmounts[2i+1], i=0,…,rank-1
Examples:
input shape = (20,10) padAmounts = [0,1,4,0] output shape = (21,14)
input shape = (20,10,5) padAmounts = [0,0,3,4,0,9] output shape = (20,17,14)
when “padToGivenOutputSizeMode” is True
output_shape[i] = max(input_shape[i], max(padAmounts[2i] + padAmounts[2i+1])), i=0,…,rank-1
input shape = (20,10) padAmounts = [0,21,14,0] output shape = (21,14)
input shape = (20,10,5) padAmounts = [0,0,17,0,0,14] output shape = (20,17,14)
Fields§
§value: f32The value to be used for padding.
pad_amounts: Vec<u64>Length of this repeated field must be twice the rank of the first input. 2i-th and (2i+1)-th values represent the amount of padding to be applied to the the i-th input dimension, “before” and “after” the input values, respectively.
pad_to_given_output_size_mode: boolWhen this is True, positive values in “padAmounts” are equivalent to the output shape. In that case only one of padAmounts[2i] and padAmounts[2i+1] can be non zero, for i=0,..,rank-1.
Trait Implementations§
Source§impl Clone for ConstantPaddingLayerParams
impl Clone for ConstantPaddingLayerParams
Source§fn clone(&self) -> ConstantPaddingLayerParams
fn clone(&self) -> ConstantPaddingLayerParams
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 ConstantPaddingLayerParams
impl Debug for ConstantPaddingLayerParams
Source§impl Default for ConstantPaddingLayerParams
impl Default for ConstantPaddingLayerParams
Source§impl Message for ConstantPaddingLayerParams
impl Message for ConstantPaddingLayerParams
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 ConstantPaddingLayerParams
impl PartialEq for ConstantPaddingLayerParams
Source§fn eq(&self, other: &ConstantPaddingLayerParams) -> bool
fn eq(&self, other: &ConstantPaddingLayerParams) -> bool
self and other values to be equal, and is used by ==.