{ "info": { "author": "Nikolay Novik", "author_email": "nickolainovik@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "torch-inspect\n=============\n.. image:: https://travis-ci.com/jettify/pytorch-inspect.svg?branch=master\n :target: https://travis-ci.com/jettify/pytorch-inspect\n.. image:: https://codecov.io/gh/jettify/pytorch-inspect/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/jettify/pytorch-inspect\n.. image:: https://img.shields.io/pypi/pyversions/torch-inspect.svg\n :target: https://pypi.org/project/torch-inspect\n.. image:: https://img.shields.io/pypi/v/torch-inspect.svg\n :target: https://pypi.python.org/pypi/torch-inspect\n\n**torch-inspect** -- collection of utility functions to inspect low level information of neural network for PyTorch_\n\nFeatures\n========\n* Provides helper function ``summary`` that prints Keras style model summary.\n* Provides helper function ``inspect`` that returns object with network summary information for programmatic access.\n* RNN/LSTM support.\n* Library has tests and reasonable code coverage.\n\n\nSimple example\n--------------\n\n.. code:: python\n\n import torch.nn as nn\n import torch.nn.functional as F\n import torch_inspect as ti\n\n class SimpleNet(nn.Module):\n def __init__(self):\n super(SimpleNet, self).__init__()\n self.conv1 = nn.Conv2d(1, 6, 3)\n self.conv2 = nn.Conv2d(6, 16, 3)\n self.fc1 = nn.Linear(16 * 6 * 6, 120)\n self.fc2 = nn.Linear(120, 84)\n self.fc3 = nn.Linear(84, 10)\n\n def forward(self, x):\n x = F.max_pool2d(F.relu(self.conv1(x)), (2, 2))\n x = F.max_pool2d(F.relu(self.conv2(x)), 2)\n x = x.view(-1, self.num_flat_features(x))\n x = F.relu(self.fc1(x))\n x = F.relu(self.fc2(x))\n x = self.fc3(x)\n return x\n\n def num_flat_features(self, x):\n size = x.size()[1:]\n num_features = 1\n for s in size:\n num_features *= s\n return num_features\n\n\n net = SimpleNet()\n ti.summary(net, (1, 32, 32))\n\n\nWill produce following output:\n\n.. code::\n\n ----------------------------------------------------------------\n Layer (type) Output Shape Param #\n ================================================================\n Conv2d-1 [100, 6, 30, 30] 60\n Conv2d-2 [100, 16, 13, 13] 880\n Linear-3 [100, 120] 69,240\n Linear-4 [100, 84] 10,164\n Linear-5 [100, 10] 850\n ================================================================\n Total params: 81,194\n Trainable params: 81,194\n Non-trainable params: 0\n ----------------------------------------------------------------\n Input size (MB): 0.39\n Forward/backward pass size (MB): 6.35\n Params size (MB): 0.31\n Estimated Total Size (MB): 7.05\n ----------------------------------------------------------------\n\nFor programmatic access to network information there is ``inspect`` function:\n\n.. code:: python\n\n info = ti.inspect(net, (1, 32, 32))\n print(info)\n\n\n.. code::\n\n [LayerInfo(name='Conv2d-1', input_shape=[100, 1, 32, 32], output_shape=[100, 6, 30, 30], trainable_params=60, non_trainable_params=0),\n LayerInfo(name='Conv2d-2', input_shape=[100, 6, 15, 15], output_shape=[100, 16, 13, 13], trainable_params=880, non_trainable_params=0),\n LayerInfo(name='Linear-3', input_shape=[100, 576], output_shape=[100, 120], trainable_params=69240, non_trainable_params=0),\n LayerInfo(name='Linear-4', input_shape=[100, 120], output_shape=[100, 84], trainable_params=10164, non_trainable_params=0),\n LayerInfo(name='Linear-5', input_shape=[100, 84], output_shape=[100, 10], trainable_params=850, non_trainable_params=0)]\n\n\nInstallation\n------------\nInstallation process is simple, just::\n\n $ pip install torch-inspect\n\n\nRequirements\n------------\n\n* Python_ 3.6+\n* PyTorch_ 1.0+\n\n\nReferences and Thanks\n---------------------\nThis package is based on pytorch-summary_ and PyTorch issue_ . Compared to\npytorch-summary_, *pytorch-inspect* has support of RNN/LSTMs, also provides programmatic\naccess to the network summary information. With a bit more modular structure and presence of tests\nit is easier to extend and support more features.\n\n\n.. _Python: https://www.python.org\n.. _PyTorch: https://github.com/pytorch/pytorch\n.. _pytorch-summary: https://github.com/sksq96/pytorch-summary\n.. _issue: https://github.com/pytorch/pytorch/issues/2001\n\nChanges\n-------\n\n0.0.3 (2019-09-22)\n------------------\n* Added LSTM support\n* Fixed multi input/output support\n* Added more network test cases\n* Batch size no longer -1 by default\n\n\n0.0.2 (2019-09-22)\n------------------\n* Added batch norm support\n* Removed device parameter\n\n\n0.0.1 (2019-09-1)\n------------------\n* Initial release.", "description_content_type": "", "docs_url": null, "download_url": "https://pypi.org/project/torch-inspect/", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jettify/pytorch-inspect", "keywords": "torch-inspect", "license": "Apache 2", "maintainer": "", "maintainer_email": "", "name": "torch-inspect", "package_url": "https://pypi.org/project/torch-inspect/", "platform": "POSIX", "project_url": "https://pypi.org/project/torch-inspect/", "project_urls": { "Download": "https://pypi.org/project/torch-inspect/", "Homepage": "https://github.com/jettify/pytorch-inspect" }, "release_url": "https://pypi.org/project/torch-inspect/0.0.3/", "requires_dist": null, "requires_python": "", "summary": "Utility functions that prints a summary of a model.", "version": "0.0.3" }, "last_serial": 5967891, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "d9270fbb27be89490f46814385333870", "sha256": "e51278937ceb6830f5064230327bb041ce3548539e21394bb43964125ee62cbb" }, "downloads": -1, "filename": "torch-inspect-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d9270fbb27be89490f46814385333870", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10656, "upload_time": "2019-09-02T02:42:35", "url": "https://files.pythonhosted.org/packages/5a/46/213edd5f48dd0e6b1564d15842de62715f16d47cb643543e5dd091d2de5d/torch-inspect-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "9c7e09631cf8d3c7a3bb89408a064149", "sha256": "d3549269bc8ef5a75d51d3436d0af3df550a8efc69e5044a75a1093de678e6e6" }, "downloads": -1, "filename": "torch-inspect-0.0.2.tar.gz", "has_sig": false, "md5_digest": "9c7e09631cf8d3c7a3bb89408a064149", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11553, "upload_time": "2019-09-23T02:07:03", "url": "https://files.pythonhosted.org/packages/9b/7e/2150c68c2f961d35e57d4fd281678d98ee3a5f90c31ae5a979f3ed2bedbd/torch-inspect-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "d7687d16a98c09fd772880fa12fe2b3a", "sha256": "12a06812109cb2bad0a46eeb3216c65dc6eca063dade1327c563876c6a8fc59b" }, "downloads": -1, "filename": "torch-inspect-0.0.3.tar.gz", "has_sig": false, "md5_digest": "d7687d16a98c09fd772880fa12fe2b3a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14474, "upload_time": "2019-10-13T16:21:06", "url": "https://files.pythonhosted.org/packages/0f/5e/d1df8aaeb433c32ece64b9e7df82f0f0abd5ec18b441a7bf18e2d60fd5bb/torch-inspect-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d7687d16a98c09fd772880fa12fe2b3a", "sha256": "12a06812109cb2bad0a46eeb3216c65dc6eca063dade1327c563876c6a8fc59b" }, "downloads": -1, "filename": "torch-inspect-0.0.3.tar.gz", "has_sig": false, "md5_digest": "d7687d16a98c09fd772880fa12fe2b3a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14474, "upload_time": "2019-10-13T16:21:06", "url": "https://files.pythonhosted.org/packages/0f/5e/d1df8aaeb433c32ece64b9e7df82f0f0abd5ec18b441a7bf18e2d60fd5bb/torch-inspect-0.0.3.tar.gz" } ] }