Skip to content

Add Support for ConvTranspose Layers (1D and 2D)

Created by: Jonathan-Shoemaker

Description

This adds support for ConvTranspose layers. Specifically, it adds support for both io_stream and io_parallel compilation of Conv1DTranspose and Conv2DTranspose (as of now, only converted from keras).

The strategy roughly follows that of non-transposed convolution layers. We treat a conv transpose as a group of stride_width by stride_height convolutions, with their outputs interlaced. Thus, we essentially do a normal conv implementation where each kernel produces stride_width * stride_height outputs. Perhaps the most unintuitive part of how things are currently set up is that the weight matrix is transformed substantially (in the python code). This is done to split up the kernel into what amounts to the stride_width * stride_height smaller kernels.

The draft PR depends on PR #600 due to use of that PR's new implementation of io_parallel conv layers. Thus, all of the changes from that PR are currently included in this draft (will change once it is merged).

As of now, it seems both parallel and stream 1D implementations are working well, with performance matching that of the non-transposed layers. There are slight latency increases in the 2D implementations that may need to be worked out (namely the writing of data in both cases is a bit slow - in parallel it seems to have trouble writing to the output in the order the implementation wants to and in stream there are often multiple writes that get queued up which causes the implementation to take extra cycles).

Type of change

  • New feature (non-breaking change which adds functionality)

Tests

Still have to add tests to this PR.

Test Configuration:

Testing was done by compiling models consisting of single ConvTranspose layers, and comparing the performance of those layers to analogous Conv layers (i.e. a layer that maps the conv transpose output to its input).

Checklist

  • I have read the guidelines for contributing.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.

Merge request reports

Loading