Introduction

Tutorials

Developer guide

API Reference

public MHAttentionparametric type

MHAttention(nheads::Integer, qkv_layer, attn_drop, projection)

Multi-head self-attention layer.

Arguments:

  • nheads: Number of heads
  • qkv_layer: layer to be used for getting the query, key and value
  • attn_drop: dropout rate after the self-attention layer
  • projection: projection layer to be used after self-attention
MHAttention(planes::Integer, nheads::Integer = 8; qkv_bias::Bool = false, attn_drop = 0., proj_drop = 0.)

Multi-head self-attention layer.

Arguments:

  • planes: number of input channels
  • nheads: number of heads
  • qkv_bias: whether to use bias in the layer to get the query, key and value
  • attn_drop: dropout rate after the self-attention layer
  • proj_drop: dropout rate after the projection layer