Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vadiklyutiy committed Dec 21, 2024
1 parent b8b7ae5 commit 8cba3a5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions python/hidet/graph/ops/quant/symmetric.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ def __init__(self, w: TensorNode, quant_type: DataType, dims: Union[int, List[in
if not isinstance(dims, (list, tuple)):
dims = [dims]

# bf16 can't hold int16.max_value. Should convert to f32 first.
# For another types pair is similar.
# bf16 can't hold int16.max_value. Should convert to f32 first.
# For another types pair is similar.
# For cases when float type can hold quant_type.max_value we can skip this step but leave it for simplicity
wm = compute(name='abs', shape=w.shape,
fcompute=lambda *indices: if_then_else(w[indices] >= 0, cast(w[indices], f32), cast(-w[indices], f32))
wm = compute(
name='abs',
shape=w.shape,
fcompute=lambda *indices: if_then_else(w[indices] >= 0, cast(w[indices], f32), cast(-w[indices], f32)),
)

scale = cops.reduce(wm, dims, keep_dim=False, reduce_type='max')
Expand Down

0 comments on commit 8cba3a5

Please sign in to comment.