MCPcopy Create free account
hub / github.com/QWTforGithub/T2LDM / get_same_padding

Function get_same_padding

timm/models/layers/padding.py:18–19  ·  view source on GitHub ↗
(x: int, k: int, s: int, d: int)

Source from the content-addressed store, hash-verified

16
17# Calculate asymmetric TensorFlow-like 'SAME' padding for a convolution
18def get_same_padding(x: int, k: int, s: int, d: int):
19 return max((math.ceil(x / s) - 1) * s + (k - 1) * d + 1 - x, 0)
20
21
22# Can SAME padding for given args be done statically?

Callers 1

pad_sameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected