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.2.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.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: einmesh-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 48f76f17e83f36b8fc0a2ffbee4edfca8941c85d6884a57d287b42dcda44b0c8
MD5 e227c5b76d12a13d5e62c9150328e19d
BLAKE2b-256 97eb17f676b5e473ffb7ef058200d125ab5c0bdd3007c461d03675e05c28c777

See more details on using hashes here.

File details

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

File metadata

  • Download URL: einmesh-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4be08a2bbb67246367f7145052ec25753887d4be492c74ac6c5e4b618a19e98d
MD5 6e6f3bdd52014693c284dc3d161a0296
BLAKE2b-256 d4bcc403b4b86095b639aceb5d013ca1b07ed9b1a757d275ba62fb6ba22d0c9a

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