Skip to main content

Multi-Scale Sine Activation and INR network modules for PyTorch

Project description

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:

pip install msa-inr

For local development:

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

Quick Start

Use the activation function

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

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

from msa_inr import get_model

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

API

SineActivation

SineActivation(s_min: float, s_max: float)

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

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

and returns:

sin(freqs * x)

The input tensor is expected to have shape:

[batch_size, channels]

MSANet

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:

s_min = 1.0
s_max = 5.0

Build and Upload to PyPI

Install build tools:

pip install build twine

Build the package:

python -m build

Check the package:

twine check dist/*

Upload to PyPI:

twine upload dist/*

After uploading, users can install the package with:

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.

@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}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

msa_inr-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

msa_inr-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file msa_inr-0.1.0.tar.gz.

File metadata

  • Download URL: msa_inr-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for msa_inr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 150cabc3d1c2152c37367d8f380a153fda091778e0b17136c27cc312efee3d53
MD5 ed5252966c6ccbdf05c0e453d69d3355
BLAKE2b-256 2eee4a6b00bea278bbc3896bc6abffbbeabe183708f6d3cadeacea29acbba4b8

See more details on using hashes here.

File details

Details for the file msa_inr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: msa_inr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for msa_inr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24160ef3bca6e27bef7a71127bafb121bdf9270d4417730ae77e081ea4fd66b7
MD5 fd0772de0909c7690613fdc387558686
BLAKE2b-256 c21f573e642dfee70c97ba452a6bfea39ab3bebd99e5305411b466a820036a4f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page