---
title: "conv(weight:strides:bias:padding:dilations:groupCount:)"
framework: accelerate
role: symbol
role_heading: Instance Method
path: "accelerate/bnnsgraph/builder/tensor/conv(weight:strides:bias:padding:dilations:groupcount:)"
---

# conv(weight:strides:bias:padding:dilations:groupCount:)

Adds a convolution operation to the current graph.

## Declaration

```swift
func conv(weight: some BNNSGraph.Builder.OperationParameter<T>, strides: [Int], bias: some BNNSGraph.Builder.OperationParameter<T>, padding: BNNSGraph.Builder.ConvolutionPadding, dilations: [Int]? = nil, groupCount: Int = 1) -> BNNSGraph.Builder.Tensor<T>
```

## Parameters

- `weight`: The convolution weights.
- `strides`: An array that contains the kernel stride for each spatial dimension.
- `bias`: The bias.
- `padding`: An enumeration that specifies that the operation computes the padding from the input and output shapes. If you specify custom, pass twice the number of spatial dimensions.
- `dilations`: An array that contains the kernel dilation for each spatial dimension.
- `groupCount`: The number of convolution groups. Pass 1 to specify non-grouped convolution.

## Discussion

Discussion This operation assumes the source tensor is in  (N, C, spatial dimensions...) format, where the number of spatial dimensions is either 1 or 2.
