Clone a QuantizedTensor by cloning its internal tensors.
(qt)
| 768 | return result |
| 769 | |
| 770 | def clone_quantized_tensor(qt): |
| 771 | """Clone a QuantizedTensor by cloning its internal tensors.""" |
| 772 | return QuantizedTensor( |
| 773 | values=qt.values.clone(), |
| 774 | scale_factors=qt.scale_factors.clone(), |
| 775 | amax=qt.amax.clone() if qt.amax is not None else None, |
| 776 | dtype=qt.dtype, |
| 777 | original_shape=qt.original_shape, |
| 778 | scale_rule=qt.scale_rule, |
| 779 | padded_shape=qt.padded_shape, |
| 780 | ) |
| 781 | |
| 782 | |
| 783 | def copy_quantized_into(slot: QuantizedTensor, src: QuantizedTensor) -> None: |
no test coverage detected