(tensor, low_cpu_mem_usage)
| 174 | |
| 175 | @staticmethod |
| 176 | def _to_cpu(tensor, low_cpu_mem_usage): |
| 177 | # For TorchAO tensors, `.data` returns an incomplete wrapper without internal attributes |
| 178 | # (e.g. `.qdata`, `.scale`), so we must call `.cpu()` on the tensor directly. |
| 179 | t = tensor.cpu() if _is_torchao_tensor(tensor) else tensor.data.cpu() |
| 180 | return t if low_cpu_mem_usage else t.pin_memory() |
| 181 | |
| 182 | def _init_cpu_param_dict(self): |
| 183 | cpu_param_dict = {} |
no test coverage detected