Skip to main content

A collection of small functions that supplements torch functionality

Project description

TorchFun (originally Torchure)

##for those who expect more convenient features from torch


  • flatten(tensor)
  • imshow(tensor_batch)
  • load

Install TorchFun

pip install torchfun


Flatten (Module)

used to reshape outputs


flat = Flatten()
out = flat(x)

flatten (function)


out = flatten(x)

imshow (function)

only deal with torch channel-first image batch,


  • 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.


imshow(batch) imshow(batch,title=[a,b,c]) imshow(batch,title='title') imshow(batch,auto_close=False)

load (function)


  • arbitrary arguemnts named : a and b Load weight a into model b, or load model b using weight a The order of the arguments doesn't matter. Example:





>f = open('weight.pts')



Return value:

  • None

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for torchure, version 0.0.14
Filename, size File type Python version Upload date Hashes
Filename, size torchure-0.0.14-py3-none-any.whl (3.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size torchure-0.0.14.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page