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

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 (function)

Arguements:

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

    load('weights.pts',model)

or

>load(model,'weights.pts')

or

>f = open('weight.pts')
>load(f,model)

or

>load(model,f)

Return value:

  • model object

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.13.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torchfun-0.0.13-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file torchfun-0.0.13.tar.gz.

File metadata

  • Download URL: torchfun-0.0.13.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for torchfun-0.0.13.tar.gz
Algorithm Hash digest
SHA256 f46e284effd34c35c13e6373a82afea1b70c4b6feb9ea9021c9c94be455bd725
MD5 2d47d9b166d0bbb7f9b497b7936fcc0a
BLAKE2b-256 52d7ec3cd5b4cb52ce819886626c79721af89e3debf7f690d0f10556fae27b8c

See more details on using hashes here.

File details

Details for the file torchfun-0.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for torchfun-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 d5792c4b6204b740111a95ee9180a5bd83b439cf6a7052c04691dc82ea4aec45
MD5 be5445ef27fd2fa631de7afaeff77bbb
BLAKE2b-256 f4442fcea2afff4e2de544489a4c6c31c07eb470f261791fefc9eeb174e8f6c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page