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

Method __init__

python/oneflow/nn/modules/pooling.py:439–456  ·  view source on GitHub ↗
(
        self,
        kernel_size: _size_2_t,
        stride: Optional[_size_2_t] = None,
        padding: _size_2_t = 0,
        ceil_mode: bool = False,
        count_include_pad: bool = True,
    )

Source from the content-addressed store, hash-verified

437 """
438
439 def __init__(
440 self,
441 kernel_size: _size_2_t,
442 stride: Optional[_size_2_t] = None,
443 padding: _size_2_t = 0,
444 ceil_mode: bool = False,
445 count_include_pad: bool = True,
446 ):
447 super().__init__()
448 self.kernel_size = _single(kernel_size)
449 data_format = "NCHW" # only support "NCHW" for now !
450 self.channel_pos = (
451 "channels_first" if data_format == "NCHW" else "channels_last"
452 )
453 self.stride = _single(stride) if (stride is not None) else _single(kernel_size)
454 self.ceil_mode = ceil_mode
455 self.count_include_pad = count_include_pad
456 self.padding = _single(padding)
457
458 def forward(self, x):
459 return flow._C.avg_pool1d(

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected