Welcome to our Support Center

NGramRepeatBlock

Description

Enforce no repetition of n-grams. Scores are set to -inf for tokens that form a repeated n-gram if added to the back of the input_ids.

 

Input parameters

 

specified_outputs_namearray, this parameter lets you manually assign custom names to the output tensors of a node.

 Graphs in : cluster, ONNX model architecture.

input_ids (heterogeneous) – Tid : object, 2D input tensor with shape (batch_size, sequence_length).
scores (heterogeneous) – T : object, 2D input tensor with shape (batch_size, vocab_size).

 Parameters : cluster,

ngram_size : integer, the NGram size.
Default value “0”.
 training? : boolean, whether the layer is in training mode (can store data for backward).
Default value “True”.
 lda coeff : float, defines the coefficient by which the loss derivative will be multiplied before being sent to the previous layer (since during the backward run we go backwards).
Default value “1”.

 name (optional) : string, name of the node.

Output parameters

 

scores_out (heterogeneous) – T : object, 2D output tensor with shape (batch_size, vocab_size).

Type Constraints

T in (tensor(int64)) : Constrain indices to integer types.

Tid in (tensor(float)) : Constrain scores input and output types to float tensors.

Example

All these exemples are snippets PNG, you can drop these Snippet onto the block diagram and get the depicted code added to your VI (Do not forget to install Deep Learning library to run it).
Table of Contents