Show / Hide Table of Contents

Class Embedding

Turns positive integers (indexes) into dense vectors of fixed size. eg. [[4], [20]] -> [[0.25, 0.1], [0.6, -0.2]]

This layer can only be used as the first layer in a model.

Inheritance
System.Object
BaseLayer
Embedding
Inherited Members
BaseLayer.Params
BaseLayer.Input
BaseLayer.Output
BaseLayer.Name
BaseLayer.SkipPred
BaseLayer.Item[String]
BaseLayer.BuildParam(String, Int64[], DataType, BaseInitializer, BaseConstraint, BaseRegularizer, Boolean)
Namespace: SiaNet.Layers
Assembly: SiaNet.dll
Syntax
public class Embedding : BaseLayer

Constructors

| Improve this Doc View Source

Embedding(Int32, Int32, BaseInitializer, BaseRegularizer, BaseConstraint)

Initializes a new instance of the Embedding class.

Declaration
public Embedding(int inputDim, int outputDim, BaseInitializer embeddingsInitializer = null, BaseRegularizer embeddingsRegularizer = null, BaseConstraint embeddingsConstraint = null)
Parameters
Type Name Description
System.Int32 inputDim

Size of the vocabulary, i.e. maximum integer index + 1.

System.Int32 outputDim

int >= 0, Dimension of the dense embedding.

BaseInitializer embeddingsInitializer

Initializer for the embedding weight matrix.

BaseRegularizer embeddingsRegularizer

Regularizer function for the embedding weight matrix.

BaseConstraint embeddingsConstraint

Constraint function for the embedding weight matrix.

Properties

| Improve this Doc View Source

EmbeddingsConstraint

Constraint function for the embedding weight matrix

Declaration
public BaseConstraint EmbeddingsConstraint { get; set; }
Property Value
Type Description
BaseConstraint

The embeddings constraint.

| Improve this Doc View Source

EmbeddingsInitializer

Initializer for the embedding weight matrix.

Declaration
public BaseInitializer EmbeddingsInitializer { get; set; }
Property Value
Type Description
BaseInitializer

The embeddings initializer.

| Improve this Doc View Source

EmbeddingsRegularizer

Regularizer function for the embedding weight matrix.

Declaration
public BaseRegularizer EmbeddingsRegularizer { get; set; }
Property Value
Type Description
BaseRegularizer

The embeddings regularizer.

| Improve this Doc View Source

InputDim

int > 0, Size of the vocabulary, i.e. maximum integer index + 1.

Declaration
public int InputDim { get; set; }
Property Value
Type Description
System.Int32

The input dim.

| Improve this Doc View Source

OutputDim

int >= 0, Dimension of the dense embedding.

Declaration
public int OutputDim { get; set; }
Property Value
Type Description
System.Int32

The output dim.

Methods

| Improve this Doc View Source

Backward(Tensor)

Calculate the gradient of this layer function

Declaration
public override void Backward(Tensor outputgrad)
Parameters
Type Name Description
Tensor outputgrad

The calculated output grad from previous layer.

Overrides
BaseLayer.Backward(Tensor)
| Improve this Doc View Source

Forward(Tensor)

Forwards the inputs and compute the output

Declaration
public override void Forward(Tensor x)
Parameters
Type Name Description
Tensor x

The input tensor for this layer.

Overrides
BaseLayer.Forward(Tensor)

See Also

BaseLayer
  • Improve this Doc
  • View Source
Back to top Generated by DocFX