Repository navigation
ArrayOperations.for_memory(): one registered leaf per memory type, holding the primitives that differ (0.4.0) - #10
Merged
Conversation
… the primitives that differ ArrayOperations leaves register by memory_type, and ArrayOperations.for_memory(MemoryType.X) returns the leaf. MemoryType finds its leaf through the family; the operations-name field and the six module-level *_OPERATIONS singletons are deleted. Leaves gain an instance namespace for array-library-neutral code: module (imported on first use), accepts, astype, max, min, mean, sum, prepend_axis, linspace, ones, assign, outer and floor. Each leaf overrides only what its library does differently (torch/JAX/TensorFlow float32 means, torch uint16 reductions, functional updates for JAX and TensorFlow, pyclesperanto z-projections). torch and TensorFlow cast also accepts native dtypes. Version 0.4.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… its dtype-name helper The TensorFlow leaf inherited the NumPy dtype_name, so every decorated TensorFlow call failed with "Cannot interpret 'tf.uint16' as a data type"; the _tensorflow_dtype_name helper existed but nothing used it. The torch leaf restated _torch_dtype_name inline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ArrayOperationsis anAutoRegisterMetafamily keyed bymemory_type;ArrayOperations.for_memory(MemoryType.X)returns that framework's leaf (one instance per leaf).MemoryTyperesolves its leaf through the family. The"NUMPY_OPERATIONS"-style operations-name field and the six module-level*_OPERATIONSsingletons are deleted.module(imported on first use),accepts,astype,max,min,mean,sum,prepend_axis,linspace,ones,assign,outer,floor. The base holds the NumPy-compatible call; each leaf overrides only what its library does differently:torch.linspacewithout an endpoint argument, scalarfloorin float32;jax.numpynamespace, float32 means, functionalassign(.at[].set);reduce_*, float32 means,tensor_scatter_nd_updateassign,tensordotouter;prepend_axisby create-and-assign.castalso accept native dtypes.Why
OpenHCS writes its six per-backend image processors once against this namespace (OpenHCS surface L5). No
uv.lockexists in this repository, so none is regenerated.Tests
tests/test_array_operations_family.py: one leaf perMemoryType, found byfor_memory; no string or singleton roster; NumPy primitives; JAX functional assign.black --check src/ scripts/andruff checkclean.Not merged or tagged: the owner releases.
🤖 Generated with Claude Code