activation.h

Activation functions.

Enums

enum class NVTE_Activation_Type

Compute activation of the input.

Param input:

[in] Input tensor for activation.

Param output:

[inout] Output tensor.

Param stream:

[in] CUDA stream used for the operation.

Values:

enumerator GELU
enumerator GEGLU
enumerator SILU
enumerator SWIGLU
enumerator RELU
enumerator REGLU
enumerator QGELU
enumerator QGEGLU
enumerator SRELU
enumerator SREGLU

Functions

void nvte_gelu(const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_silu(const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_relu(const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_qgelu(const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_srelu(const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_dgelu(const NVTETensor grad, const NVTETensor input, NVTETensor output, cudaStream_t stream)

Compute activation gradient.

Parameters:
  • grad[in] Incoming gradient.

  • input[in] Input tensor for activation.

  • output[inout] Output tensor.

  • stream[in] CUDA stream used for the operation.

void nvte_dsilu(const NVTETensor grad, const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_drelu(const NVTETensor grad, const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_dqgelu(const NVTETensor grad, const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_dsrelu(const NVTETensor grad, const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_geglu(const NVTETensor input, NVTETensor output, cudaStream_t stream)

Compute gated activation of the input.

Parameters:
  • input[in] Input tensor of shape [N, H * 2].

  • output[inout] Output tensor of shape [N, H]. It computes Act(input[N, :H]) x input[N, H:]

  • stream[in] CUDA stream used for the operation.

void nvte_swiglu(const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_reglu(const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_qgeglu(const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_sreglu(const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_dgeglu(const NVTETensor grad, const NVTETensor input, NVTETensor output, cudaStream_t stream)

Compute gated activation gradient.

Parameters:
  • grad[in] Incoming gradient of shape [N, H].

  • input[in] Forward input tensor of shape [N, H * 2].

  • output[inout] Outgoing gradient of shape [N, H * 2].

  • stream[in] CUDA stream used for the operation.

void nvte_dswiglu(const NVTETensor grad, const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_dreglu(const NVTETensor grad, const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_dqgeglu(const NVTETensor grad, const NVTETensor input, NVTETensor output, cudaStream_t stream)
void nvte_dsreglu(const NVTETensor grad, const NVTETensor input, NVTETensor output, cudaStream_t stream)