{"id":22704364,"url":"https://github.com/justanhduc/neuralnet-pytorch","last_synced_at":"2025-07-30T20:04:52.637Z","repository":{"id":57445770,"uuid":"127388475","full_name":"justanhduc/neuralnet-pytorch","owner":"justanhduc","description":"A high level framework for general purpose neural networks in Pytorch.","archived":false,"fork":false,"pushed_at":"2020-12-05T06:24:18.000Z","size":818,"stargazers_count":27,"open_issues_count":5,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-26T11:17:03.032Z","etag":null,"topics":["convolutional-neural-networks","deep-learning","deep-neural-networks","neuralnet-pytorch","pytorch","sympy","theano"],"latest_commit_sha":null,"homepage":"https://neuralnet-pytorch.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justanhduc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-30T06:06:06.000Z","updated_at":"2023-09-16T12:00:42.000Z","dependencies_parsed_at":"2022-09-26T17:30:28.593Z","dependency_job_id":null,"html_url":"https://github.com/justanhduc/neuralnet-pytorch","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/justanhduc/neuralnet-pytorch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justanhduc%2Fneuralnet-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justanhduc%2Fneuralnet-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justanhduc%2Fneuralnet-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justanhduc%2Fneuralnet-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justanhduc","download_url":"https://codeload.github.com/justanhduc/neuralnet-pytorch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justanhduc%2Fneuralnet-pytorch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267930613,"owners_count":24167475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["convolutional-neural-networks","deep-learning","deep-neural-networks","neuralnet-pytorch","pytorch","sympy","theano"],"created_at":"2024-12-10T08:15:24.168Z","updated_at":"2025-07-30T20:04:52.561Z","avatar_url":"https://github.com/justanhduc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n![Python - Version](https://img.shields.io/pypi/pyversions/neuralnet-pytorch.svg)\n[![PyPI - Version](https://img.shields.io/pypi/v/neuralnet-pytorch.svg)](https://pypi.org/project/neuralnet-pytorch/)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/neuralnet-pytorch.svg)](https://pypi.org/project/neuralnet-pytorch/)\n[![Github - Tag](https://img.shields.io/github/tag/justanhduc/neuralnet-pytorch.svg)](https://github.com/justanhduc/neuralnet-pytorch/releases/tag/rel-0.0.4)\n[![License](https://img.shields.io/github/license/justanhduc/neuralnet-pytorch.svg)](https://github.com/justanhduc/neuralnet-pytorch/blob/master/LICENSE.txt)\n[![Build Status](https://travis-ci.org/justanhduc/neuralnet-pytorch.svg?branch=master)](https://travis-ci.org/justanhduc/neuralnet-pytorch)\n[![Documentation Status](https://readthedocs.org/projects/neuralnet-pytorch/badge/?version=latest)](https://neuralnet-pytorch.readthedocs.io/en/latest/?badge=latest)\n[![codecov](https://codecov.io/gh/justanhduc/neuralnet-pytorch/branch/master/graph/badge.svg)](https://codecov.io/gh/justanhduc/neuralnet-pytorch)\n\n__A high level framework for general purpose neural networks in Pytorch.__\n\nPersonally, going from Theano to Pytorch is pretty much like\ntime traveling from 90s to the modern day.\nHowever, we feel like despite having a lot of bells and whistles,\nPytorch is still missing many elements\nthat are confirmed to never be added to the library.\nTherefore, this library is written to supplement more features\nto the current magical Pytorch.\nAll the modules in the package directly subclass\nthe corresponding modules from Pytorch,\nso everything should still be familiar.\n\n# At first glance\nNeuralnet-pytorch mostly preserves the same spirit of native Pytorch but in a \n(hopefully) less verbose way.\nThe most prominent feature of Neuralnet-pytorch is the ability to handle \ninput and output tensor shapes of operators abstractly \n(powered by [Sympy](https://docs.sympy.org/latest/index.html)).\nFor example, the following snippet in Pytorch\n\n```\n\u003e\u003e\u003e from torch import nn\n\u003e\u003e\u003e model = nn.Sequential(\n... nn.Conv2d(1, 20, 5, padding=0),\n... nn.ReLU(),\n... nn.Conv2d(20, 64, 5, padding=0),\n... nn.ReLU()\n... )\n\u003e\u003e\u003e print(model)\nSequential(\n  (0): Conv2d(1, 20, kernel_size=(5, 5), stride=(1, 1))\n  (1): ReLU()\n  (2): Conv2d(20, 64, kernel_size=(5, 5), stride=(1, 1))\n  (3): ReLU()\n)\n```\n\ncan be rewritten in Neuralnet-pytorch as \n```\n\u003e\u003e\u003e import neuralnet_pytorch as nnt\n\u003e\u003e\u003e model = nnt.Sequential(\n... nnt.Conv2d(1, 20, 5, padding=0, activation='relu'),\n... nnt.Conv2d(20, 64, 5, padding=0, activation='relu')\n... )\n\u003e\u003e\u003e print(model)\nSequential(\n  (0): Conv2d(1, 20, kernel_size=(5, 5), stride=(1, 1), activation=relu) -\u003e (b0, 20, x0 - 4, x1 - 4)\n  (1): Conv2d(20, 64, kernel_size=(5, 5), stride=(1, 1), activation=relu) -\u003e (b0, 64, x0 - 8, x1 - 8)\n) -\u003e (b0, 64, x0 - 8, x1 - 8)\n\n```\n\nwhich is the same as the native Pytorch, or \n\n```\n\u003e\u003e\u003e import neuralnet_pytorch as nnt\n\u003e\u003e\u003e model = nnt.Sequential(input_shape=1)\n\u003e\u003e\u003e model.conv1 = nnt.Conv2d(model.output_shape, 20, 5, padding=0, activation='relu')\n\u003e\u003e\u003e model.conv2 = nnt.Conv2d(model.output_shape, 64, 5, padding=0, activation='relu')\n\u003e\u003e\u003e print(model)\nSequential(\n  (conv1): Conv2d(1, 20, kernel_size=(5, 5), stride=(1, 1), activation=relu) -\u003e (b0, 20, x0 - 4, x1 - 4)\n  (conv2): Conv2d(20, 64, kernel_size=(5, 5), stride=(1, 1), activation=relu) -\u003e (b0, 64, x0 - 8, x1 - 8)\n) -\u003e (b0, 64, x0 - 8, x1 - 8)\n```\n\nwhich frees you from a lot of memorization and manual calculations when adding one layer on top of another. \nTheano folks will also find some reminiscence as many functions are highly inspired by Theano.  \n\n# Requirements\n\n[Pytorch](https://pytorch.org/) \u003e= 1.0.0\n\n[Sympy](https://docs.sympy.org/latest/index.html)\n\n[Matplotlib](https://matplotlib.org/)\n\n[Visdom](https://github.com/facebookresearch/visdom)\n\n[Tensorboard](https://www.tensorflow.org/tensorboard)\n\n[Gin-config](https://github.com/google/gin-config) (optional)\n\n[Pykeops](https://github.com/getkeops/keops) \n(optional, required for the calculation of Sinkhorn Wasserstein loss.)\n\n[Geomloss](https://github.com/jeanfeydy/geomloss) \n(optional, required for the calculation of Sinkhorn Wasserstein loss.)\n\n# Documentation\n\nhttps://neuralnet-pytorch.readthedocs.io\n\n# Installation\n\nStable version\n```\npip install --upgrade neuralnet-pytorch\n```\n\nBleeding-edge version (recommended)\n\n```\npip install git+git://github.com/justanhduc/neuralnet-pytorch.git@master\n```\n\nTo install the package with optional dependencies, try\n\n```\npip install \"neuralnet-pytorch[option] @ git+git://github.com/justanhduc/neuralnet-pytorch.git@master\"\n```\nin which `option` can be `gin`/`geom`/`visdom`/`slack`.\n\nTo install the version with some collected Cuda/C++ ops, use\n\n```\npip install git+git://github.com/justanhduc/neuralnet-pytorch.git@master --global-option=\"--cuda-ext\"\n```\n\n# Usages\n\nThe manual reference is still under development and is available at https://neuralnet-pytorch.readthedocs.io.\n\n# TODO\n\n- [x] Adding introduction and installation \n- [x] Writing documentations\n- [x] Adding examples\n- [ ] Adding benchmarks for examples\n\n# Disclaimer\n\nThis package is a product from my little free time during my PhD, \nso most but not all the written modules are properly checked. \nNo replacements or refunds for buggy performance. \nAll PRs are welcome. \n\n# Acknowledgements\n\nThe CUDA Chamfer distance is taken from the [AtlasNet](https://github.com/ThibaultGROUEIX/AtlasNet) repo.\n\nThe AdaBound optimizer is taken from its [official repo](https://github.com/Luolc/AdaBound).\n\nThe adapted Gin for Pytorch code is taken from [Gin-config](https://github.com/google/gin-config).\n\nThe monitor scheme is inspired from [WGAN](https://github.com/igul222/improved_wgan_training).\n\nThe EMD CUDA implementation is adapted form [here](https://github.com/daerduoCarey/PyTorchEMD).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustanhduc%2Fneuralnet-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustanhduc%2Fneuralnet-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustanhduc%2Fneuralnet-pytorch/lists"}