layer_pseudo_embed: Create an Embedding Matrix

Description Usage Arguments Value

View source: R/2-layers-pseudo-embed.R

Description

This function creates an embedding matrix in the form of a layer. This layer can be multiplied with other layers as if it were itself a weights matrix. This is because all samples within the embedding layer will always have the same activation.

Usage

1
layer_pseudo_embed(object, embed_dim, random_embedding = FALSE, name = NULL)

Arguments

object

A keras model.

embed_dim

An integer. The size of the final embedding matrix will equal the input dimension times the embedding dimension.

random_embedding

A boolean. Toggles whether to freeze the embedding matrix with random values. Otherwise, the embedding matrix is trainable.

name

A string. The prefix label for all layers.

Value

A layer that acts like an embedding matrix.


tpq/caress documentation built on March 11, 2021, 8:03 p.m.