Welcome to our Support Center

RelativePositionBias

Description

Compute binned relative position bias for T5 model. ref: https://arxiv.org/abs/1803.02155v2

 

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.

bias_table (heterogeneous) – T : object, 2D input tensor with shape (num_buckets, num_heads), COL-major(See UT for example).
query_length (heterogeneous) – U : object, the length of query. Self Attention requires query_length = key_length.
key_length (heterogeneous) – U : object, the length of key.

 Parameters : cluster,

is_bidirectional : boolean, indicates whether the position bias should be computed bidirectionally.
Default value “False”.
max_distance : integer, the maximum distance considered between two positions. Beyond this distance, all positions are grouped into the same “bucket.”
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

 

output (heterogeneous) – T : object, 4D output tensor with shape (1, num_heads, sequence_length, sequence_length).

Type Constraints

T in (tensor(float)tensor(float16)) : Constrain input and output types to float or half tensors.

U in (tensor(int64)) : Constrain sequence_length to int 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