MLX eXtended
mlx.core.array supercharged.
Usage
Installation:
pip install mlxxuv add mlxx
After importing mlx, do this
import mlx.core as mx
# this will monkey patch `mlx.core.array` class with more convenient methods
import mlxx as _
Then you can use some methods like allclose
a = mx.array([1, 2, 3], dtype=mx.float32)
b = mx.array([1, 2, 3], dtype=mx.float32)
print(a.allclose(b))
print(a.inner(b))
c = mx.array([4,5,6])
print(a.add(c))
Available Convenient Methods
Comparison Operations
allclose(b, rtol=1e-05, atol=1e-08, equal_nan=False): Check if arrays are close within toleranceisclose(b, rtol=1e-05, atol=1e-08, equal_nan=False): Element-wise comparison within tolerancearray_equal(b, equal_nan=False): Check if arrays are exactly equal
Logical Operations
logical_and(b): Element-wise logical ANDlogical_or(b): Element-wise logical ORlogical_not(): Element-wise logical NOT
Binary Operations
add(other): Element-wise additiondivide(other)(alias:div): Element-wise divisionmultiply(other)(alias:mul): Element-wise multiplicationlogaddexp(other): Element-wise log(exp(a) + exp(b))binary_maximum(b): Element-wise maximum of self and b.binary_minimum(b): Element-wise minimum of self and b.power(exponent): Element-wise powermatmul(b): Matrix multiplicationaddmm(mat1, mat2, beta=1.0, alpha=1.0): Computesbeta * self + alpha * (mat1 @ mat2).inner(b): Inner product
Trigonometric Functions
arccos(): Inverse cosinearccosh(): Inverse hyperbolic cosinearcsin(): Inverse sinearcsinh(): Inverse hyperbolic sinearctan(): Inverse tangentarctanh(): Inverse hyperbolic tangentcosh(): Hyperbolic cosinesinh(): Hyperbolic sinetan(): Tangenttanh(): Hyperbolic tangent
Reduction Operations
nansum(axis=None, keepdims=False, dtype=None): Sum of array elements, treating NaNs as zero.
Mathematical Functions
ceil(): Ceiling functionfloor(): Floor functiondegrees(): Convert radians to degreesradians(): Convert degrees to radianserf(): Error functionerfinv(): Inverse error functionexpm1(): exp(x) - 1sigmoid(): Sigmoid functionsign(): Sign functionnorm(): Calculate norms, seemlx.core.linalg.norm
Infinity and NaN Checks
isfinite(): Check for finite valuesisinf(): Check for infinite valuesisnan(): Check for NaN valuesisneginf(): Check for negative infinityisposinf(): Check for positive infinity
Other Operations
negative(): Element-wise negationstop_gradient(): Stop gradient computationpermute(*axes): Permute axes (alias for transpose)t(): Transpose (alias for transpose)numpy(): Convertmlx.core.arrayto anumpy.ndarray
Note: All methods support an optional stream parameter for controlling computation streams where applicable.
Contributing
Feel free to make PRs!
Setup Dev Env
- Run
uv sync - Run
pre-commit install, oruv run pre-commit installif your shell doesn't autodetect venv
LICENSE
Metadata
Release files for mlxx 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mlxx-0.3.2.tar.gz | 6.0 kB | Without provenance | Details for mlxx-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mlxx-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for mlxx-0.3.2-py3-none-any.whl |
Total release size: 11.7 kB
Release files / mlxx-0.3.2.tar.gz
| Download URL | mlxx-0.3.2.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df67355fb910758c63cc30785c8d524c70277ec8fc24ae15a6146b98410a1f12
|
|
BLAKE2b-256 checksum How to use checksums |
902e758af14e249600875cb96f17f0e03307ca267530a6586ae6c8f4a06a7da4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.13
|
Release files / mlxx-0.3.2-py3-none-any.whl
| Download URL | mlxx-0.3.2-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5cab57fa13539557d02377a5118191c12f5fdb4f25cee6c375466a4a94595a4
|
|
BLAKE2b-256 checksum How to use checksums |
c385e10f1e8134896cdaf5f9daa45f6821c02fa592a3f0fb1c4d5d94e433ba8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.13
|
Security for mlxx 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.