Fix RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead.

pull/812/head
danil328 4 years ago
parent b1d570b0ad
commit 93b27d69e7

@ -17,7 +17,7 @@ def get_padding(kernel_size: int, stride: int = 1, dilation: int = 1, **_) -> in
# Calculate asymmetric TensorFlow-like 'SAME' padding for a convolution
def get_same_padding(x: int, k: int, s: int, d: int):
return max((math.ceil(torch.true_divide(c / s)) - 1) * s + (k - 1) * d + 1 - x, 0)
return max((math.ceil(torch.true_divide(c, s)) - 1) * s + (k - 1) * d + 1 - x, 0)
# Can SAME padding for given args be done statically?

Loading…
Cancel
Save