# FullyConnected¶

Warning

This operator was deprecated in TensorRT 8.4; use the MatrixMultiply operator instead.

Computes a matrix-vector product between two input tensors and adds an optional bias tensor to produce an output tensor.

## Attributes¶

num_output_channels The number of output channels k from the fully connected layer.

W: weights of type T1

bias optional: bias of type T1

## Inputs¶

A: tensor of type T1

## Outputs¶

B: tensor of type T1

## Data Types¶

T1: float32

## Shape Information¶

n: the rank of A, $$n \geq 3$$

k: the number of the output channels

A is a tensor of shape $$[A_0,...,A_n]$$

W is a tensor of shape $$[k, A_{n-2} \cdot A_{n-1} \cdot A_n]$$

bias is a tensor of shape $$[k]$$

B is a tensor of shape $$[A_0,...,A_{n-3},k,1,1]$$

## Examples¶

FullyConnected
input_shape = [1, 3, 3, 3]
num_filter = 2
w = np.array([[1.0], [2.0]], np.float32)
w = np.tile(w, np.prod(input_shape, where=[False, True, True, True]))
network.mark_output(layer.get_output(0))

inputs[in1.name] = np.array([[[[-3.0, -2.0, -1.0], [10.0, -25.0, 0.0], [1.0, 2.0, -2.0]]]])

outputs[layer.get_output(0).name] = layer.get_output(0).shape
expected[layer.get_output(0).name] = np.array([[[[-20.0]], [[-40.0]]]])