Skip to content

Commit 14ebb2c

Browse files
bwastifacebook-github-bot
authored andcommitted
Allow no-bias MKLDNN Linear call (#43703)
Summary: MKLDNN linear incorrectly assumes that bias is defined and will fail for no-bias calls. Pull Request resolved: #43703 Reviewed By: glaringlee Differential Revision: D23373182 Pulled By: bwasti fbshipit-source-id: 1e817674838a07d237c02eebe235c386cf5b191e
1 parent c88ac25 commit 14ebb2c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

aten/src/ATen/native/mkldnn/Linear.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ Tensor mkldnn_linear(
3232
"mkldnn_linear: input needs to has dim at least 2, input dim ", self.dim());
3333
TORCH_CHECK(self.is_mkldnn(),
3434
"mkldnn_linear: input needs to be mkldnn layout");
35-
TORCH_CHECK(weight.is_mkldnn() && bias.is_mkldnn(),
35+
TORCH_CHECK(
36+
weight.is_mkldnn() && (!bias.defined() || bias.is_mkldnn()),
3637
"mkldnn_linear: weight and bias need to be mkldnn layout");
3738

3839
// reshape first if input dim is greater than 2 and the reshape will cost a memory copy.

0 commit comments

Comments
 (0)