PyTransformer icon indicating copy to clipboard operation
PyTransformer copied to clipboard

Cannot register customized Linear layer

Open llCurious opened this issue 4 years ago • 0 comments

Hey, i tried to run the demo code in transform_example.ipynb and no error occurred. However, when i add transformer.register(nn.Linear, QLinear), there is an error.

TypeError: empty() received an invalid combination of arguments - got (tuple, dtype=NoneType, device=NoneType), but expected one of:

  • (tuple of ints size, *, tuple of names names, torch.memory_format memory_format, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad)
  • (tuple of ints size, *, torch.memory_format memory_format, Tensor out, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad)`

And the error seems to result from the init function of Linear layer self.weight = Parameter(torch.empty((out_features, in_features), **factory_kwargs))

image

llCurious avatar Dec 16 '21 09:12 llCurious