intel-extension-for-pytorch icon indicating copy to clipboard operation
intel-extension-for-pytorch copied to clipboard

Test script "test_weight_prepack.py" has errors. PR to resolve them.

Open abhilash1910 opened this issue 2 years ago • 3 comments

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 image

In this case strides[w]!=dim[c] for NWC although it should have been (hence assertTrue fails).

@EikanWang

abhilash1910 avatar May 31 '22 11:05 abhilash1910

@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?

EikanWang avatar May 31 '22 13:05 EikanWang

@XiaobingSuper, have you encountered this issue?

EikanWang avatar May 31 '22 13:05 EikanWang

@EikanWang Thanks for the information. I used the setup.py to install the dependencies and then ran the test script.

abhilash1910 avatar May 31 '22 14:05 abhilash1910