Performs the average pooling on the input. Each entry in `output` is the mean of the corresponding size `ksize` window in `value`. Args: input: A 4-D `Tensor` of shape `[batch, height, width, channels]` and type `float32`, `float64`, `qint8`, `quint8`, or `qint32`. ksize: An in
(input, ksize, strides, padding, data_format="NHWC", name=None)
| 3684 | |
| 3685 | @tf_export("nn.avg_pool2d", v1=[]) |
| 3686 | def avg_pool2d(input, ksize, strides, padding, data_format="NHWC", name=None): # pylint: disable=redefined-builtin |
| 3687 | """Performs the average pooling on the input. |
| 3688 | |
| 3689 | Each entry in `output` is the mean of the corresponding size `ksize` |
| 3690 | window in `value`. |
| 3691 | |
| 3692 | Args: |
| 3693 | input: A 4-D `Tensor` of shape `[batch, height, width, channels]` and type |
| 3694 | `float32`, `float64`, `qint8`, `quint8`, or `qint32`. |
| 3695 | ksize: An int or list of `ints` that has length `1`, `2` or `4`. The size of |
| 3696 | the window for each dimension of the input tensor. |
| 3697 | strides: An int or list of `ints` that has length `1`, `2` or `4`. The |
| 3698 | stride of the sliding window for each dimension of the input tensor. |
| 3699 | padding: A string, either `'VALID'` or `'SAME'`. The padding algorithm. |
| 3700 | See the "returns" section of `tf.nn.convolution` for details. |
| 3701 | data_format: A string. 'NHWC' and 'NCHW' are supported. |
| 3702 | name: Optional name for the operation. |
| 3703 | |
| 3704 | Returns: |
| 3705 | A `Tensor` with the same type as `value`. The average pooled output tensor. |
| 3706 | """ |
| 3707 | with ops.name_scope(name, "AvgPool2D", [input]) as name: |
| 3708 | if data_format is None: |
| 3709 | data_format = "NHWC" |
| 3710 | channel_index = 1 if data_format.startswith("NC") else 3 |
| 3711 | |
| 3712 | ksize = _get_sequence(ksize, 2, channel_index, "ksize") |
| 3713 | strides = _get_sequence(strides, 2, channel_index, "strides") |
| 3714 | |
| 3715 | return gen_nn_ops.avg_pool( |
| 3716 | input, |
| 3717 | ksize=ksize, |
| 3718 | strides=strides, |
| 3719 | padding=padding, |
| 3720 | data_format=data_format, |
| 3721 | name=name) |
| 3722 | |
| 3723 | |
| 3724 | @tf_export("nn.avg_pool1d") |
nothing calls this directly
no test coverage detected