Skip to content
class

ViewFamily

ViewFamily

The tensors that read one buffer, as TensorImpl::make_view made them.

Every member holds this through shared_ptr, so use_count() is how many of them are alive. They share one version counter — a write through any member moves every member's version(), so a node that saved one of them notices — and an in-place write to a member goes into the buffer instead of a new storage slot, so the others see it (TensorImpl::write_through). members is how autograd finds the others to re-derive from the one written; entries expire with their tensors.

A Metal family has no shared bytes to write into — an MLX array is a value — so it keeps the buffer's current value instead, as root: a dense GpuStorage of nbytes bytes in any shape. Each member reads its elements out of the root through its own geometry, and a write through any member replaces the root (core/GpuStrided.h).