Skip to main content

Neural Network Pipeline

Simple network building pipeline for PyTorch. (torch>=2.1,<2.2)

How to start?

  1. install pip install fish-nnpipeline and import nnpipeline

  2. create a pipe base object. (ex: `layer = nnpipeline.LinearExponentialEncoder(10, 5))

  3. chain it to torch.nn.sequential or do whatever you want. all pipeline object follows torch.nn.Module.. (at least forward method exists.)

Explain of each pipeline object

  1. Layers

1.1. LinearExponentialEncoder : Generate linear layers semi-automatically. You should give in_features, out_features and the class do the rest.

You can control narrowing node ratio by compression_rate parameter. (default 0.618) Also can use noramlization, dropout.

You cannot alter order between linear and others like norm, activation, dropout. It has been fixed (linear -> norm -> activation -> dropout) because I'm super lazy.

lee = LinearExponentialEncoder(100, 34)
# what lee is..
LinearExponentialEncoder(
  (layers): Sequential(
    (0): Linear(in_features=100, out_features=61, bias=True)
    (1): BatchNorm1d(61, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (2): ReLU()
    (3): Linear(in_features=61, out_features=37, bias=True)
    (4): BatchNorm1d(37, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (5): ReLU()
    (6): Linear(in_features=37, out_features=34, bias=True)
    (7): BatchNorm1d(34, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (8): ReLU()
  )
)

1.2. LinearExponentialDecoder : Encoder is narrowing down linear nodes. Decoder is expanding nodes. It's like a mirror of encoder.

Those linear encoder/decoder work based on exponentially inceasing/decreasing sequence that start from in_features to out_features. As you can see above example of lee, it works just like normal torch.nn.Module object. So you can put this in nn.Sequential or something.

1.3. LinearCylinder : Cylinder is a simple multi-layer module that has same input, output features. It looks just like a cylinder so the name is also cylinder.

  1. Glues

2.1. LinearJoint LYou can concatenate multiple pipeline output to one single pipeline using torch.cat. yes you can do this by yourself, but I prefer this way more.

  1. Compositions

3.1. LinearExponentialComposition: You can direcly use multiple pipes and join them manually, or you can simply define COMPOSITION class.

l1 = LinearExponentialEncoder(100, 35)
l2 = LinearExponentialEncoder(150, 40)
l3 = LinearExponentialEncoder(120, 30)

lec = LinearExponentialComposition([l1, l2, l3], 80)
print(lec)
# I'm lec!
LinearExponentialComposition(
  (pipes): ModuleList(
    (0): LinearExponentialEncoder(
      (layers): Sequential(
        (0): Linear(in_features=100, out_features=61, bias=True)
                ...
        (8): ReLU()
      )
    )
    (1): LinearExponentialEncoder(
      (layers): Sequential(
        (0): Linear(in_features=150, out_features=92, bias=True)
                ...
        (8): ReLU()
      )
    )
    (2): LinearExponentialEncoder(
      (layers): Sequential(
        (0): Linear(in_features=120, out_features=74, bias=True)
                ...
        (8): ReLU()
      )
    )
  )
  (joint): LinearJoint()
  (encoder): LinearExponentialEncoder(
    (layers): Sequential(
      (0): Linear(in_features=105, out_features=80, bias=True)
      (1): BatchNorm1d(80, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (2): ReLU()
    )
  )
)
  1. No more contents. I'm lazy. I'll add more later.

Metadata

Release files for fish-nnpipeline 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fish-nnpipeline 0.0.2
File Size Uploaded Provenance Actions
fish_nnpipeline-0.0.2.tar.gz 7.5 kB Without provenance Details for fish_nnpipeline-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fish-nnpipeline 0.0.2
File Interpreter ABI Platform Actions
fish_nnpipeline-0.0.2-py3-none-any.whl Python 3 none any Details for fish_nnpipeline-0.0.2-py3-none-any.whl

Total release size: 18.6 kB

Release files / fish_nnpipeline-0.0.2.tar.gz

Download URL fish_nnpipeline-0.0.2.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7db7dc06dd4d657aa0bb51cc4f90e23447bad2603cdc6bd75cb364037efe6d5a
BLAKE2b-256 checksum
How to use checksums
c7c52125d19f26ce4db7584d22a7a7be1541e0e253910d19bf93ce98aec4c5cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / fish_nnpipeline-0.0.2-py3-none-any.whl

Download URL fish_nnpipeline-0.0.2-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc9328279e63d278f1a5640f9636d787d3e6a5688447cd3738d10c93236826bc
BLAKE2b-256 checksum
How to use checksums
e64568c4b6dab19d50325961dc8f184a2fd6ce46a5d4ec669a29641a5ff64487
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Security for fish-nnpipeline 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page