clipGradValueGPU function

void clipGradValueGPU(
  1. GPUTensor tensor,
  2. double clipValue,
  3. CommandBuffer tape
)

Implementation

void clipGradValueGPU(GPUTensor<dynamic> tensor, double clipValue, CommandBuffer tape) {
  tape.putInt(OP_CLIP_GRAD_VALUE);
  // Usually applied directly to the gradients before the optimizer step
  tape.putString('${tensor.id}_grad');
  tape.putFloat(clipValue);
}