def avg_pool( data_batch, # type: Node window_shape, # type: TensorShape window_strides=None, # type: List[int] padding_below=None, # type: TensorShape padding_above=None, # type: TensorShape include_padding=False, # type: bool name=None, # type: str ): # type: (...) -> Node """Return average pooling node. :param data_batch: The input node providing data. :param window_shape: The pooling window shape. :param window_strides: The window movement strides. :param padding_below: The input data optional padding below filled with zeros. :param padding_above: The input data optional padding below filled with zeros. :param include_padding: Whether or not to include zero padding in average computations. :param name: Optional name for the new output node. :return: New node with AvgPool operation applied on its data. """ spatial_dim_count = len(window_shape) if window_strides is None: window_strides = [1] * spatial_dim_count if padding_above is None: padding_above = [0] * spatial_dim_count if padding_below is None: padding_below = [0] * spatial_dim_count return AvgPool(data_batch, Shape(window_shape), Strides(window_strides), Shape(padding_below), Shape(padding_above), include_padding)
def avg_pool(x, # type: Node window_shape, # type: TensorShape strides=None, # type: List[int] padding_above=None, # type: List[int] padding_below=None, # type: List[int] zero_pad=True, # type: bool name=None, # type: str ): # type: (...) -> Node """Return average pooling node.""" if strides is None: strides = [1] * len(window_shape) # Default to as many 1s as spatial dimensions of input. if padding_above is None: padding_above = [0] * len(window_shape) if padding_below is None: padding_below = [0] * len(window_shape) return AvgPool(x, Shape(window_shape), Strides(strides), Shape(padding_above), Shape(padding_below), zero_pad)