torch.is_autocast_cpu_enabled
function is_autocast_cpu_enabled(): booleanChecks if automatic mixed precision is enabled for CPU operations.
Autocast is a PyTorch feature that automatically casts operations to lower precision (like float16) on appropriate devices for performance while maintaining accuracy. This is primarily used with NVIDIA GPUs in PyTorch, but torch.js runs on WebGPU which handles precision differently.
torch.js does not implement autocast. WebGPU operations use fixed precision. To control precision, use the
dtype option when creating tensors.Returns
boolean– Always false in torch.js (autocast not supported)Examples
// Check if autocast is enabled for CPU
const enabled = torch.is_autocast_cpu_enabled();
// torch.js: always falseSee Also
- PyTorch torch.is_autocast_cpu_enabled()
- is_autocast_gpu_enabled - Check GPU autocast status
- get_autocast_cpu_dtype - Get the dtype that would be used