Skip to content

Commit

Permalink
Fix failing conversion unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
etrommer committed Jan 23, 2024
1 parent 6fa5990 commit 69928e3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/test_approx_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ def test_instantiate():
tal.ApproxLayer()


def test_compile(device, lut):
# Disabled as compilation is currently not used
# since it interferes with QAT by fixing the otherwise adjustable quantization parameters during compilation
@pytest.mark.xfail
def test_compile(device):
layer = torch.nn.Linear(42, 23)
w = tal.ApproxWrapper(layer)
x = torch.rand(128, 42).requires_grad_()
quant.prepare_qat(w, {torch.nn.Linear: tal.ApproxLinear}, inplace=True)

w.wrapped.lut = lut
w.wrapped.inference_mode = tal.InferenceMode.APPROXIMATE
w_comp = torch.compile(w)
w_comp(x)
Expand All @@ -39,8 +41,8 @@ def __init__(self):
self.linear = torch.nn.Linear(20, 10)

mn = MiniNet()
utils.wrap_quantizable(mn)
utils.wrap_quantizable(mn)
utils.wrap_quantizable(mn, qconfig=qconfigs[0][0])
utils.wrap_quantizable(mn, qconfig=qconfigs[0][0])
quant.prepare_qat(mn, tal.layer_mapping_dict(), inplace=True)

assert isinstance(mn.conv.wrapped, tal.ApproxConv2d)
Expand Down

0 comments on commit 69928e3

Please sign in to comment.