MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / calc_pool_padding

Function calc_pool_padding

python/oneflow/nn/modules/pooling.py:150–161  ·  view source on GitHub ↗
(padding, dhw_offset, ndims)

Source from the content-addressed store, hash-verified

148
149
150def calc_pool_padding(padding, dhw_offset, ndims):
151 if isinstance(padding, str):
152 padding = "SAME_LOWER" if padding.upper() == "SAME" else padding
153 assert padding.upper() in ["VALID", "SAME_LOWER", "SAME_UPPER"]
154 padding_type = padding.lower()
155 ndim_pads_list = [[0, 0]] * ndims
156 elif isinstance(padding, (list, tuple)):
157 padding_type = "customized"
158 ndim_pads_list = get_ndim_pads_list(padding, dhw_offset, ndims)
159 else:
160 raise ValueError("padding must be str or a list.")
161 return (padding_type, ndim_pads_list)
162
163
164class MaxPool2d(Module):

Callers

nothing calls this directly

Calls 3

get_ndim_pads_listFunction · 0.85
upperMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected