Skip to content

Commit 37db213

Browse files
authored
[QNNParam] Refactor the implmentation of QNNParam (#11011)
* The patch is to simplify the implmentation of QNNParam and make it more friendly to Python 2.x. * Empty-Commit * fix error about boolean value of Tensor with more than one value is ambiguous.
1 parent 8bfe3bb commit 37db213

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

python/tvm/relay/frontend/qnn_torch.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,12 @@
2828
from .pytorch_utils import is_version_greater_than, getattr_attr_name
2929

3030

31-
class QNNParam:
31+
class QNNParam(object):
3232
"""A placeholder for weight quantization parameters"""
3333

3434
def __init__(self, weight, bias, scale, zero_point):
3535
self.weight = weight
36-
37-
if bias is not None:
38-
self.bias = bias.detach().numpy()
39-
else:
40-
self.bias = None
41-
36+
self.bias = None if bias is None else bias.detach().numpy()
4237
self.scale = _expr.const(scale)
4338
self.zero_point = _expr.const(zero_point, dtype="int32")
4439

0 commit comments

Comments
 (0)