Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cross-backend Python array library based on the Array API Standard.

License

NotificationsYou must be signed in to change notification settings

UniEnvOrg/XBArray

Repository files navigation

Cross-backend Python array library based on the Array API Standard.

This allows you to write array transformations that can run on different backends like NumPy, PyTorch, and Jax.

Installation

pip install xbarray

Usage:

Abstract typing:

fromxbarrayimportComputeBackend,BArrayType,BDeviceType,BDtypeType,BRNGTypefromtypingimportGenericclassBehavior(Generic[BArrayType,BDeviceType,BDtypeType,BRNGType]):def__init__(self,backend :ComputeBackend[BArrayType,BDeviceType,BDtypeType,BRNGType])->None:self.backend=backenddefcreate_array(self)->BArrayType:returnself.backend.zeros(5,dtype=self.backend.default_floating_dtype)

Concrete usage:

fromxbarray.pytorchimportPyTorchComputeBackendbehavior_pytorch_instance=Behavior(PyTorchComputeBackend)behavior_pytorch_array=behavior_pytorch_instance.create_array()

About

Cross-backend Python array library based on the Array API Standard.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp