Skip to main content

einops style multi dimensional meshgrids

Project description

einmesh

einops-style multi dimensional meshgrids

Release Build status Commit activity License

Installation

Simple installation from pip:

pip install einmesh

API

Create high dimensional meshgrids through a single command.

from einmesh import einmesh, LogSpace, LinSpace

x, y = einmesh(
    "x y",                                       # Name a set of axis einops style
    x=LinSpace(start=0, end=3, num=3),           # Provide a space to sample from
    y=LogSpace(start=0, end=1, num=3, base=10),  # -- Mix and match as you like!
)
print(f"{x=}")
print(f"{y=}")

Will output

x=tensor([[0.0000, 0.0000, 0.0000],
        [1.5000, 1.5000, 1.5000],
        [3.0000, 3.0000, 3.0000]])
y=tensor([[ 1.0000,  3.1623, 10.0000],
        [ 1.0000,  3.1623, 10.0000],
        [ 1.0000,  3.1623, 10.0000]])

Thus it is effectively equivalent to common torch code

x = torch.linspace(start=0, end=1, num=3)
y = torch.logspace(start=0, end=1, num=3, base=10)

x, y = torch.meshgrid(x, y, indexing="ij")

Which in 2D is not too bad, but in high dimensions can get tireing!

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

einmesh-0.0.3.tar.gz (95.7 kB view details)

Uploaded Source

Built Distribution

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

einmesh-0.0.3-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file einmesh-0.0.3.tar.gz.

File metadata

  • Download URL: einmesh-0.0.3.tar.gz
  • Upload date:
  • Size: 95.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.2

File hashes

Hashes for einmesh-0.0.3.tar.gz
Algorithm Hash digest
SHA256 df82492696f7ca0e8db86d6597a81ef54c6473c34d3d58870f5e4fd998452918
MD5 f9917de4a2ee10a657cefb61a2b142ad
BLAKE2b-256 fbae39a655f0b3c449cc3ce3cbf6503df2cb937daad8670746eb1db6e0cf3ef5

See more details on using hashes here.

File details

Details for the file einmesh-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: einmesh-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.2

File hashes

Hashes for einmesh-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 711468685af084ed2101c0d7d8ed39d9d29ebcb00c9ce030dbcdf8e11d8295d4
MD5 525a61c371e15ada64ed321574302cdb
BLAKE2b-256 0b7f3d45c799bfc9280793a7c0733e354ba71f4e18badd08c829648594cbb6c4

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