Skip to content

Flatten

Flatten is a standard image processing layer applied in most convolutional neural networks. The Flatten layer has no learnable parameters. it simply applies an opperation to the data that passes through it.

Bases: Module

Flattens Tensors of tensors of any shape into a one dimensional vector

Shapes

Input:
    (N, ...)

Output:
    (N, -1)

Implementation

import neuraltoolkit as ntk

x = ntk.Tensor([
    [1, 2],
    [3, 4]
])

layer = ntk.Flatten()
y = layer(x) # -> [1, 2, 3, 4]