Skip to main content

Autocast PyTorch tensors to numpy/matplotlib-CPU arrays in matplotlib.

Project description

matplotlib-torch

Transparently pass PyTorch tensors (CPU, CUDA, MPS, with/without grad) to matplotlib. Avoid .detach().cpu().numpy() boilerplate.

import matplotlib_torch
matplotlib_torch.activate()

import matplotlib.pyplot as plt
import torch

plt.plot(torch.tensor([1., 2., 3.], device='cuda'))   # just works

Install

pip install matplotlib-torch

Project details


Download files

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

Source Distribution

matplotlib_torch-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

matplotlib_torch-0.1.0-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file matplotlib_torch-0.1.0.tar.gz.

File metadata

  • Download URL: matplotlib_torch-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for matplotlib_torch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2cde4e4eb6f9e2feda440b96683a783d7a47182504d1a2f14c4def5365d79974
MD5 c9976f9036c83cd2d4b69d77cacb1240
BLAKE2b-256 2b0005270ec7f8ac72ed56add0998abb6da27df4791a0033eb84049b80e8b16f

See more details on using hashes here.

File details

Details for the file matplotlib_torch-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for matplotlib_torch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 600fb7f6fee92f7075508992e466ae9a0799a3a7c84927c74fb53dd2ba07442d
MD5 59ea062d4ba0bac23171249b0983e77c
BLAKE2b-256 2dc1cb53811621cf706748bcbd0937831716744ce61aa9fca71eb3d2d60944d9

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