A collection of small functions that supplements torch functionality
Project description
TorchFun (originally Torchure)
##for those who expect more convenient features from torch
Functionality
- flatten(tensor)
- imshow(tensor_batch)
- load
Install TorchFun
pip install torchfun
API
Flatten (Module)
used to reshape outputs
Usage:
flat = Flatten()
out = flat(x)
flatten (function)
Usage:
out = flatten(x)
imshow (function)
only deal with torch channel-first image batch,
Arguements:
- x: input data cube, torch tensor or numpy array.
- title: add title to plot. (Default None)
- title can be string, or any string-able object.
- auto_close: (default True)
- Close the pyplot session afterwards.
- Clean the environment just like you had never used matplotlib here.
- if set to False, the plot will remain in the memory for further drawings.
Usage:
imshow(batch)
imshow(batch,title=[a,b,c])
imshow(batch,title='title')
imshow(batch,auto_close=False)
load(a,b) (function)
Arguements:
- arbitrary arguemnts named :
a
andb
Load weighta
into modelb
, or load modelb
using weighta
The order of the arguments doesn't matter. Example:
>load('weights.pts',model)
or
>load(model,'weights.pts')
or
>f = open('weight.pts')
>load(f,model)
or
>load(model,f)
Return value:
- None
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
torchfun-0.0.17.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for torchfun-0.0.17-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fe3e9dd37c864da6f6bb3fc48bb91c436acabcadd6c563ccc66b08019ee07f2 |
|
MD5 | 75347dfd4f6e22fc400d1b02f59fc7a3 |
|
BLAKE2b-256 | d61a4c5f54c80b9118ceefa43baceb919a4bc6dbf56fd20d74c7d443efcac4ce |