![]() |
ImFusion C++ SDK 4.5.0
|
#include <TorchPlugin/include/ImFusion/Torch/TorchUtils.h>
RAII helper for managing PyTorch autocast state across engines. More...
RAII helper for managing PyTorch autocast state across engines.
Automatically enables autocast on construction and restores previous state on destruction.
Example usage:
Public Member Functions | |
| AutocastScope (c10::DeviceType device, c10::ScalarType dtype) | |
| Enable autocast with specified device and dtype. | |
| ~AutocastScope () | |
| Restore previous autocast state. | |
| AutocastScope (const AutocastScope &)=delete | |
| AutocastScope & | operator= (const AutocastScope &)=delete |
| AutocastScope (AutocastScope &&)=delete | |
| AutocastScope & | operator= (AutocastScope &&)=delete |
| ImFusion::TorchUtils::AutocastScope::AutocastScope | ( | c10::DeviceType | device, |
| c10::ScalarType | dtype ) |
Enable autocast with specified device and dtype.
| device | Target device (at::kCUDA, at::kCPU, at::kMPS) |
| dtype | Target dtype (at::kHalf for FP16, at::kBFloat16 for BF16) |