conv3d_transpose#
- ivy.conv3d_transpose(x, filters, strides, padding, /, *, output_shape=None, filter_format='channel_last', data_format='NDHWC', dilations=1, bias=None, out=None)[source]#
Compute a 3-D transpose convolution given 5-D input x and filters arrays.
- Parameters:
x (
Union
[Array
,NativeArray
]) – Input volume [batch_size,d,h,w,d_in] or [batch_size,d_in,d,h,w].filters (
Union
[Array
,NativeArray
]) – Convolution filters [fd,fh,fw,d_out,d_in].strides (
Union
[int
,Tuple
[int
,int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
str
) – Either ‘SAME’ (padding so that the output’s shape is the same as the input’s), or ‘VALID’ (padding so that the output’s shape is output_shape).output_shape (
Optional
[Union
[Shape
,NativeShape
]], default:None
) – Shape of the output (Default value = None)filter_format (
str
, default:'channel_last'
) – Either “channel_first” or “channel_last”. “channel_first” corresponds to “IODHW”,input data formats, while “channel_last” corresponds to “DHWOI”.data_format (
str
, default:'NDHWC'
) – The ordering of the dimensions in the input, one of “NDHWC” or “NCDHW”. “NDHWC” corresponds to inputs with shape (batch_size, depth, height, width, channels), while “NCDHW” corresponds to input with shape (batch_size, channels, depth, height, width).dilations (
Union
[int
,Tuple
[int
,int
,int
]], default:1
) – The dilation factor for each dimension of input. (Default value = 1)bias (
Optional
[Array
], default:None
) – Bias array of shape [d_out]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 transpose convolution operation.
Examples
With
ivy.Array
input:>>> x = ivy.random_normal(mean=0, std=1, shape=[1, 3, 28, 28, 3]) >>> filters = ivy.random_normal(mean=0, std=1, shape=[3, 3, 3, 6, 3]) >>> y = ivy.conv3d_transpose(x, filters, [2, 2, 2], 'SAME') >>> print(y.shape) ivy.Shape(1, 6, 56, 56, 6)
>>> x = ivy.random_normal(mean=0, std=1, shape=[1, 3, 64, 64, 3]) >>> filters = ivy.random_normal(mean=0, std=1, shape=[3, 3, 3, 6, 3]) >>> y = ivy.conv3d_transpose(x, filters, [2, 2, 2], 'VALID', dilations=[1, 1, 1]) >>> print(y.shape) ivy.Shape(1, 7, 129, 129, 6)
With
ivy.Container
inputs:>>> a = ivy.random_normal(mean=0, std=1, shape=[1, 3, 14, 14, 3]) >>> b = ivy.random_normal(mean=0, std=1, shape=[1, 3, 28, 28, 3]) >>> c = ivy.random_normal(mean=0, std=1, shape=[6, 3, 3, 3, 3]) >>> d = ivy.random_normal(mean=0, std=1, shape=[6, 3, 3, 3, 3]) >>> x = ivy.Container(a=a, b=b) >>> filters = ivy.Container(c=c, d=d) >>> y = ivy.conv3d_transpose(x, filters, [2, 2, 2], 'SAME') >>> print(y.shape) { a: { c: ivy.Shape(1, 6, 28, 28, 3), d: ivy.Shape(1, 6, 28, 28, 3) }, b: { c: ivy.Shape(1, 6, 56, 56, 3), d: ivy.Shape(1, 6, 56, 56, 3) }, c: { c: ivy.Shape(6, 6, 6, 6, 3), d: ivy.Shape(6, 6, 6, 6, 3) }, d: { c: ivy.Shape(6, 6, 6, 6, 3), d: ivy.Shape(6, 6, 6, 6, 3) } }
With a mix of
ivy.Array
andivy.Container
inputs:>>> x = ivy.full((1, 6, 6, 6, 1), 2.7) >>> a = ivy.random_normal(mean=0, std=1, shape=[3, 3, 3, 1, 1]) >>> b = ivy.random_normal(mean=0, std=1, shape=[3, 3, 3, 1, 1]) >>> filters = ivy.Container(a=a, b=b) >>> y = ivy.conv3d_transpose(x, filters, [1, 1, 1], 'VALID', dilations=[1, 1, 1]) >>> print(y.shape) { a: ivy.Shape(1, 8, 8, 8, 1), b: ivy.Shape(1, 8, 8, 8, 1) }
>>> x = ivy.full((1, 6, 6, 6, 1), 1.23) >>> a = ivy.array(ivy.random_normal(mean=0, std=1, shape=[3, 3, 3, 1, 1])) >>> b = ivy.array(ivy.random_normal(mean=0, std=1, shape=[3, 3, 3, 1, 1])) >>> filters = ivy.Container(a=a, b=b) >>> y = ivy.conv3d_transpose(x, filters, [1, 1, 1], 'VALID', dilations=[1, 1, 1]) >>> print(y.shape) { a: ivy.Shape(1, 8, 8, 8, 1), b: ivy.Shape(1, 8, 8, 8, 1) }
- Array.conv3d_transpose(self, filters, strides, padding, /, *, output_shape=None, filter_format='channel_last', data_format='NDHWC', dilations=1, bias=None, out=None)[source]#
ivy.Array instance method variant of ivy.conv3d_transpose. This method simply wraps the function, and so the docstring for ivy.conv3d_transpose also applies to this method with minimal changes.
- Parameters:
self (
Array
) – Input volume [batch_size,d,h,w,d_in] or [batch_size,d_in,d,h,w].filters (
Union
[Array
,NativeArray
]) – Convolution filters [fd,fh,fw,d_out,d_in].strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
],Tuple
[int
,int
,int
]]) – The stride of the sliding window for each dimension of input.padding (
Union
[str
,List
[int
]]) – “SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.output_shape (
Optional
[Union
[Shape
,NativeShape
]], default:None
) – Shape of the output (Default value = None)filter_format (
str
, default:'channel_last'
) – Either “channel_first” or “channel_last”. “channel_first” corresponds to “IODHW”,input data formats, while “channel_last” corresponds to “DHWOI”.data_format (
str
, default:'NDHWC'
) –The ordering of the dimensions in the input, one of “NDHWC” or “NCDHW”. “NDHWC” corresponds to inputs with shape (batch_size,
depth, height, width, channels), while “NCDHW” corresponds to input with shape (batch_size, channels, depth, height, width).
dilations (
Union
[int
,Tuple
[int
],Tuple
[int
,int
],Tuple
[int
,int
,int
]], default:1
) – The dilation factor for each dimension of input. (Default value = 1)bias (
Optional
[Array
], default:None
) – Bias array of shape [d_out].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 transpose convolution operation.
Examples
>>> x = ivy.random_normal(mean=0, std=1, shape=[1, 3, 28, 28, 3]) >>> filters = ivy.random_normal(mean=0, std=1, shape=[3, 3, 3, 6, 3]) >>> y = x.conv3d_transpose(filters, 2, 'SAME') >>> print(y.shape) (1, 6, 56, 56, 6)
- Container.conv3d_transpose(self, filters, strides, padding, /, *, output_shape=None, filter_format='channel_last', data_format='NDHWC', dilations=1, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, bias=None, out=None)[source]#
ivy.Container instance method variant of ivy.conv3d_transpose. This method simply wraps the function, and so the docstring for ivy.conv3d_transpose also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Input container with leaves of volume [batch_size,d,h,w,d_in] or [batch_size,d_in,d,h,w].filters (
Union
[Array
,NativeArray
,Container
]) – Convolution filters [fd,fh,fw,d_out,d_in].strides (
Union
[int
,Tuple
[int
],Tuple
[int
,int
],Tuple
[int
,int
,int
],Container
]) – The stride of the sliding window for each dimension of input.padding (
Union
[str
,List
[int
],Container
]) – “SAME” or “VALID” indicating the algorithm, or list indicating the per-dimension paddings.output_shape (
Optional
[Union
[Array
,NativeArray
,Container
]], default:None
) – Shape of the output (Default value = None)filter_format (
str
, default:'channel_last'
) – Either “channel_first” or “channel_last”. “channel_first” corresponds to “IODHW”,input data formats, while “channel_last” corresponds to “DHWOI”.data_format (
str
, default:'NDHWC'
) –The ordering of the dimensions in the input, one of “NDHWC” or “NCDHW”. “NDHWC” corresponds to inputs with shape (batch_size,
depth, height, width, channels), while “NCDHW” corresponds to input with shape (batch_size, channels, depth, height, width).
dilations (
Union
[int
,Tuple
[int
],Tuple
[int
,int
],Tuple
[int
,int
,int
]], default:1
) – The dilation factor for each dimension of input. (Default value = 1)bias (
Optional
[Container
], default:None
) – Bias array of shape [d_out].out (
Optional
[Container
], default:None
) – optional output container, for writing the result to. It must have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – The result of the transpose convolution operation in a container.
Examples
>>> x = ivy.Container(a = ivy.ones((1, 3, 3, 3, 1)).astype(ivy.float32) ) >>> filters = ivy.ones((3, 3, 3, 1, 1)).astype(ivy.float32) >>> result = x.conv3d(filters, 2, 'SAME') >>> print(result) { a: ivy.array([[[[[8.], [8.]], [[8.], [8.]]], [[[8.], [8.]], [[8.], [8.]]]]]) }