avg_pool3d#
- ivy.avg_pool3d(x, kernel, strides, padding, /, *, data_format='NDHWC', count_include_pad=False, ceil_mode=False, divisor_override=None, out=None)[source]#
Compute a 3-D avg pool given 5-D input x.
- Parameters:
x (
Union
[Array
,NativeArray
]) – Input volume [batch_size,d,h,w,d_in].kernel (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – Convolution filters [d,h,w].strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – NDHWC” or “NCDHW”. Defaults to “NDHWC”. (default:'NDHWC'
)count_include_pad (
bool
) – Whether to include padding in the averaging calculation. (default:False
)ceil_mode (
bool
) – Whether to use ceil or floor for creating the output shape. (default:False
)divisor_override (
Optional
[int
]) – If specified, it will be used as divisor, otherwise kernel_size will be used. (default:None
)out (
Optional
[Array
]) – optional output array, for writing the result to. It must have a shape that the (default:None
) inputs broadcast to.
- Return type:
- Returns:
ret – The result of the pooling operation.
Both the description and the type hints above assumes an array input
for simplicity, but this function is *nestable, and therefore*
also accepts
ivy.Container
instances in place of any ofthe arguments.
Examples
>>> x = ivy.arange(48.).reshape((2, 3, 2, 2, 2)) >>> print(ivy.avg_pool3d(x,2,2,'VALID')) ivy.array([[[[[ 7., 8.]]]],
[[[[31., 32.]]]]])
>>> print(ivy.avg_pool3d(x,2,2,'SAME')) ivy.array([[[[[ 7., 8.]]],
[[[19., 20.]]]],
[[[[31., 32.]]],
[[[43., 44.]]]]])
- Array.avg_pool3d(self, kernel, strides, padding, /, *, data_format='NDHWC', count_include_pad=False, ceil_mode=False, divisor_override=None, out=None)#
Compute a 3-D max pool given 5-D input x.
- Parameters:
self (
Array
) – Input volume [batch_size,d,h,w,d_in].kernel (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – Convolution filters [d,h,w].strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – NDHWC” or “NCDHW”. Defaults to “NDHWC”. (default:'NDHWC'
)count_include_pad (
bool
) – Whether to include padding in the averaging calculation. (default:False
)ceil_mode (
bool
) – Whether to use ceil or floor for creating the output shape. (default:False
)divisor_override (
Optional
[int
]) – If specified, it will be used as divisor, (default:None
) otherwise kernel_size will be used.out (
Optional
[Array
]) – optional output array, for writing the result to. It must have (default:None
) a shape that the inputs broadcast to.
- Return type:
Array
- Returns:
ret – The result of the pooling operation.
Examples
>>> x = ivy.arange(48.).reshape((2, 3, 2, 2, 2)) >>> print(x.avg_pool3d(2, 2, 'VALID')) ivy.array([[[[[ 7., 8.]]]], [[[[31., 32.]]]]]) >>> print(x.avg_pool3d(2, 2, 'SAME')) ivy.array([[[[[ 7., 8.]]], [[[19., 20.]]]], [[[[31., 32.]]], [[[43., 44.]]]]])
- Container.avg_pool3d(self, kernel, strides, padding, /, *, data_format='NDHWC', count_include_pad=False, ceil_mode=False, divisor_override=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)#
ivy.Container static method variant of ivy.avg_pool3d. This method simply wraps the function, and so the docstring for ivy.avg_pool3d also applies to this method with minimal changes.
- Parameters:
x – Input volume [batch_size,d,h,w,d_in].
kernel (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – Convolution filters [d,h,w].strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
) – NDHWC” or “NCDHW”. Defaults to “NDHWC”. (default:'NDHWC'
)count_include_pad (
bool
) – Whether to include padding in the averaging calculation. (default:False
)ceil_mode (
bool
) – Whether to use ceil or floor for creating the output shape. (default:False
)divisor_override (
Optional
[int
]) – If specified, it will be used as the divisor, otherwise (default:None
)out (
Optional
[Container
]) – optional output array, for writing the result to. It must (default:None
) have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(12).reshape((1, 2, 1, 3, 2)) >>> b = ivy.arange(48).reshape((2, 2, 2, 3, 2)) >>> x = ivy.Container({'a': a, 'b': b}) >>> print(x.max_pool3d(2, 1, "VALID")) { a: ivy.array([], shape=(1, 1, 0, 2, 2)), b: ivy.array([[[[[20, 21], [22, 23]]]], [[[[44, 45], [46, 47]]]]]) }