Skip to content

hadamard_transform_cuda seems incorrect #5

Description

@hengruizhang98

Hi, I've tried your repo and find that using the same input data, hadamard_transform_cuda and hadamard_transform_torch would have different outputs.

Here is an example:

batch_size = 10
n = 64
device = 'cuda:0'
u = torch.eye(n, requires_grad = True, device = device)
u2 = u.to('cpu')
result_cuda = hadamard_transform_cuda(u)
result_torch = hadamard_transform_torch(u2)

Then the output of cuda is:
tensor([[1., 0., 0., ..., 0., 0., 0.],
[0., 1., 0., ..., 0., 0., 0.],
[0., 0., 1., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 1., 0., 0.],
[0., 0., 0., ..., 0., 1., 0.],
[0., 0., 0., ..., 0., 0., 1.]])

However, that of torch is:
tensor([[ 1., 1., 1., ..., 1., 1., 1.],
[ 1., -1., 1., ..., -1., 1., -1.],
[ 1., 1., -1., ..., 1., -1., -1.],
...,
[ 1., -1., 1., ..., -1., 1., -1.],
[ 1., 1., -1., ..., 1., -1., -1.],
[ 1., -1., -1., ..., -1., -1., 1.]])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions