Deconv3D¶
Warning
Documentation for the module is under development.
Description¶
This module performs the operation of 3-dimensional transposed convolution. For more detailed theoretical information about the transposed convolution operation, see DeconvND.
Initializing¶
def __init__(self, inmaps, outmaps, size, stride=1, pad=0, dilation=1, wscale=1.0, useBias=True, name=None,
initscheme=None, empty=False, groups=1):
Parameters
Parameter | Allowed types | Description | Default |
---|---|---|---|
inmaps | int | Number of maps in the input tensor | - |
outmaps | int | Number of maps in the output tensor | - |
size | int | Convolution kernel size (the kernel is always equilateral) | - |
stride | Union[int, tuple] | Convolution stride | 1 |
pad | Union[int, tuple] | Map padding | 0 |
dilation | Union[int, tuple] | Convolution window dilation | 1 |
wscale | float | Random layer weights variance | 1.0 |
useBias | bool | Specifies the layer weights initialization scheme | True |
initscheme | Union[tuple, str] | Specifies the layer weights initialization scheme (see createTensorWithScheme) | None -> ("xavier_uniform", "in") |
name | str | Layer name | None |
empty | bool | Whether to initialize the matrix of weights and biases | False |
groups | int | Number of groups the maps are split into for separate processing | 1 |
Explanations
-
Examples¶
Basic deconvolution example¶
Necessary imports
import numpy as np
from PuzzleLib.Backend import gpuarray
from PuzzleLib.Modules import Deconv3D
Info
gpuarray
is required to properly place the tensor in the GPU.
Synthetic tensor:
batchsize, inmaps, d, h, w = 1, 2, 5, 5, 5
outsize = 2
data = gpuarray.to_gpu(np.arange(batchsize * inmaps * d * h * w).reshape((batchsize, inmaps, d, h, w)).astype(np.float32))
deconv = Deconv3D(inmaps=inmaps, outmaps=outsize, size=2, useBias=False)
print(deconv(data))
Size parameter¶
deconv = Deconv3D(inmaps=inmaps, outmaps=outsize, size=3, useBias=False)
print(deconv(data))
Pad parameter¶
deconv = Deconv3D(inmaps=inmaps, outmaps=outsize, size=3, pad=1, useBias=False)
print(deconv(data))
Stride parameter¶
deconv = Deconv3D(inmaps=inmaps, outmaps=outsize, size=2, stride=2, useBias=False)
deconv(data)
deconv = Deconv3D(inmaps=inmaps, outmaps=outsize, size=2, stride=2, pad=3, useBias=False)
print(deconv(data))
deconv = Deconv3D(inmaps=inmaps, outmaps=outsize, size=2, stride=(2, 4, 2), pad=3, useBias=False)
print(deconv(data))
Параметр dilation¶
deconv = Deconv3D(inmaps=inmaps, outmaps=outsize, size=2, stride=1, pad=0, dilation=2, useBias=False)
print(deconv(data))
deconv = Deconv3D(inmaps=inmaps, outmaps=outsize, size=2, stride=1, pad=0, dilation=(3, 1, 3), useBias=False)
print(deconv(data))
Groups parameter¶
deconv = Deconv3D(inmaps=inmaps, outmaps=outsize, size=2, groups=2, useBias=False)
print(deconv(data))