# Layers

A layer performs complex mathematical computations to extract features from input data. It then outputs the transformed data and passes them to the next layer in the network.

Layers encapsulate weights, or states, which are actively tracked and continuously updated during model training.&#x20;

## Add a Layer

Layers are added to a network after the [**Dataset Block**](/user-interface/project/network/network-mapping/create-a-mapping-deprecated/input-node.md) has been set up.

To add a layer to your network:

1. On the **Network** view, right-click anywhere to open a menu, from which you can select the type of layer to be added to your projec&#x74;**.**
2. Click the layer block when it appears on the **Network** view, then set the [**Layer Properties**](#layer-properties) panel.

![Adding a layer](/files/Fqs7gsTP6JS4AH9EIyWd)

{% hint style="info" %}
Add a [**Loss and Optimizer**](/user-interface/project/network/network-mapping/create-a-mapping-deprecated/loss-node.md) to a network after the last layer. After saving, the network becomes available for training and evaluation (see [**Evaluate / Train Model**](/user-interface/project/menu-bar/evaluate-a-model.md)).
{% endhint %}

## Layer Properties

The **Layer Properties** panel appears to the right when you click a Layer on the Network view. From here, you can set the properties associated with a layer.&#x20;

For example, for a **Conv2D** layer, you may want to change the number of filters, kernel size, and activation type.

![Editing layer properties](/files/6wvlWjZbOeqfznEwY0Vf)

## Connections

Once layers have been added to your project, you can start connecting them to each other.

Starting from the **Dataset Block**, grab the layer's right handle and drag it to the next layer's left handle. Perform the same procedure for the rest of the layers.

When connecting layers, each block shows the calculated output shape affected by the preceding layers.

![Connecting layers](/files/eiXZtmNC0CpJKcxkYJEZ)

{% hint style="info" %}
Set up the Dataset Block first before connecting it to the first layer on the network. For more information, see [Input Node](/user-interface/project/network/network-mapping/create-a-mapping-deprecated/input-node.md).
{% endhint %}

### Remove Connections

If you make a mistake when connecting layers, remove the connection by grabbing the layer's left handle and dragging it away from the layer.

![Removing layer connections](/files/NAUNu5m0RGtUmrdu7qPX)

## Layer Operations

Layers can be duplicated, deleted, and spawned. You can also copy a layer's properties and apply them to another layer.

{% hint style="info" %}
This same set of operations is also applicable to Loss and Optimizer blocks, which are also layers. See [**Loss and Optimizer**](/user-interface/project/network/network-mapping/create-a-mapping-deprecated/loss-node.md) for more information.
{% endhint %}

### Duplicate a Layer

When duplicating a layer, the layer, including its properties, are copied into the Network view. However, the connections between the layer and adjacent layers are not copied.

This is helpful when laying out two or more of the same type of layer onto the network. If the layer properties are different, you can just edit them later.

To duplicate a layer:

1. From the **Network** view, position your mouse cursor over the layer to be duplicated, then make a right click.
2. On the popup menu, click <img src="/files/w5guIkNSoqHb5jl7bbNh" alt="" data-size="line"> to duplicate the layer onto the network.

![Duplicating a layer](/files/1BDlIoXiYjXWEmAsfVs6)

{% hint style="info" %}
If your layers are already connected, you may have to remove the connections, insert the duplicated layer in the desired position, then reconnect the layers together. See [**Connections**](#connections)  for more information.
{% endhint %}

### Remove a Layer

If you make a mistake while adding a layer, or you do not need a layer anymore, you can remove it from the network.

To remove a layer:

1. From the [**Network**](/user-interface/project/network.md) view, position your mouse cursor over the layer to be removed, then make a right click.
2. On the popup menu, click <img src="/files/0wizOPooLKOb75Oh6IDK" alt="" data-size="line"> to remove the layer from the network.

![Removing a layer](/files/FTKbwtnA97TFNuD6rmss)

{% hint style="info" %}
All connections to and from the deleted layer are also removed.
{% endhint %}

### Spawn a Representation Block for Layer Weights Sharing

Layer weights-sharing, or parameter sharing, means to use a layer's weights in more than one place within the model. This is often used when similar features are extracted from different places within the model. Instead of creating an additional layer, these weights are shared, thus reducing the overall number of trainable parameters and training time.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tensorleap.ai/user-interface/project/network/network-mapping/create-a-mapping-deprecated/layers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
