intel-extension-for-pytorch
intel-extension-for-pytorch copied to clipboard
Test script "test_weight_prepack.py" has errors. PR to resolve them.
The script at "test_weight_prepack.py" has some errors as follows:
- ipex.optimize has no attribute as 'sample_input' :
ipex.optimize(origin_model1, dtype=dtype, optimizer=origin_optimizer1, level='O1', sample_input=x)
- Issues with 3d torch tensor for NWC format as "is_channels_last" method does not assert to True for 3d tensor. The method seems correct as strides[w]=dim[c] ; however for some test cases, the channel last check fails. A check is placed to ensure that "is_channels_last" is True before asserting:
if self._is_channels_last_nwc(y_ipex): self.assertTrue(self._is_channels_last_nwc(y_ipex))
A sample test result for the NWC format is attached as a screenshot
In this case strides[w]!=dim[c] for NWC although it should have been (hence assertTrue fails).
@EikanWang
@abhilash1910 , the sample_input
is used to query the optimal memory layout for performance. And IPEX has exposed this API. @zhuhaozhe , could you please check the root cause?
@XiaobingSuper, have you encountered this issue?
@EikanWang Thanks for the information. I used the setup.py to install the dependencies and then ran the test script.