pub struct EmbeddingLayerParams {
pub input_dim: u64,
pub output_channels: u64,
pub has_bias: bool,
pub weights: Option<WeightParams>,
pub bias: Option<WeightParams>,
}Expand description
A layer that performs a matrix lookup and optionally adds a bias. The weights matrix is stored with dimensions [outputChannels, inputDim].
.. code::
y = EmbeddingLayer(x)Requires 1 input and produces 1 output.
Input
Input values must be in the range \[0, inputDim - 1\].
Input must have rank equal to 4 or 5, such that the last 3 dimensions are all 1.
rank 4: shape (x1, 1, 1, 1). x1 is effectively the batch/sequence length.
rank 5: shape (x1, x2 , 1, 1, 1). x1 * x2 is effectively the combined batch/sequence length.Output Output rank is same as the input rank. Please see input description above. rank 4: shape (x1, outputChannels, 1, 1) rank 5: shape (x1, x2, outputChannels, 1, 1)
Fields§
§input_dim: u64Size of the input dictionary.
output_channels: u64Size of the output vectors.
has_bias: boolWhether a bias is added or not.
weights: Option<WeightParams>2-D weights of dimensions [outputChannels, inputDim].
bias: Option<WeightParams>Bias of size [outputChannels].
Trait Implementations§
Source§impl Clone for EmbeddingLayerParams
impl Clone for EmbeddingLayerParams
Source§fn clone(&self) -> EmbeddingLayerParams
fn clone(&self) -> EmbeddingLayerParams
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EmbeddingLayerParams
impl Debug for EmbeddingLayerParams
Source§impl Default for EmbeddingLayerParams
impl Default for EmbeddingLayerParams
Source§impl Message for EmbeddingLayerParams
impl Message for EmbeddingLayerParams
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
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,
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
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,
Encodes the message with a length-delimiter to a buffer. Read more
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,
Encodes the message with a length-delimiter to a newly allocated buffer.
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes an instance of the message from a buffer. Read more
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,
Decodes a length-delimited instance of the message from the buffer.
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,
Decodes an instance of the message from a buffer, and merges it into
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,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.Source§impl PartialEq for EmbeddingLayerParams
impl PartialEq for EmbeddingLayerParams
Source§fn eq(&self, other: &EmbeddingLayerParams) -> bool
fn eq(&self, other: &EmbeddingLayerParams) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for EmbeddingLayerParams
Auto Trait Implementations§
impl Freeze for EmbeddingLayerParams
impl RefUnwindSafe for EmbeddingLayerParams
impl Send for EmbeddingLayerParams
impl Sync for EmbeddingLayerParams
impl Unpin for EmbeddingLayerParams
impl UnsafeUnpin for EmbeddingLayerParams
impl UnwindSafe for EmbeddingLayerParams
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
Mutably borrows from an owned value. Read more