# Keras Implementation of NMN

This directory contains the Keras/TensorFlow implementation of Neural Matter Network (NMN) components.

## Status Comparison

Compared to the reference `nnx` implementation, the Keras backend implements the core dense and convolutional layers but lacks some advanced features like attention mechanisms and RNNs.

### Implemented Features ✅
- **Core Layers**
  - `YatNMN` (Dense layer equivalent)
- **Convolutional Layers**
  - `YatConv1D`
  - `YatConv2D`
  - `YatConv3D`
- **Transposed Convolutional Layers**
  - `YatConvTranspose1D`
  - `YatConvTranspose2D`

### Missing Features 🚧
The following components from the reference implementation are currently missing or work-in-progress:

- **Transposed Convolution**
  - `YatConvTranspose3D`
- **Recurrent Neural Networks (RNN)**
  - `YatGRU`
  - `YatLSTM`
  - `YatSimpleRNN`
- **Attention Mechanisms**
  - `YatAttention`
  - `MultiHeadYatAttention`
  - `RotaryYatAttention`
  - `SphericalYatPerformer`
- **Squashing Functions**
  - `SoftTanh`
  - `SofterSigmoid`
  - `Softermax`

## Usage Example

```python
import keras
from nmn.keras import YatConv2D, YatNMN

model = keras.Sequential([
    keras.Input(shape=(28, 28, 1)),
    YatConv2D(32, kernel_size=3, strides=2, padding="same"),
    keras.layers.ReLU(),
    YatConv2D(64, kernel_size=3, strides=2, padding="same"),
    keras.layers.ReLU(),
    keras.layers.GlobalAveragePooling2D(),
    YatNMN(10),
    keras.layers.Softmax()
])
```
