# Core Concepts

Tensorleap operates around two core building blocks:

* **Model** – the neural network you want to analyze
* **Code** – which contains two parts:
  * **The integration code:** Custom Python functions that load your data and define how the data is processed (metrics, visualizations, etc.)
  * **The Integration test**: Python inference script that defines how your integration code connects to your model. In addition, it is used to test your code before uploading it to the platform

Together, the model-code pair defines everything Tensorleap needs to run explainability, validation, and debugging pipelines.

This page introduces each concept, how it’s represented in your local environment, and how it appears inside the Tensorleap platform.

## Model

**What is a Model in Tensorleap?**

A model in Tensorleap is a trained neural network used for inference and analysis. It’s the computational backbone that transforms input data into predictions.

**How Is the Model Used in the Platform**

Once uploaded, the model is saved as a [version](/user-interface/project/versions.md). The platform uses the model during [evaluation](/user-interface/project/menu-bar/evaluate-a-model.md) processes, combining it with your [integration code](/tensorleap-integration/writing-integration-code.md)  as defined in the [integration test](/user-interface/project/network/network-mapping/create-a-mapping-deprecated.md) to compute predictions, metrics, and insights.

Tensorleap supports models in `.onnx` or `.h5` format.

**How the Model Connects to the Other Components**

The model is powered by your [**integration script**](/tensorleap-integration/writing-integration-code.md), which defines how inputs and outputs are prepared. The [integration test](/user-interface/project/network/network-mapping/create-a-mapping-deprecated.md) then instructs the platform on how to connect these code interfaces to nodes in the platform's analysis graph, enabling rich visualization and debugging tools.

## Code

### The Integration Code

**What Is an Integration Code in Tensorleap?**

The [code integration](/tensorleap-integration/writing-integration-code.md) is a collection of Python scripts (or a complete repo) that defines how your dataset is processed and interpreted. It’s similar in purpose to a PyTorch `Dataset`: it loads and prepares data for your model, but also supports additional functionality like visualizations and custom metrics. Each component is defined using decorators such as [@tensorleap\_input\_encoder](/tensorleap-integration/python-api/code_loader/decorators/tensorleap_input_encoder.md) or [@tensorleap\_custom\_visualizer](/tensorleap-integration/python-api/code_loader/decorators/tensorleap_custom_visualizer.md).

**How the Code Integration Is Used in the Platform**

Your script is [uploaded](/tensorleap-integration/uploading-with-cli/cli-assets-upload.md#uploading-code-only) to the platform and executed during evaluation processes. Tensorleap calls the functions you've defined (e.g., [preprocess](/tensorleap-integration/writing-integration-code/preprocess-function.md), [encoders](/tensorleap-integration/writing-integration-code/input-encoder.md), [visualizers](/tensorleap-integration/writing-integration-code/visualizer-function.md)) to transform and interpret data throughout the analysis graph.

**How the Code Integration Connects to the Other Components**

The code integration acts as a bridge between your raw **dataset** and **model**. The **integration test** tells the platform how each function (e.g., your input encoder) connects to specific nodes in the platform’s graph, enabling explainability and evaluation.

### The Integration test

**What Is the integration test?**

The [integration test](/tensorleap-integration/integration-test.md) serves two purposes:\
(1) It enables a quick way to locally test whether your integration to Tensorleap works.

(2) It defines how the interfaces in your integration code connects to your model. For example, if you define an image visualizer using [@tensorleap\_custom\_visualizer](/tensorleap-integration/python-api/code_loader/decorators/tensorleap_custom_visualizer.md), the integration test tells the platform whether it should visualize the input, output, or ground truth.

**How the Integration test Is Used in the Platform**

When a process runs in the platform, the [integration test](/tensorleap-integration/integration-test.md) tells Tensorleap [how to connect](/user-interface/project/network/network-mapping/applying-a-mapping-deprecated.md) your code functions to the model’s input and output layers. This ensures that the platform executes your integration correctly and interprets its outputs.

**How the Integration test Connects to the Other Components**

The [Integration test](/tensorleap-integration/integration-test.md) links your [**integration script**](/tensorleap-integration/writing-integration-code.md) to your **model**, specifying how each [decorated](/tensorleap-integration/python-api/code_loader/decorators.md) function relates to the model’s computation. It makes your integration usable by the platform.

{% hint style="info" %}
For more info on the Integration test structure, syntax, and goals: see [this](/tensorleap-integration/integration-test.md) guide.
{% endhint %}


---

# 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/getting-started/core-concepts.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.
