-
Notifications
You must be signed in to change notification settings - Fork 25
Description
While there is still a Conv2d op in the TTIR dialect, that is meant to model a channel-last, 2 dimensional convolution only. I've added a new ConvolutionOp that can represent a convolution of a number of spatial dimensions and even deconvolution (convTranspose). Because of this its attributes are quite numbered. Here's how you will need to lower tt-forge's Conv2d into ttir::ConvolutionOp:
Pass the input activation as the first operand, weight as the second, and bias as the third (if there is a bias).
The groups attribute is now called feature_groups_count
The strides attribute is called window_strides
You’ll need to create a ConvolutionLayoutAttr to describe the layout of the input, weight, and kernel
- inputBatchDimension is the index of the batch dimension, this should pretty much always be 0 though unless you have a really weird convolution
- InputFeatureDimension is the index of the channel dimension, 1 for channel first convolution and 3 for channel last. It could be some other index but again that would represent a very weird convolution
- InputSpatialDimensions, a list containing the indices of the spatial dimensions from most to least significant. For conv2d there will be two (height and width). For channel first conv2d the value should be [2, 3]. For channel last it should be [1, 2]. Again, it could be other values but that would represent a very weird convolution
- KernelOutputFeatures, for a kernel in OIHW (typically this is the format for a channel first convolution) it would be 0. For a kernel in HWIO (typically channel last), this would be 3
- KernelInputFeatures, 1 or 2 depending if it’s OIHW or HWIO
- KernelSpatialDimensions, [2, 3] for OIHW and [0, 1] for HWIO
- The output layout has features identical to the input ones. They should typically be identical and certainly will be when coming from forge. So just write the same thing you did for the input layout attributes
Padding will be a list that contains two integers for each spatial dimension starting from the most significant dimension. For conv2d it’s [top, bottom, left, right]
I think that’s it. There are other attributes you shouldn’t have to worry about entering, they have default values
If there are decompositions already in tt-forge that do anything like inserting transposes to make the input/output channel last, you can get rid of that it'll be done in MLIR now. Although we do not have erase inverse ops yet.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status