Metadata-Version: 2.4
Name: msa-inr
Version: 0.1.0
Summary: Multi-Scale Sine Activation and INR network modules for PyTorch
Author: Jufeng Han
License: MIT
Project-URL: Homepage, https://github.com/your-username/MSA_INR
Project-URL: Repository, https://github.com/your-username/MSA_INR
Keywords: implicit neural representation,INR,activation function,multi-scale,sine activation,PyTorch
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch>=2.0
Dynamic: license-file

# MSA-INR

MSA-INR is a lightweight PyTorch package for using the **Multi-Scale Sine Activation (MSA)** in implicit neural representation (INR) models.

The package provides:

- `SineActivation`: a log-spaced multi-scale sine activation.
- `MSANet`: a simple MLP-style INR network using MSA.
- `get_model`: a convenient function for constructing `MSANet`.

---

## Installation

After the package is published to PyPI:

```bash
pip install msa-inr
```

For local development:

```bash
git clone https://github.com/your-username/MSA_INR.git
cd MSA_INR
pip install -e .
```

---

## Quick Start

### Use the activation function

```python
import torch
from msa_inr import SineActivation

activation = SineActivation(s_min=1.0, s_max=5.0)

x = torch.randn(8, 256)
y = activation(x)

print(y.shape)
```

### Use the MSA-INR network

```python
import torch
from msa_inr import MSANet

model = MSANet(
    in_features=2,
    hidden_features=256,
    hidden_layers=3,
    out_features=1,
    s_min=[1.0, 1.0, 1.0],
    s_max=[5.0, 5.0, 5.0],
)

coords = torch.rand(1024, 2)
pred = model(coords)

print(pred.shape)
```

### Use `get_model`

```python
from msa_inr import get_model

model = get_model(
    in_features=3,
    hidden_features=256,
    hidden_layers=2,
    out_features=1,
)
```

---

## API

### `SineActivation`

```python
SineActivation(s_min: float, s_max: float)
```

For an input tensor with feature dimension `C`, the activation builds `C` log-spaced frequencies:

```text
freqs = logspace(s_min, s_max, steps=C)
```

and returns:

```text
sin(freqs * x)
```

The input tensor is expected to have shape:

```text
[batch_size, channels]
```

---

### `MSANet`

```python
MSANet(
    in_features=3,
    hidden_features=256,
    hidden_layers=2,
    out_features=1,
    s_min=None,
    s_max=None,
)
```

If `s_min` and `s_max` are not provided, each MSA layer uses:

```text
s_min = 1.0
s_max = 5.0
```

---

## Build and Upload to PyPI

Install build tools:

```bash
pip install build twine
```

Build the package:

```bash
python -m build
```

Check the package:

```bash
twine check dist/*
```

Upload to PyPI:

```bash
twine upload dist/*
```

After uploading, users can install the package with:

```bash
pip install msa-inr
```

---

## Citation

If this activation function or package is useful for your research, please cite the corresponding MSA-INR paper or repository.

```bibtex
@misc{msa_inr,
  title  = {MSA-INR: Multi-Scale Sine Activation for Implicit Neural Representations},
  author = {Han, Jufeng},
  year   = {2026},
  note   = {PyTorch package for multi-scale sine activation and INR models}
}
```
