Skip to content

Cannot register customized Linear layer #4

Description

@llCurious

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions