Deconvolution

General Restrictions

If:

Ny, Cy, Hy, Wy [x1] = x.shape

Nk, Ck/group, Hk, Wk = filter.shape (k=kernel)

stride, stride_h, stride_w, pad, pad_h, pad_w:

if stride.size() == 0:
   stride_h, stride_w
elif stride.size() == 1:
   stride_h, stride_w = stride[0]
else:
   stride_h = stride[0]
   stride_w = stride[1]

if pad.size() == 0:
   pad_h, pad_w
elif pad.size() == 1:
   pad_h = pad_w = pad[0]
else:
   pad_h = pad[0]
   pad_w = pad[1]
if dilation.size() == 1:
   dilation_h = dilation_w = dilation[0]
else:
   dilation_h = dilation[0]
   dilation_w = dilation[1]

If the output shape is [Nx,Cx,Hx,Wx]:

  • Nx=Ny, Cx=Ck
  • Wx = (Wy-1)*stride_w - 2*pad_w + dilation_h*(Wk-1)+1
  • Hx = (Hy-1)*stride_h - 2*pad_h + dilation_w*(Hk-1)+1

The general restrictions are as follows:

  1. 1<=stride_h*stride_w<256
  2. Hy + 2 * pad_h >= dilation_h * (Hk – 1) + 1, Wy + 2 * pad_w >= dilation_w * (Wk – 1) + 1
  3. Hy * stride_h and Wy * stride_w must be in the range [2, 4096]:
    • When Hk==Wk==1:

      When Wy * stride_w * stride_h is in the range [2, 4096] and stride_h or stride_w is greater than 1, Wy is less than or equal to 2032.

    • Atlas Training Series Product: Hx! = Hk, Wx! = Wk, Hy or Wy can be 1.
    • When Hy=1, Hk=1, pad_h=0, stride_h=1, dilation_h=1, Wx is in the range [1, 2147483647] (representable by int32).
  4. AL1Size:

    If w_value = Wy * stride_w:

        if Wx>16:
            h_value_max = Hk + 1
        else if 16% Wx== 0: 
            h_value_max = Hk + 16//Wx - 1
        else: 
            h_value_max = Hk + 16//Wx +1

    AL1Size = h_value_max * w_value * 32 bytes, BL1Size = Hk * Wk * 512 bytes

    AL1Size + BL1Size ≤ l1_size (For details about l1_size, see the configuration file of the corresponding SoC, that is, platform_config/${soc_version}.ini.)

    Hy >= dilation * (Hk – 1) + 1, Wy >= dilation * (Wk – 1) + 1

    When Hy = 1, Hk = 1, pad_h = 0, stride_h = 1, dilation_h = 1, then, AL1Size = [15 * stride_w + (Wk – 1) * dilation_w + 1] * 32 bytes

Input

  • x:
    • Required: yes
    • Type: float16
    • Description: input tensor
    • Restrictions: none
  • filter:
    • Required: yes
    • Type: float16
    • Description: Convolution kernel with shape [Nk, Ck, Hk, Wk]. Nk must be equal to Cy.
    • Restriction:
      1. If Wx==Hx==1, then Wy==Hy==Wk==Hk, and the value range is 1–11.
      2. Output whose W==1 while H ≠ 1 is not supported.
      3. Wx or Hx ranges from 1 to 255 in other situations.
  • bias:
    • Required: no
    • Type: float16
    • Description: none
    • Restrictions: none

Attribute

  • pad:
    • Required: no
    • Type: ListInt
    • Description: padding size (default = 0). pad and pad_h/pad_w are mutually exclusive. pad is a list of length up to 2.
    • Restriction: When the length of the list is 1, pad < Hk and pad < Wk. When the length of the list is 2, pad[0] < Hk and pad[1] < Wk.
  • pad_h:
    • Required: no
    • Type: int
    • Description: padding size (default = 0). pad and pad_h/pad_w are mutually exclusive.
    • Restriction: pad_h < Hk
  • pad_w:
    • Required: no
    • Type: int
    • Description: padding size (default = 0). pad and pad_h/pad_w are mutually exclusive.
    • Restriction: pad_w < Wk
  • stride:
    • Required: no
    • Type: ListInt
    • Description: stride size (default = 1). stride and stride_h/stride_w are mutually exclusive. stride is a list of length up to 2.
    • Restriction: When the length of the list is 1, 0 <= stride * stride < 256. When the length of the list is 2, 1 <= stride[0] <= 63, 1 <= stride[1] <= 63, 1 <= stride[0] * stride[1] < 256.
  • stride_h:
    • Required: no
    • Type: int
    • Description: stride size (default = 1). stride and stride_h/stride_w are mutually exclusive.
    • Restriction: 1 <= stride <= 63
  • stride_w:
    • Required: no
    • Type: int
    • Description: stride size (default = 1). stride and stride_h/stride_w are mutually exclusive.
    • Restriction: 1 <= stride <= 63
  • dilation:
    • Required: no
    • Type: ListInt
    • Description: factor used to dilate the filter (default = 1). It is a list of length up to 2.
    • Restriction: Must be in the range [1, 255] and (kernel – 1) x dilation + 1 < 256.
  • group:
    • Required: no
    • Type: int
    • Description: none
    • Restriction: group is divisible by channel.

Output

y:
  • Required: yes
  • Type: float16
  • Description: none
  • Restrictions: none