max_pool3d#
- ivy.max_pool3d(x, kernel, strides, padding, /, *, data_format='NDHWC', dilation=1, ceil_mode=False, out=None)[source]#
Compute a 3-D max pool given 5-D input x.
- Parameters:
x (
Union
[Array
,NativeArray
]) – Input tensor [batch_size,d,h,w,d_in] if data_format is “NDHWC”.kernel (
Union
[int
,Tuple
[int
,...
]]) – Convolution filters [d,h,w].strides (
Union
[int
,Tuple
[int
,...
]]) – The stride of the sliding window for each dimension of input.padding (
Union
[str
,int
,Tuple
[int
],List
[Tuple
[int
,int
]]]) – “SAME” or “VALID” indicating the algorithm; int, or list of tuple indicating the per-dimension paddings. (e.g. 2, [(1, 0), (0, 1), (1, 1)])data_format (
str
, default:'NDHWC'
) – “NDHWC” or “NCDHW”. Defaults to “NDHWC”.dilation (
Union
[int
,Tuple
[int
,...
]], default:1
) – The stride between elements within a sliding window, must be > 0.ceil_mode (
bool
, default:False
) – If True, ceil is used instead of floor to compute the output shape. This ensures that every element in ‘x’ is covered by a sliding window.out (
Optional
[Array
], default:None
) – optional output array, for writing the result to. It must have a shape that the 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.max_pool3d(x, 2, 2, 'VALID')) ivy.array([[[[[14., 15.]]]],
[[[[38., 39.]]]]])
>>> print(ivy.max_pool3d(x, 2, 2, 'SAME')) ivy.array([[[[[14., 15.]]],
[[[22., 23.]]]],
[[[[38., 39.]]],
[[[46., 47.]]]]])
- Array.max_pool3d(self, kernel, strides, padding, /, *, data_format='NDHWC', dilation=1, ceil_mode=False, out=None)[source]#
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
,...
]]) – Convolution filters [d,h,w].strides (
Union
[int
,Tuple
[int
,...
]]) – The stride of the sliding window for each dimension of input.padding (
Union
[str
,int
,Tuple
[int
],List
[Tuple
[int
,int
]]]) – “SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
str
, default:'NDHWC'
) – NDHWC” or “NCDHW”. Defaults to “NDHWC”.dilaton – The stride between elements within a sliding window, must be > 0.
ceil_mode (
bool
, default:False
) – If True, ceil is used instead of floor to compute the output shape. This ensures that every element is covered by a sliding window.out (
Optional
[Array
], default:None
) – optional output array, for writing the result to. It must have 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.max_pool3d(2, 2, 'VALID')) ivy.array([[[[[14., 15.]]]], [[[[38., 39.]]]]]) >>> print(x.max_pool3d(2, 2, 'SAME')) ivy.array([[[[[14., 15.]]], [[[22., 23.]]]], [[[[38., 39.]]], [[[46., 47.]]]]])
- Container.max_pool3d(self, kernel, strides, padding, /, *, data_format='NDHWC', dilation=1, ceil_mode=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container static method variant of ivy.max_pool3d. This method simply wraps the function, and so the docstring for ivy.max_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
,...
],Container
]) – Convolution filters [d,h,w].strides (
Union
[int
,Tuple
[int
,...
],Container
]) – The stride of the sliding window for each dimension of input.padding (
Union
[str
,int
,Tuple
[int
],List
[Tuple
[int
,int
]],Container
]) – SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.data_format (
Union
[str
,Container
], default:'NDHWC'
) – “NDHWC” or “NCDHW”. Defaults to “NDHWC”.dilaton – The stride between elements within a sliding window, must be > 0.
ceil_mode (
Union
[bool
,Container
], default:False
) – If True, ceil is used instead of floor to compute the output shape. This ensures that every element is covered by a sliding window.out (
Optional
[Container
], default:None
) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – The result of the pooling operation.
Examples
>>> a = ivy.arange(24.).reshape((1, 2, 3, 4, 1)) >>> b = ivy.arange(48.).reshape((2, 4, 3, 2, 1)) >>> x = ivy.Container(a=a, b=b) >>> print(x.max_pool3d(3, 1, "VALID")) { a: ivy.array([], shape=(1, 0, 1, 2, 1)), b: ivy.array([], shape=(2, 2, 1, 0, 1)) }