Skip to main content

Divide an array into batches along specific axes in NumPy / PyTorch / JAX

Project description

Axis Batch

CI Status Documentation Status Test coverage percentage

uv Ruff pre-commit

PyPI Version Supported Python versions License


Documentation: https://axis-batch.readthedocs.io

Source Code: https://github.com/34j/axis-batch


Divide an array into batches along specific axes in NumPy / PyTorch / JAX

Installation

Install this via pip (or your favourite package manager):

pip install axis-batch

Usage

import numpy as np

from axis_batch import AxisBatch

a = np.arange(12).reshape(3, 4)
b = AxisBatch(a, axis=0, size=2)
for i, x in enumerate(b):
    print(f"{i}: {x}")
    b.send(x + 1)
print(b.value)
0: [[0 1 2 3]
 [4 5 6 7]]
1: [[ 8  9 10 11]]
[[ 1  2  3  4]
 [ 5  6  7  8]
 [ 9 10 11 12]]

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

Copier

This package was created with Copier and the browniebroke/pypackage-template project template.

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

axis_batch-0.1.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

axis_batch-0.1.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file axis_batch-0.1.1.tar.gz.

File metadata

  • Download URL: axis_batch-0.1.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for axis_batch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f3eac0b64bf98f2b1aa8fd3a7f9c6606255766f4f1a6642449e0e3b9cbbd5480
MD5 4a3452e6abbeb854712c893aa8170255
BLAKE2b-256 8dcbedbc2d1c882e7712a0c2fc3e0a237d3694fc9d21d543b0bfeb7f00672362

See more details on using hashes here.

Provenance

The following attestation bundles were made for axis_batch-0.1.1.tar.gz:

Publisher: ci.yml on 34j/axis-batch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file axis_batch-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: axis_batch-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for axis_batch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b9c6794f9a53ab02cf989ea9ff94e6bf7b667cc11dc8a6e5e381d8c95be3aae6
MD5 cf2e52cb505938a33d3b6db87566d0ef
BLAKE2b-256 08e4bd9777eed5fe502c8915ce1e37cf442b3d32271aec0e88ec6fe521963e33

See more details on using hashes here.

Provenance

The following attestation bundles were made for axis_batch-0.1.1-py3-none-any.whl:

Publisher: ci.yml on 34j/axis-batch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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