# helia_edge.trainers.mask_autoencoder

Masked reconstruction with portable computation and explicit TF/Torch steps.

## helia_edge.trainers.mask_autoencoder.Reconstruction

`class` · `python`

```python
Reconstruction()
```

Masked target patches and their corresponding predicted patches.

Source: `helia_edge/trainers/mask_autoencoder.py:18`

### helia_edge.trainers.mask_autoencoder.Reconstruction.targets

`attribute` · `python`

```python
targets: Tensor
```

Input patches gathered at the selected mask indices.

Source: `helia_edge/trainers/mask_autoencoder.py:26`

### helia_edge.trainers.mask_autoencoder.Reconstruction.predictions

`attribute` · `python`

```python
predictions: Tensor
```

Reconstructed patches gathered at the same indices.

Source: `helia_edge/trainers/mask_autoencoder.py:27`

## helia_edge.trainers.mask_autoencoder.ReconstructionLoss

`class` · `python`

```python
ReconstructionLoss()
```

Reconstruction objective together with the patches used to compute it.

Source: `helia_edge/trainers/mask_autoencoder.py:30`

### helia_edge.trainers.mask_autoencoder.ReconstructionLoss.loss

`attribute` · `python`

```python
loss: Tensor
```

Loss tensor computed by the configured reconstruction objective.

Source: `helia_edge/trainers/mask_autoencoder.py:39`

### helia_edge.trainers.mask_autoencoder.ReconstructionLoss.targets

`attribute` · `python`

```python
targets: Tensor
```

Masked input patches.

Source: `helia_edge/trainers/mask_autoencoder.py:40`

### helia_edge.trainers.mask_autoencoder.ReconstructionLoss.predictions

`attribute` · `python`

```python
predictions: Tensor
```

Corresponding reconstructed patches.

Source: `helia_edge/trainers/mask_autoencoder.py:41`

## helia_edge.trainers.mask_autoencoder.MaskedAutoencoder

`class` · `python`

```python
MaskedAutoencoder(
    patch_layer: Callable[[Array], Tensor],
    patch_encoder: Callable[[Array], tuple[Tensor, Tensor, Tensor, Tensor, Tensor]],
    encoder: keras.Model,
    decoder: keras.Model,
    **kwargs: Any = {},
) -> None
```

Masked reconstruction with Keras fit() and independently callable objectives.

call() returns (targets, predictions). training controls layer state, not masks.
See https://ambiqai.github.io/helia-edge/getting-started/backends/ for serialization, native-loop
use and support limits.

Source: `helia_edge/trainers/mask_autoencoder.py:51`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.patch_layer

`attribute` · `python`

```python
patch_layer = patch_layer
```

Source: `helia_edge/trainers/mask_autoencoder.py:69`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.patch_encoder

`attribute` · `python`

```python
patch_encoder = patch_encoder
```

Source: `helia_edge/trainers/mask_autoencoder.py:70`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.encoder

`attribute` · `python`

```python
encoder = encoder
```

Source: `helia_edge/trainers/mask_autoencoder.py:71`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.decoder

`attribute` · `python`

```python
decoder = decoder
```

Source: `helia_edge/trainers/mask_autoencoder.py:72`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.call

`method` · `python`

```python
call(inputs: Array, training: bool = False) -> Reconstruction
```

Source: `helia_edge/trainers/mask_autoencoder.py:74`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.reconstruction_targets

`method` · `python`

```python
reconstruction_targets(x: Array, training: bool = False) -> Reconstruction
```

Return masked (target_patches, predicted_patches), without an objective.

Source: `helia_edge/trainers/mask_autoencoder.py:86`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.calculate_loss

`method` · `python`

```python
calculate_loss(x: Array, test: bool = False) -> ReconstructionLoss
```

Return (compiled total loss, targets, predictions); preserve the old API.

Source: `helia_edge/trainers/mask_autoencoder.py:90`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.compute_loss

`method` · `python`

```python
compute_loss(
    x: Any = None,
    y: Any = None,
    y_pred: Any = None,
    sample_weight: Any = None,
    training: bool = True,
) -> Tensor
```

Source: `helia_edge/trainers/mask_autoencoder.py:96`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.compute_metrics

`method` · `python`

```python
compute_metrics(x: Any, y: Any, y_pred: Any, sample_weight: Any = None) -> dict[str, Tensor]
```

Source: `helia_edge/trainers/mask_autoencoder.py:104`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.train_step

`method` · `python`

```python
train_step(data: Any) -> dict[str, Tensor]
```

Source: `helia_edge/trainers/mask_autoencoder.py:130`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.test_step

`method` · `python`

```python
test_step(data: Any) -> dict[str, Tensor]
```

Source: `helia_edge/trainers/mask_autoencoder.py:137`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.get_config

`method` · `python`

```python
get_config() -> dict[str, Any]
```

Source: `helia_edge/trainers/mask_autoencoder.py:143`

### helia_edge.trainers.mask_autoencoder.MaskedAutoencoder.from_config

`method` · `python`

```python
from_config(config: dict[str, Any], custom_objects: dict[str, Any] | None = None) -> Self
```

`classmethod`

Source: `helia_edge/trainers/mask_autoencoder.py:149`
