fix(quant_ops): add detach, clone, and requires_grad_ to mock QuantizedTensor

Signed-off-by: Macpaul Lin <macpaul@gmail.com>
This commit is contained in:
Macpaul Lin 2026-01-08 22:47:42 +08:00
parent 406dab2d53
commit 77a46c68ea

View File

@ -71,6 +71,16 @@ except ImportError as e:
return type(self)(new_qdata, self._layout_type, new_params)
def detach(self):
return type(self)(self._qdata.detach(), self._layout_type, self._layout_params.copy())
def clone(self):
return type(self)(self._qdata.clone(), self._layout_type, self._layout_params.copy())
def requires_grad_(self, requires_grad=True):
self._qdata.requires_grad_(requires_grad)
return self
def __getattr__(self, name):
if name == "params":
return self._layout_params