# Utilities for simple needs
## torch snippets does a lot of default importing for you
Whether it is numpy, pandas, matplotlib or the useful functions that are mentioned below
Simply call
```python
from torch_snippets import *
```
All the imports are lightweight and thus should not take more than a couple of seconds
## Auxiliary Functions
There are simple functions that are overloaded to take inputs and perform repetitive tasks that usually take a few lines to write
#### Images
`show`, `inspect`, `Glob`, `read`, `resize`, `rotate`
#### Files and Paths
`stem`, `Glob`, `parent`, `name`, `fname`,
`makedir`, `zip_files`, `unzip_file`,
`find`, `extn`,
`readlines`, `writelines`
#### Lists
`L`, `flatten`
#### Dump and load python objects
`loaddill`,`dumpdill`
#### Misc
`Tqdm`, `Timer`, `randint`, `Logger`
#### Sets
`unique`, `diff`, `choose`, `common`
#### Pytorch Modules
`Reshape` and `Permute` (`nn.Modules`)
#### Report as Pytorch Lightning Callback
`LightningReport`
#### Charts
`Chart` from altair
and many more to come...
## Install
`pip install torch_snippets`
## Usage
```python
%time from torch_snippets import *
```
CPU times: user 1.79 s, sys: 672 ms, total: 2.46 s
Wall time: 2.62 s
```python
dir()
```
['AttrDict',
'B',
'BB',
'Blank',
'C',
'Chart',
'DataLoader',
'Dataset',
'Debug',
'E',
'Excep',
'F',
'Float',
'Glob',
'Image',
'ImportEnum',
'In',
'Inf',
'Info',
'Int',
'L',
'LightningReport',
'NullType',
'Out',
'P',
'PIL',
'Path',
'Permute',
'PrettyString',
'Report',
'Reshape',
'Self',
'ShowPrint',
'Stateful',
'Str',
'StrEnum',
'T',
'Timer',
'Tqdm',
'Warn',
'_',
'__',
'___',
'__builtin__',
'__builtins__',
'__doc__',
'__loader__',
'__name__',
'__package__',
'__spec__',
'_dh',
'_i',
'_i1',
'_i2',
'_ih',
'_ii',
'_iii',
'_oh',
'add',
'add_props',
'alt',
'anno_ret',
'annotations',
'arg0',
'arg1',
'arg2',
'arg3',
'arg4',
'argnames',
'argwhere',
'attrdict',
'basic_repr',
'bbfy',
'bind',
'camel2snake',
'charts',
'choose',
'chunked',
'class2attr',
'common',
'compose',
'copy_func',
'crop_from_bb',
'custom_dir',
'cv2',
'cycle',
'defaults',
'detuplify',
'device',
'df2bbs',
'diff',
'display',
'dumpdill',
'enlarge_bbs',
'eq',
'even_mults',
'exec_local',
'exit',
'extn',
'fastcores',
'fastuple',
'filter_dict',
'filter_ex',
'filter_keys',
'filter_values',
'find',
'first',
'flatten',
'fname',
'fname2',
'ge',
'gen',
'get_class',
'get_ipython',
'getattrs',
'glob',
'groupby',
'gt',
'hasattrs',
'ifnone',
'ignore_exceptions',
'in_',
'inspect',
'instantiate',
'inum_methods',
'is_',
'is_array',
'is_not',
'isdir',
'jitter',
'last_index',
'le',
'line',
'lines',
'listify',
'load_torch_model_weights_to',
'loaddill',
'loader',
'logger',
'lt',
'lzip',
'makedir',
'map_ex',
'maps',
'maybe_attr',
'md5',
'merge',
'mk_class',
'mul',
'ne',
'nested_attr',
'nested_idx',
'nn',
'not_',
'now',
'np',
'null',
'num_cpus',
'num_methods',
'nunique',
'optim',
'os',
'otherwise',
'pad',
'parent',
'partialler',
'patch',
'patch_property',
'patch_to',
'pd',
'pdb',
'pdfilter',
'pl',
'plt',
'properties',
'puttext',
'quit',
'rand',
'randint',
'range_of',
're',
'read',
'readPIL',
'readlines',
'rect',
'remove_duplicates',
'rename_batch',
'renumerate',
'replicate',
'resize',
'risinstance',
'rnum_methods',
'rotate',
'save_torch_model_weights_from',
'see',
'set_logging_level',
'setattrs',
'setify',
'show',
'shrink_bbs',
'snake2camel',
'sorted_ex',
'stem',
'stems',
'stop',
'store_attr',
'str_enum',
'sub',
'subplots',
'sys',
'th',
'to_absolute',
'to_relative',
'tonull',
'torch',
'torch_loader',
'torchvision',
'tqdm',
'trange',
'transforms',
'true',
'truediv',
'try_attrs',
'tuplify',
'type_hints',
'typed',
'uint',
'unique',
'uniqueify',
'unzip_file',
'using_attr',
'val2idx',
'with_cast',
'wrap_class',
'write',
'writelines',
'xywh2xyXY',
'zip_cycle',
'zip_files']
Raw data
{
"_id": null,
"home_page": "https://github.com/sizhky/torch_snippets/tree/master/",
"name": "torch-snippets",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "snippets,torch",
"author": "Yeshwanth Reddy",
"author_email": "1992chinna@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fc/f6/0beee4f16392f42a8c5a23948e09549617479540e724e40b8e291b8c2b06/torch_snippets-0.528.tar.gz",
"platform": null,
"description": "# Utilities for simple needs\n\n\n\n## torch snippets does a lot of default importing for you\nWhether it is numpy, pandas, matplotlib or the useful functions that are mentioned below\nSimply call\n```python\nfrom torch_snippets import *\n```\nAll the imports are lightweight and thus should not take more than a couple of seconds\n\n## Auxiliary Functions\nThere are simple functions that are overloaded to take inputs and perform repetitive tasks that usually take a few lines to write\n\n#### Images\n`show`, `inspect`, `Glob`, `read`, `resize`, `rotate`\n\n#### Files and Paths\n`stem`, `Glob`, `parent`, `name`, `fname`,\n\n\n`makedir`, `zip_files`, `unzip_file`,\n\n\n`find`, `extn`,\n\n\n`readlines`, `writelines`\n\n#### Lists\n`L`, `flatten`\n\n#### Dump and load python objects\n`loaddill`,`dumpdill`\n\n#### Misc\n`Tqdm`, `Timer`, `randint`, `Logger`\n\n#### Sets\n`unique`, `diff`, `choose`, `common`\n\n#### Pytorch Modules\n`Reshape` and `Permute` (`nn.Modules`)\n\n#### Report as Pytorch Lightning Callback\n`LightningReport`\n\n#### Charts\n`Chart` from altair\n\nand many more to come...\n\n## Install\n`pip install torch_snippets`\n\n## Usage\n\n\n```python\n%time from torch_snippets import *\n```\n\n CPU times: user 1.79 s, sys: 672 ms, total: 2.46 s\n Wall time: 2.62 s\n\n\n```python\ndir()\n```\n\n\n\n\n ['AttrDict',\n 'B',\n 'BB',\n 'Blank',\n 'C',\n 'Chart',\n 'DataLoader',\n 'Dataset',\n 'Debug',\n 'E',\n 'Excep',\n 'F',\n 'Float',\n 'Glob',\n 'Image',\n 'ImportEnum',\n 'In',\n 'Inf',\n 'Info',\n 'Int',\n 'L',\n 'LightningReport',\n 'NullType',\n 'Out',\n 'P',\n 'PIL',\n 'Path',\n 'Permute',\n 'PrettyString',\n 'Report',\n 'Reshape',\n 'Self',\n 'ShowPrint',\n 'Stateful',\n 'Str',\n 'StrEnum',\n 'T',\n 'Timer',\n 'Tqdm',\n 'Warn',\n '_',\n '__',\n '___',\n '__builtin__',\n '__builtins__',\n '__doc__',\n '__loader__',\n '__name__',\n '__package__',\n '__spec__',\n '_dh',\n '_i',\n '_i1',\n '_i2',\n '_ih',\n '_ii',\n '_iii',\n '_oh',\n 'add',\n 'add_props',\n 'alt',\n 'anno_ret',\n 'annotations',\n 'arg0',\n 'arg1',\n 'arg2',\n 'arg3',\n 'arg4',\n 'argnames',\n 'argwhere',\n 'attrdict',\n 'basic_repr',\n 'bbfy',\n 'bind',\n 'camel2snake',\n 'charts',\n 'choose',\n 'chunked',\n 'class2attr',\n 'common',\n 'compose',\n 'copy_func',\n 'crop_from_bb',\n 'custom_dir',\n 'cv2',\n 'cycle',\n 'defaults',\n 'detuplify',\n 'device',\n 'df2bbs',\n 'diff',\n 'display',\n 'dumpdill',\n 'enlarge_bbs',\n 'eq',\n 'even_mults',\n 'exec_local',\n 'exit',\n 'extn',\n 'fastcores',\n 'fastuple',\n 'filter_dict',\n 'filter_ex',\n 'filter_keys',\n 'filter_values',\n 'find',\n 'first',\n 'flatten',\n 'fname',\n 'fname2',\n 'ge',\n 'gen',\n 'get_class',\n 'get_ipython',\n 'getattrs',\n 'glob',\n 'groupby',\n 'gt',\n 'hasattrs',\n 'ifnone',\n 'ignore_exceptions',\n 'in_',\n 'inspect',\n 'instantiate',\n 'inum_methods',\n 'is_',\n 'is_array',\n 'is_not',\n 'isdir',\n 'jitter',\n 'last_index',\n 'le',\n 'line',\n 'lines',\n 'listify',\n 'load_torch_model_weights_to',\n 'loaddill',\n 'loader',\n 'logger',\n 'lt',\n 'lzip',\n 'makedir',\n 'map_ex',\n 'maps',\n 'maybe_attr',\n 'md5',\n 'merge',\n 'mk_class',\n 'mul',\n 'ne',\n 'nested_attr',\n 'nested_idx',\n 'nn',\n 'not_',\n 'now',\n 'np',\n 'null',\n 'num_cpus',\n 'num_methods',\n 'nunique',\n 'optim',\n 'os',\n 'otherwise',\n 'pad',\n 'parent',\n 'partialler',\n 'patch',\n 'patch_property',\n 'patch_to',\n 'pd',\n 'pdb',\n 'pdfilter',\n 'pl',\n 'plt',\n 'properties',\n 'puttext',\n 'quit',\n 'rand',\n 'randint',\n 'range_of',\n 're',\n 'read',\n 'readPIL',\n 'readlines',\n 'rect',\n 'remove_duplicates',\n 'rename_batch',\n 'renumerate',\n 'replicate',\n 'resize',\n 'risinstance',\n 'rnum_methods',\n 'rotate',\n 'save_torch_model_weights_from',\n 'see',\n 'set_logging_level',\n 'setattrs',\n 'setify',\n 'show',\n 'shrink_bbs',\n 'snake2camel',\n 'sorted_ex',\n 'stem',\n 'stems',\n 'stop',\n 'store_attr',\n 'str_enum',\n 'sub',\n 'subplots',\n 'sys',\n 'th',\n 'to_absolute',\n 'to_relative',\n 'tonull',\n 'torch',\n 'torch_loader',\n 'torchvision',\n 'tqdm',\n 'trange',\n 'transforms',\n 'true',\n 'truediv',\n 'try_attrs',\n 'tuplify',\n 'type_hints',\n 'typed',\n 'uint',\n 'unique',\n 'uniqueify',\n 'unzip_file',\n 'using_attr',\n 'val2idx',\n 'with_cast',\n 'wrap_class',\n 'write',\n 'writelines',\n 'xywh2xyXY',\n 'zip_cycle',\n 'zip_files']\n",
"bugtrack_url": null,
"license": "Apache Software License 2.0",
"summary": "One line functions for common tasks",
"version": "0.528",
"project_urls": {
"Homepage": "https://github.com/sizhky/torch_snippets/tree/master/"
},
"split_keywords": [
"snippets",
"torch"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "872a19df0be9700a62ca298c4f17ebd7d148ab30d113dfd5d2940485223a618b",
"md5": "8a12f7d5c65bdf37bc4dc7f876e8f670",
"sha256": "ee03c149155caec10b4f246538f5906e6a4dd04918bcf7d316db01729fb20a6d"
},
"downloads": -1,
"filename": "torch_snippets-0.528-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8a12f7d5c65bdf37bc4dc7f876e8f670",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 79850,
"upload_time": "2024-03-19T09:25:42",
"upload_time_iso_8601": "2024-03-19T09:25:42.275123Z",
"url": "https://files.pythonhosted.org/packages/87/2a/19df0be9700a62ca298c4f17ebd7d148ab30d113dfd5d2940485223a618b/torch_snippets-0.528-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fcf60beee4f16392f42a8c5a23948e09549617479540e724e40b8e291b8c2b06",
"md5": "9cc94e37388138d15f91b0a93498eb8e",
"sha256": "06f5ca72a5cefe10bbf448c71886b15d0e5ec59a199528ff248c2a0918de32cd"
},
"downloads": -1,
"filename": "torch_snippets-0.528.tar.gz",
"has_sig": false,
"md5_digest": "9cc94e37388138d15f91b0a93498eb8e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 69246,
"upload_time": "2024-03-19T09:25:46",
"upload_time_iso_8601": "2024-03-19T09:25:46.107719Z",
"url": "https://files.pythonhosted.org/packages/fc/f6/0beee4f16392f42a8c5a23948e09549617479540e724e40b8e291b8c2b06/torch_snippets-0.528.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-19 09:25:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sizhky",
"github_project": "torch_snippets",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "Pillow",
"specs": []
},
{
"name": "altair",
"specs": []
},
{
"name": "dill",
"specs": []
},
{
"name": "fastcore",
"specs": []
},
{
"name": "ipython",
"specs": []
},
{
"name": "loguru",
"specs": []
},
{
"name": "matplotlib",
"specs": []
},
{
"name": "numpy",
"specs": []
},
{
"name": "pandas",
"specs": []
},
{
"name": "setuptools",
"specs": []
},
{
"name": "tqdm",
"specs": []
}
],
"lcname": "torch-snippets"
}