[Fix] Fix the bug when input mask is not '0-1-tensor' in masked_conv ()

pull/2448/head
ckirchhoff 2022-11-22 22:57:42 +08:00 committed by GitHub
parent 6e3827d02b
commit 72ca0f30dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -58,6 +58,8 @@ class MaskedConv2dFunction(Function):
if mask.size()[1:] != output.size()[2:]:
raise ValueError(
'The mask is inconsistent with the shape of output_conv.')
mask = mask > 0
mask = mask.type(output.dtype)
output = output * mask
return output