Performs the average pooling on the input. Each entry in `output` is the mean of the corresponding size `ksize` window in `value`. Args: value: A 4-D `Tensor` of shape `[batch, height, width, channels]` and type `float32`, `float64`, `qint8`, `quint8`, or `qint32`. ksize: An in
(value, ksize, strides, padding, data_format="NHWC",
name=None, input=None)
| 3640 | |
| 3641 | @tf_export(v1=["nn.avg_pool", "nn.avg_pool2d"]) |
| 3642 | def avg_pool(value, ksize, strides, padding, data_format="NHWC", |
| 3643 | name=None, input=None): # pylint: disable=redefined-builtin |
| 3644 | """Performs the average pooling on the input. |
| 3645 | |
| 3646 | Each entry in `output` is the mean of the corresponding size `ksize` |
| 3647 | window in `value`. |
| 3648 | |
| 3649 | Args: |
| 3650 | value: A 4-D `Tensor` of shape `[batch, height, width, channels]` and type |
| 3651 | `float32`, `float64`, `qint8`, `quint8`, or `qint32`. |
| 3652 | ksize: An int or list of `ints` that has length `1`, `2` or `4`. The size of |
| 3653 | the window for each dimension of the input tensor. |
| 3654 | strides: An int or list of `ints` that has length `1`, `2` or `4`. The |
| 3655 | stride of the sliding window for each dimension of the input tensor. |
| 3656 | padding: A string, either `'VALID'` or `'SAME'`. The padding algorithm. |
| 3657 | See the "returns" section of `tf.nn.convolution` for details. |
| 3658 | data_format: A string. 'NHWC' and 'NCHW' are supported. |
| 3659 | name: Optional name for the operation. |
| 3660 | input: Alias for value. |
| 3661 | |
| 3662 | Returns: |
| 3663 | A `Tensor` with the same type as `value`. The average pooled output tensor. |
| 3664 | """ |
| 3665 | with ops.name_scope(name, "AvgPool", [value]) as name: |
| 3666 | value = deprecation.deprecated_argument_lookup( |
| 3667 | "input", input, "value", value) |
| 3668 | |
| 3669 | if data_format is None: |
| 3670 | data_format = "NHWC" |
| 3671 | channel_index = 1 if data_format.startswith("NC") else 3 |
| 3672 | |
| 3673 | ksize = _get_sequence(ksize, 2, channel_index, "ksize") |
| 3674 | strides = _get_sequence(strides, 2, channel_index, "strides") |
| 3675 | |
| 3676 | return gen_nn_ops.avg_pool( |
| 3677 | value, |
| 3678 | ksize=ksize, |
| 3679 | strides=strides, |
| 3680 | padding=padding, |
| 3681 | data_format=data_format, |
| 3682 | name=name) |
| 3683 | |
| 3684 | |
| 3685 | @tf_export("nn.avg_pool2d", v1=[]) |
nothing calls this directly
no test coverage detected