• Flattens the input. Does not affect the batch size.

    A Flatten layer flattens each batch in its inputs to 1D (making the output 2D).

    For example:

    const input = tf.input({shape: [4, 3]});
    const flattenLayer = tf.layers.flatten();
    // Inspect the inferred output shape of the flatten layer, which
    // equals `[null, 12]`. The 2nd dimension is 4 * 3, i.e., the result of the
    // flattening. (The 1st dimension is the undermined batch size.)
    console.log(JSON.stringify(flattenLayer.apply(input).shape));

    Parameters

    • Optional args: FlattenLayerArgs

    Returns Flatten

    Doc

Generated using TypeDoc