Skip to content

Silent incorrect result for addmm for noncontiguous input #104439

@tugsbayasgalan

Description

@tugsbayasgalan

🐛 Describe the bug

import torch

def f_non_contiguous(x, y, z):
    z_t = torch.ops.aten.t.default(z)
    return torch.ops.aten.addmm.default(x, y, z_t)

def f_contiguous(x, y, z):
    z_t = torch.ops.aten.t_copy.default(z)
    return torch.ops.aten.addmm.default(x, y, z_t)

x = torch.randn(256)
y = torch.randn(6, 960)
z = torch.randn(256, 960)

contiguous_result = f_contiguous(x, y, z)
non_contiguous_result = f_non_contiguous(x, y, z)

print(contiguous_result.is_contiguous())  # prints True 
print(non_contiguous_result.is_contiguous()) # print True 

print(torch.allclose(contiguous_result, non_contiguous_result)) # prints False
print(torch.allclose(contiguous_result.contiguous(), non_contiguous_result.contiguous())) # prints False

Versions

latest main

cc @ezyang @gchanan @zou3519 @gujinghui @PenghuiCheng @XiaobingSuper @jianyuh @jgong5 @mingfeima @sanchitintel @ashokei @jingxu10 @min-jean-cho @yanbing-j @Guobing-Chen @Xia-Weiwen @frank-wei

Metadata

Metadata

Assignees

Labels

high prioritymodule: correctness (silent)issue that returns an incorrect result silentlymodule: intelSpecific to x86 architecturemodule: mkldnnRelated to Intel IDEEP or oneDNN (a.k.a. mkldnn) integrationtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions