Skip to content

Autodoc

Generated from the header Doxygen comments (doxygen + moxygen). For a curated view see the Reference and Cheat sheet.

Classes

Name Description
anyrank A rank-erased tensor for the host/ndarray dispatch boundary.
anyrank_front A range of fixed-rank-Sr sub-views over an anyrank's batch axes.
anyshape The shape spelling for the rank-erased anyrank boundary: exactly one etc marks the dynamic-rank region, the dims AFTER it are the static Tail (anchored at ndim), the dims BEFORE it are the static Head (anchored at 0).
axis Compile-time axis selector — a value tag carrying a list of axes, the sibling of shape<...> for axis arguments.
compute_type The type math should ACCUMULATE / compute in for element type T.
compute_type< bfloat16 >
compute_type< half >
copy_meta_t Tag for as_anyrank(..., copy_meta): COPY shape/stride into an inline, device-passable store instead of wrapping the caller's arrays.
cpp_alloc Host allocator using C++ new[] / delete[].
cuda_gpu_alloc Device (GPU) memory (cudaMalloc).
cuda_mapped_alloc Page-locked + device-mapped (zero-copy) host memory (cudaHostAlloc).
cuda_pinned_alloc Page-locked ("pinned") host memory (cudaMallocHost).
into_t
keep_strides Sentinel Layout selector for recast<NewShape, [keep_strides](#keep_strides)>() (the default): PRESERVE the source strides (fold where the source layout makes them derivable, keep runtime otherwise).
none_t Open-ended slice sentinel — teeny's None (python a[:n] / a[m:]).
owning_storage Generic owning storage (move-only, no ref-counting), parameterised by an allocator policy.
peel_range A range of sub-views obtained by peeling Axes....
ptr_storage
storage_policy
gpu, N >
gpu_view, N >
heap, N >
mapped, N >
mapped_view, N >
pinned, N >
pinned_view, N >
stack, N >
view, N >
storage_size Storage element count for a stack tensor (0 for view/owning).
storage_size< Mapping, true >
strides An mdspan layout policy with per-dimension static or dynamic strides — the stride analogue of extents/shape.
tensor One N-dimensional tensor, parameterised by ownership.

Enumerations

Name Description
ellipsis_t The ellipsis marker (numpy ...) for the unspecified middle axes.
storage Ownership / memory-space of a tensor's storage.

ellipsis_t

enum ellipsis_t

The ellipsis marker (numpy ...) for the unspecified middle axes.

Its own type (an empty enum) keeps it distinct from any real extent value, and being an enum it is a valid non-type template argument for anyshape<...>.

It has two roles that never overlap, so one marker serves both:

  • when indexing, t(1, ellipsis, 2) stands for as many all as fill the rank;

  • in an anyshape<...> boundary tag it marks the rank-erased region — there it is conventionally spelled etc ("and so on"), an alias of ellipsis. So ellipsis/ellipsis_t is the primary name and etc/etc_t the alias: t(1, etc, 2) == t(1, ellipsis, 2) and anyshape<ellipsis, 3> == anyshape<etc, 3>. (The _is_ellipsis indexing trait lives in [indexing.h](#indexingh).)


storage

enum storage

Ownership / memory-space of a tensor's storage.

view / stack need no allocator. The owning modes differ only in where the memory lives and how it is (de)allocated:

  • heap : ordinary C++ new[] / delete[] (host memory).

  • gpu : cudaMalloc (device memory; not host-dereferenceable).

  • pinned : cudaMallocHost (page-locked host memory — pytorch's "pinned").

  • mapped : cudaHostAlloc (page-locked + device-mapped / zero-copy). The gpu/pinned/mapped storage is defined in the opt-in [teeny/cuda.h](#cudah) (which needs the CUDA runtime); using them without it is a compile error.

Value Description
view
stack
heap
gpu
pinned
mapped
gpu_view
pinned_view
mapped_view

Typedefs

Return Name Description
layout_right ccontiguous Names for the two contiguous layouts: ccontiguous is C-contiguous (row-major, layout_right), fcontiguous is Fortran-contiguous (column-major, layout_left).
layout_left fcontiguous
ccontiguous corder Legacy aliases (corder/forder); prefer ccontiguous/fcontiguous.
fcontiguous forder
layout_stride dynamic_strides dynamic_strides — the all-runtime strided layout (layout_stride, a full runtime stride array).
integral_constant< int, V > Int
integral_constant< long, V > Long
integral_constant< size_t, V > Size
integral_constant< unsigned, V > UInt
integral_constant< ptrdiff_t, V > Diff
integral_constant< bool, V > Bool
integral_constant< int8_t, V > Int8
integral_constant< int16_t, V > Int16
integral_constant< int32_t, V > Int32
integral_constant< int64_t, V > Int64
integral_constant< uint8_t, V > UInt8
integral_constant< uint16_t, V > UInt16
integral_constant< uint32_t, V > UInt32
integral_constant< uint64_t, V > UInt64
Int8< V > I1
Int16< V > I2
Int32< V > I4
Int64< V > I8
UInt8< V > U1
UInt16< V > U2
UInt32< V > U4
UInt64< V > U8
int8_t i1
int16_t i2
int32_t i4
int64_t i8
uint8_t u1
uint16_t u2
uint32_t u4
uint64_t u8
float f4
double f8
extents< int64_t, _dyn_extent(E)... > shape User-friendly shape type: shape<2,3,4> == extents<int64_t, 2,3,4>.
extents< Idx, _dyn_extent(E)... > shape_as shape<...> with an explicit index type: shape_as<int32_t, -1,3,3>.
shape_as< int32_t, E... > shape32
dextents< int64_t, N > rank Fully-dynamic shape of a given rank: rank<3> == shape<-1,-1,-1> == extents<int64_t, dynamic_extent, dynamic_extent, dynamic_extent>.
ellipsis_t etc_t etc — the anyshape<...> spelling of ellipsis (same marker, same value).
tensor< T, Shape, Layout, storage::gpu > gpu Owning tensor in device (GPU) memory (move-only).
tensor< T, Shape, Layout, storage::pinned > pinned Owning tensor in page-locked ("pinned") host memory (move-only).
tensor< T, Shape, Layout, storage::mapped > mapped Owning tensor in mapped (zero-copy) host memory (move-only).
tensor< T, dextents< offset_t, R >, layout_stride, O > dyn_tensor A fixed-rank, fully-dynamic, arbitrarily-strided tensor view.
__half half IEEE binary16 — the native CUDA __half under nvcc.
__nv_bfloat16 bfloat16 bfloat16 — the native CUDA __nv_bfloat16 under nvcc.
typename compute_type< T >::type compute_type_t
half f2
bfloat16 bf16
strides< S... > layout_static_stride Back-compat alias: the original all-static-stride layout name.
typename _promote< A, B, true >::type promote_t
conditional_t<(is_floating_point< T >::value||!is_same< compute_type_t< T >, T >::value), conditional_t<(sizeof(T) > 8), T, double >, conditional_t<(sizeof(T) >=8), T, conditional_t< is_signed< T >::value, int64_t, uint64_t > > > reduce_type_t Default accumulator type for a reduction over element type T.
integral_constant< storage, O > storage_c Value-tag carrier for an ownership mode, for the factories' value-tag backend form, e.g.
tensor< T, Shape, Layout, storage::view > view A non-owning view type.
tensor< T, Shape, Layout, storage::stack > local Stack-owned tensor (fully static shape).
tensor< T, Shape, Layout, storage::heap > owned Heap-owned tensor (host only, move-only).

ccontiguous

using ccontiguous = layout_right

Names for the two contiguous layouts: ccontiguous is C-contiguous (row-major, layout_right), fcontiguous is Fortran-contiguous (column-major, layout_left).

Use wherever a Layout is expected — this is teeny's default and preferred spelling.


fcontiguous

using fcontiguous = layout_left

corder

using corder = ccontiguous

Legacy aliases (corder/forder); prefer ccontiguous/fcontiguous.


forder

using forder = fcontiguous

dynamic_strides

using dynamic_strides = layout_stride

dynamic_strides — the all-runtime strided layout (layout_stride, a full runtime stride array).

Prefer teeny's strides<S...> (folds known strides to immediates, and is what slicing produces); dynamic_strides is strides<> with every stride runtime.


Int

using Int = integral_constant< int, V >

Long

using Long = integral_constant< long, V >

Size

using Size = integral_constant< size_t, V >

UInt

using UInt = integral_constant< unsigned, V >

Diff

using Diff = integral_constant< ptrdiff_t, V >

Bool

using Bool = integral_constant< bool, V >

Int8

using Int8 = integral_constant< int8_t, V >

Int16

using Int16 = integral_constant< int16_t, V >

Int32

using Int32 = integral_constant< int32_t, V >

Int64

using Int64 = integral_constant< int64_t, V >

UInt8

using UInt8 = integral_constant< uint8_t, V >

UInt16

using UInt16 = integral_constant< uint16_t, V >

UInt32

using UInt32 = integral_constant< uint32_t, V >

UInt64

using UInt64 = integral_constant< uint64_t, V >

I1

using I1 = Int8< V >

I2

using I2 = Int16< V >

I4

using I4 = Int32< V >

I8

using I8 = Int64< V >

U1

using U1 = UInt8< V >

U2

using U2 = UInt16< V >

U4

using U4 = UInt32< V >

U8

using U8 = UInt64< V >

i1

using i1 = int8_t

i2

using i2 = int16_t

i4

using i4 = int32_t

i8

using i8 = int64_t

u1

using u1 = uint8_t

u2

using u2 = uint16_t

u4

using u4 = uint32_t

u8

using u8 = uint64_t

f4

using f4 = float

f8

using f8 = double

shape

using shape = extents< int64_t, _dyn_extent(E)... >

User-friendly shape type: shape<2,3,4> == extents<int64_t, 2,3,4>.

The fixed-size int64_t index type matches DLPack's shape exactly, so it drops straight onto ndarray bindings. A dynamic dimension can be spelled either dynamic_extent or, numpy-style, -1 — so shape<-1,2,3> == shape<dynamic_extent,2,3> == extents<int64_t, dynamic_extent, 2, 3>. Use it in place of extents<...>: local<double, shape<3,3>>, owned<float, shape<-1,4>>.


shape_as

using shape_as = extents< Idx, _dyn_extent(E)... >

shape<...> with an explicit index type: shape_as<int32_t, -1,3,3>.

shape<> is the int64 default (DLPack's index type); shape32<...> narrows the offset math to int32 for the kernel-boundary view (see reindex). The -1 == dynamic rule is the same.


shape32

using shape32 = shape_as< int32_t, E... >

rank

using rank = dextents< int64_t, N >

Fully-dynamic shape of a given rank: rank<3> == shape<-1,-1,-1> == extents<int64_t, dynamic_extent, dynamic_extent, dynamic_extent>.

Handy for a rank-N view whose sizes are all runtime: view<float, rank<3>>. rank<0> is the rank-0 (scalar) shape.


etc_t

using etc_t = ellipsis_t

etc — the anyshape<...> spelling of ellipsis (same marker, same value).


gpu

using gpu = tensor< T, Shape, Layout, storage::gpu >

Owning tensor in device (GPU) memory (move-only).

gpu<T,E>(extents).


pinned

using pinned = tensor< T, Shape, Layout, storage::pinned >

Owning tensor in page-locked ("pinned") host memory (move-only).

pinned<T,E>(extents) — pytorch's pin_memory.


mapped

using mapped = tensor< T, Shape, Layout, storage::mapped >

Owning tensor in mapped (zero-copy) host memory (move-only).

mapped<T,E>(extents).


dyn_tensor

using dyn_tensor = tensor< T, dextents< offset_t, R >, layout_stride, O >

A fixed-rank, fully-dynamic, arbitrarily-strided tensor view.

O is the memory space of the view — [storage::view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a1bda80f2be4d3658e0baa43fbe7ae8c1) (host) by default, [storage::gpu_view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a716b431c57855c3a30f4c286ad4f0299) when the pointer lives in device memory (see anyrank's Space).


half

using half = __half

IEEE binary16 — the native CUDA __half under nvcc.


bfloat16

using bfloat16 = __nv_bfloat16

bfloat16 — the native CUDA __nv_bfloat16 under nvcc.


compute_type_t

using compute_type_t = typename compute_type< T >::type

f2

using f2 = half

bf16

using bf16 = bfloat16

layout_static_stride

using layout_static_stride = strides< S... >

Back-compat alias: the original all-static-stride layout name.


promote_t

using promote_t = typename _promote< A, B, true >::type

reduce_type_t

using reduce_type_t = conditional_t<(is_floating_point< T >::value||!is_same< compute_type_t< T >, T >::value), conditional_t<(sizeof(T) > 8), T, double >, conditional_t<(sizeof(T) >=8), T, conditional_t< is_signed< T >::value, int64_t, uint64_t > > >

Default accumulator type for a reduction over element type T.

double for floating-point types of at most 8 bytes (float, double, half, bfloat16) — enough headroom that summing many low-precision values doesn't lose catastrophically; a wider floating type (long double) keeps itself. Integer types narrower than 8 bytes accumulate in 64-bit (int64_t if signed, uint64_t if unsigned — bool counts as unsigned) so that summing / multiplying many small integers can't overflow mid-accumulation (signed overflow is UB); integers already ≥8 bytes keep their own type. The RESULT is still cast back to the element type T (accumulate wide, cast down); a caller who wants the untruncated wide value uses the explicit accumulator (sum<int64_t>(a)). Half types are spotted via [compute_type](#compute_type) (the only T whose compute type differs from itself). Override per call, e.g. sum<float>(a).


storage_c

using storage_c = integral_constant< storage, O >

Value-tag carrier for an ownership mode, for the factories' value-tag backend form, e.g.

empty<T>(shape, storage_c<[storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)>{}).


view

using view = tensor< T, Shape, Layout, storage::view >

A non-owning view type.

Construct as view<T,E>(ptr, extents).


local

using local = tensor< T, Shape, Layout, storage::stack >

Stack-owned tensor (fully static shape).

Use local<T,E>{}.


owned

using owned = tensor< T, Shape, Layout, storage::heap >

Heap-owned tensor (host only, move-only).

Use owned<T,E>(extents).

Functions

Return Name Description
auto make_gpu
auto make_pinned
auto make_mapped
auto to Move x to memory space Space ([storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)/pinned/mapped/heap), optionally converting the element type to ET — the memory-backend half of pytorch's .to.
auto to Rvalue overload of to<Space>: a temporary source cannot be borrowed (the no-copy branch would dangle — and for a device temporary would point at freed device memory).
DLManagedTensor * to_dlpack Export a view (view / gpu_view / pinned_view / mapped_view) to a DLManagedTensor (borrows the data — the caller must keep the underlying memory alive; only the metadata is owned by the capsule).
DLManagedTensor * to_dlpack Export an owning tensor, TRANSFERRING ownership of the buffer into the capsule (the tensor is moved-from; the capsule's deleter frees the buffer).
DLTensor to_dltensor Export to a bare DLTensor (unmanaged — no capsule, no deleter, no allocation).
auto from_dlpack Import a DLManagedTensor of known element type T as an anyrank (runtime rank).
auto from_dlpack Import a bare DLTensor (unmanaged — no deleter).
auto from_dlpack Import a versioned managed tensor (DLPack 1.0+, what a modern __dlpack__(max_version=…) emits).
auto from_dlpack Import with a STATIC TRAILING shape baked into the carrier's type — from_dlpack<float, anyshape<etc,-1,-1,3>>(m) for a (*batch, *spatial, C) tensor with a static channel count.
auto from_dlpack
auto from_dlpack
auto from_dlpack Import as a fixed-rank view (requires the payload's ndim == R).
auto from_dlpack
auto from_dlpack
bool dispatch_dlpack Import + dispatch: read the dtype/rank from the DLManagedTensor and call f with a fixed-rank typed view (one instantiation per (dtype, rank)).
bool dispatch_dlpack_dtype Import + dtype-only dispatch that PRESERVES the rank: read the dtype from the capsule and call f with the typed anyrank (rank still dynamic), instead of collapsing to a fixed rank like dispatch_dlpack.
anyrank< T, offset_t, _meta_view< offset_t >, Space > as_anyrank Build an anyrank that wraps the caller's shape/stride arrays with no copy (the default) — e.g.
anyrank< T, offset_t, _meta_store< offset_t, MaxRank >, Space > as_anyrank as_anyrank(data, shape, stride, ndim, copy_meta) — COPY shape/stride into an inline store, so the carrier is trivially copyable and can be passed into a CUDA kernel by value (peel on device).
auto as_anyrank as_anyrank(..., anyshape<etc,c,c>{}[, layout]) — carry a STATIC TRAILING shape (and, with a layout tag, static trailing STRIDES) in the carrier's type, so fixed/peel_front hand out cells with those inner extents/strides already folded (no per-call recast).
auto as_anyrank as_anyrank(..., copy_meta, anyshape<etc,c,c>{}[, layout]) — the static-tail carrier over an INLINE (device-passable) meta store.
void dispatch_index Narrow a fixed-rank view's OFFSET INDEX WIDTH to Idx2 (default int32_t) when its element span fits, then call f — else call f with the view as-is.
void dispatch_layout Runtime-classify a DYNAMIC-strided view's contiguity and hand f a view whose LAYOUT is baked into the type — ccontiguous (C-order) or fcontiguous (F-order) when the runtime strides match, else the original dynamic_strides.
bool dispatch_rank Call f with a fixed-rank view of t chosen by its runtime ndim.
bool dispatch_value Turn a runtime value into a compile-time one from a candidate list.
auto slice A python-like slice [start : stop : step) for operator() / take_along.
auto slice
auto slice
auto peel_at The i-th sub-view obtained by peeling Axes... (0 <= i < product of the peeled extents).
auto peel_at
auto peel_at
auto peel_at
auto peel_at
auto peel Build a range of sub-views by peeling Axes... of t.
auto peel
auto peel
auto peel
peel_range< MD, storage::view, Axes... > peel_of Build a range of sub-views over a raw mdspan.
auto peel_front Peel the FIRST N axes -> a range of sub-views over the rest — the runtime-batch-rank half of (*batch, *spatial, C).
auto peel_front
auto peel_front_at The i-th sub-view obtained by peeling the first N axes (grid-stride style).
auto peel_front_at
tensor< T, E, L, O >::index_type size_front The number of sub-views peel_front<N>(t) would yield — the product of the peeled leading extents — computed directly, without materialising the range.
auto operator+
auto operator*
auto operator-
auto operator/
auto operator-
auto operator~
auto sum Sum of all elements (empty -> 0).
auto prod Product of all elements (empty -> 1).
auto max Maximum element.
auto min Minimum element.
auto mean Mean over the named axes -> a lower-rank tensor (sum / reduced count).
auto mean
auto mean
auto dot Inner product over matching extents.
auto sqnorm Squared Euclidean norm — the sum of squares Σ aᵢ², over ALL axes.
auto norm Euclidean (L2) norm √Σ aᵢ², over ALL axes.
auto norm
auto norm
auto norm
auto norm
auto normalize Out-of-place unit vector a / norm(a) -> a NEW dense tensor (static shape -> stack, dynamic -> heap).
auto & normalize normalize(a, into(y)) — the unit vector into a caller buffer y.
auto normalize normalize<Axes...>(a) — unit vectors along the named axes: each element divided by the L2 norm over those axes (keepdim broadcast).
auto normalize
auto cross 3D cross product a × b -> a NEW stack 3-vector of promote(Ta,Tb).
auto & cross cross(a, b, into(y)) — the cross product into a caller buffer y (rank-1, length 3); y may alias a or b.
bool allclose True if every element satisfies \|a-b\| <= atol + rtol*\|b\| (numpy allclose; broadcasts, computes in the compute type).
auto minimum
auto maximum
auto minimum
auto maximum
auto & minimum
auto & maximum
auto & minimum
auto & maximum
auto clamp clamp(a, lo, hi) -> a new tensor with each element clamped; clamp(a, lo, hi, into(y)) writes into y.
auto & clamp
auto mean Arithmetic mean of all elements.
class Ea class La storage Oa class Tb class Eb class Lb storage Ob class D auto & dot
constexpr bool storage_is_owning constexpr noexcept Whether the mode owns (and therefore allocates) its storage.
constexpr bool storage_is_view constexpr noexcept Whether the mode is a non-owning view (view/gpu_view/pinned_view/ mapped_view) — the pointer-wrapping modes (vs stack's inline array).
constexpr bool storage_is_device constexpr noexcept Whether the storage lives in device (GPU) memory (owning or view).
constexpr bool storage_is_host_accessible constexpr noexcept Whether the storage is dereferenceable from the host.
constexpr storage storage_view_of constexpr noexcept The non-owning VIEW kind that preserves a source's memory space: a device source (gpu/gpu_view) -> gpu_view, a pinned/mapped source -> pinned_view/mapped_view, anything else -> view.
constexpr storage storage_resolve constexpr noexcept Resolve a factory's ownership: an explicitly named mode passes through, storage_deduce becomes stack for a static shape / heap for a dynamic one.
tensor< typename MD::element_type, typename MD::extents_type, typename MD::layout_type, OW > as_tensor Wrap any cuda::std::mdspan (e.g.
void fetch_add noexcept Accumulate v into *p, atomic on the device only.
into_t< tensor< T, E, L, O > > into noexcept into(y) — the output-destination tag: pass it as the last argument to an out-of-place math producer (a.add(b, into(y)), cross(a,b,into(y)), exp(a, into(y)), …) to write the result into y (one fused pass, no allocation) and get y& back, instead of a freshly allocated result.
auto reindex Free forms of reindex/index_fits — deduce the tensor, so a type-dependent receiver avoids .template: reindex<int32_t>(t), index_fits<int32_t>(t).
auto reindex
bool index_fits
tensor< T, Shape, Layout, storage_view_of(Space)> wrap Wrap p as a non-owning view with a contiguous layout (default C-order).
tensor< T, Shape, layout_stride, storage_view_of(Space)> wrap Wrap p as a non-owning view with explicit runtime strides (a layout_stride view).
tensor< T, Shape, strides< Strides... >, storage_view_of(Space)> wrap Wrap p as a non-owning view with per-dimension compile-time strides (may be negative): pass a strides<S...>{} as the third argument.
tensor< T, Shape, strides< S0, Srest... >, storage_view_of(Space)> wrap Wrap p with a mix of static and runtime strides — the exact analogue of shape<-1,2,3,-1>{d0,d1} for strides.
auto make_view make_view<L>(ptr, extents) — a non-owning view (alias of wrap).
auto empty empty<T>(extents) — a new UNINITIALISED tensor.
auto empty Value-tag backend form: empty<T>(extents, storage_c<[storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)>{}).
auto make_local make_local<T>(extents) — a stack-owned tensor (static shape).
auto make_heap make_heap<T>(extents) — a heap-owned tensor (host, move-only).
auto full full(extents, v) — a new tensor filled with v.
auto full Value-tag backend form: full<T>(extents, v, storage_c<[storage::pinned](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a8a4f12ef77f9e30413cabd15cf16c913)>{}).
auto zeros zeros<T>(extents) / ones<T>(extents) — a new tensor of 0s / 1s.
auto zeros
auto ones
auto ones
auto arange arange<T>(n) — a 1-D tensor [0, 1, ..., n-1] (heap, host).
auto arange Value-tag backend form: arange<T>(n, storage_c<[storage::pinned](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a8a4f12ef77f9e30413cabd15cf16c913)>{}).
auto arange Static arange<T, N>() — a stack [0..N-1] (host+device, folds).
auto arange arange<T>(Int<N>()) — the static form spelled with a static integer.

make_gpu

template<class T = float, class Layout = ccontiguous, class Shape> auto make_gpu(Shape e)

make_pinned

template<class T = float, class Layout = ccontiguous, class Shape> auto make_pinned(Shape e)

make_mapped

template<class T = float, class Layout = ccontiguous, class Shape> auto make_mapped(Shape e)

to

template<storage Space, class ET = void, bool Force = false, class T, class Shape, class Layout, storage O> auto to(const tensor< T, Shape, Layout, O > & x)

Move x to memory space Space ([storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)/pinned/mapped/heap), optionally converting the element type to ET — the memory-backend half of pytorch's .to.

ET defaults to the source type.

auto d = to<storage::gpu>(h);           // upload host -> device
auto e = to<storage::gpu, half>(h);     // convert to half AND upload
auto c = to<storage::heap>(d);          // download device -> host
Stays put when already there (#58): with Force false and no dtype change, a source already in a compatible space borrows instead of copying — the exact same space (heap->heap, gpu->gpu), OR a device source moving to a device space (a gpu OR a gpu_view slice -> gpu). So the common "send data that's already on the device to the device" returns a gpu_view, NOT a host round-trip. Pass Force = true for a fresh owning copy:
       auto v = to<storage::gpu>(g);              // g is gpu (or a gpu_view slice) -> a view, no copy
       auto k = to<storage::gpu, void, true>(g);  // forced: a fresh gpu copy
When a copy IS made: a device -> device copy (Force, same dtype) of a dense row-major source is a single device-to-devicecudaMemcpy — no host hop; a strided device source falls back to the host densify (a device gather kernel is the #50 follow-up). A device -> host copy downloads via cudaMemcpy (any layout C/F/strided preserved, densified on the host). A host -> device copy reads the source directly (gathering only the viewed extent) and uploads. Space == stack needs a static shape.

:::note The no-copy branch returns a borrow of x (a gpu_view for a device source, else a host view), so it must outlive the result — same lifetime rule as [view()](#view)/permute()/slicing. On a temporary the rvalue overload below instead moves a same-space dense owning source (steals its buffer) or forces a copy, so nothing dangles. NB a contiguous device download copies exactly numel; a strided device download still copies its full span (over-copies — #50).

:::


to

template<storage Space, class ET = void, bool Force = false, class T, class Shape, class Layout, storage O> auto to(tensor< T, Shape, Layout, O > && x)

Rvalue overload of to<Space>: a temporary source cannot be borrowed (the no-copy branch would dangle — and for a device temporary would point at freed device memory).

A same-space, same-dtype, dense OWNING temporary is moved (its buffer stolen — no copy, no round-trip); otherwise this forces a fresh owning copy (which, for a device->device contiguous source, is the device-to-device path above, not a host round-trip).


to_dlpack

template<class T, class Shape, class Layout, storage O, enable_if_t< storage_is_view(O), int > = 0> DLManagedTensor * to_dlpack(const tensor< T, Shape, Layout, O > & t, DLDevice dev = { _dl::device_of< O >(), 0 })

Export a view (view / gpu_view / pinned_view / mapped_view) to a DLManagedTensor (borrows the data — the caller must keep the underlying memory alive; only the metadata is owned by the capsule).

The device defaults to the tensor's memory space (kDLCPU for a host view, kDLCUDA for a gpu_view, kDLCUDAHost for a pinned_view/ mapped_view; pass dev to override). The consumer owns the returned pointer and MUST call m->deleter(m) exactly once.


to_dlpack

template<class T, class Shape, class Layout, storage O, enable_if_t< storage_is_owning(O), int > = 0> DLManagedTensor * to_dlpack(tensor< T, Shape, Layout, O > && t)

Export an owning tensor, TRANSFERRING ownership of the buffer into the capsule (the tensor is moved-from; the capsule's deleter frees the buffer).

Device is taken from the tensor's memory space.


to_dltensor

template<class T, class Shape, class Layout, storage O> DLTensor to_dltensor(const tensor< T, Shape, Layout, O > & t, int64_t * shape_out, int64_t * strides_out, DLDevice dev = { _dl::device_of< O >(), 0 })

Export to a bare DLTensor (unmanaged — no capsule, no deleter, no allocation).

Borrows both the data AND the shape/stride arrays: the caller supplies shape_out/strides_out (each ≥ t.rank()``int64_ts), which this fills, and the returned DLTensor points at them + t.data(). The caller must keep the tensor's memory and those two buffers alive for as long as the DLTensor is used. Use for a consumer that takes a plain DLTensor rather than a managed capsule. Device defaults to the tensor's memory space (override with dev). Works for any storage (a pure borrow).


from_dlpack

template<class T, storage Space = storage::view> auto from_dlpack(const DLManagedTensor * m)

Import a DLManagedTensor of known element type T as an anyrank (runtime rank).

The shape/stride METADATA is copied into the carrier (so it is self-contained), while the DATA is BORROWED — the caller keeps m alive while the view is used, then calls m->deleter(m). A null strides (DLPack's C-contiguous shorthand) is expanded to row-major. byte_offset is folded into the data pointer.

Space is the memory space to tag the carrier with (default [storage::view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a1bda80f2be4d3658e0baa43fbe7ae8c1) = host); every view peeled off it inherits it. It is checked against m->dl_tensor.device: importing a kDLCUDA capsule as the default host Space trips _TNY_CHECK — spell from_dlpack<T, [storage::gpu_view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a716b431c57855c3a30f4c286ad4f0299)>(m) so fixed()/peel_front yield device-tagged views (no host deref of a device pointer). (Closes the #38 hole where the device field was ignored and a device capsule silently became a host view.)


from_dlpack

template<class T, storage Space = storage::view> auto from_dlpack(const DLTensor * dt)

Import a bare DLTensor (unmanaged — no deleter).

Borrows the data, copies the metadata; the CALLER owns the whole lifetime (there is nothing to free). Use when a producer hands you a plain DLTensor* rather than a capsule. Same Space/device check as the managed overload.


from_dlpack

template<class T, storage Space = storage::view> auto from_dlpack(const DLManagedTensorVersioned * m)

Import a versioned managed tensor (DLPack 1.0+, what a modern __dlpack__(max_version=…) emits).

Reads its dl_tensor payload; as with the classic capsule the caller keeps m alive and calls m->deleter(m).


from_dlpack

template<class T, class S, storage Space = storage::view, class Layout = keep_strides, enable_if_t< _is_anyshape< S >::value, int > = 0> auto from_dlpack(const DLManagedTensor * m, Layout = {})

Import with a STATIC TRAILING shape baked into the carrier's type — from_dlpack<float, anyshape<etc,-1,-1,3>>(m) for a (*batch, *spatial, C) tensor with a static channel count.

The payload's trailing dims are debug-checked against the tag once, here at the import boundary (next to the producer), then folded into every fixed/peel_front cell — no per-call recast. etc = the erased batch (see anyshape); the Space device check is the same as the tag-less overloads. Accepts all three carriers.

Pass a layout tag by value to also fold the trailing STRIDES: from_dlpack<float, anyshape<etc,-1,-1,3>>(m, ccontiguous{}) bakes a C-contiguous inner block (checked vs the payload's strides here — the "input is contiguous" precondition, asserted at the boundary once instead of a per-call recast/dispatch_layout). Default [keep_strides](#keep_strides) keeps them runtime.


from_dlpack

template<class T, class S, storage Space = storage::view, class Layout = keep_strides, enable_if_t< _is_anyshape< S >::value, int > = 0> auto from_dlpack(const DLTensor * dt, Layout = {})

from_dlpack

template<class T, class S, storage Space = storage::view, class Layout = keep_strides, enable_if_t< _is_anyshape< S >::value, int > = 0> auto from_dlpack(const DLManagedTensorVersioned * m, Layout = {})

from_dlpack

template<class T, size_t R, storage Space = storage::view> auto from_dlpack(const DLManagedTensor * m)

Import as a fixed-rank view (requires the payload's ndim == R).

Returns a layout_stride tensor view borrowing the data. Space (default host [storage::view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a1bda80f2be4d3658e0baa43fbe7ae8c1)) tags the view and is checked against the device, as in the anyrank overloads — from_dlpack<T, R, [storage::gpu_view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a716b431c57855c3a30f4c286ad4f0299)>(m) for a device tensor. Accepts all three carriers (managed / bare / versioned).


from_dlpack

template<class T, size_t R, storage Space = storage::view> auto from_dlpack(const DLTensor * dt)

from_dlpack

template<class T, size_t R, storage Space = storage::view> auto from_dlpack(const DLManagedTensorVersioned * m)

dispatch_dlpack

template<storage Space = storage::view, class Carrier, class F> bool dispatch_dlpack(const Carrier * m, F && f)

Import + dispatch: read the dtype/rank from the DLManagedTensor and call f with a fixed-rank typed view (one instantiation per (dtype, rank)).

Returns false if the dtype/rank is outside the supported set. Data borrowed; caller owns m. Space (default host [storage::view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a1bda80f2be4d3658e0baa43fbe7ae8c1)) tags the views and is checked against the capsule's device — dispatch a device capsule with dispatch_dlpack<[storage::gpu_view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a716b431c57855c3a30f4c286ad4f0299)>(m, f).


dispatch_dlpack_dtype

template<storage Space = storage::view, class Carrier, class F> bool dispatch_dlpack_dtype(const Carrier * m, F && f)

Import + dtype-only dispatch that PRESERVES the rank: read the dtype from the capsule and call f with the typed anyrank (rank still dynamic), instead of collapsing to a fixed rank like dispatch_dlpack.

The caller then peels its own axes — the (*batch, *spatial, C) batch idiom for (auto cell : at.peel_front<-Sr>()) …, which instantiates the kernel once per Sr, not once per total rank. Returns false for an unsupported dtype. Data borrowed; caller owns m. Space tags the carrier and is checked against the capsule's device (see from_dlpack).


as_anyrank

template<storage Space = storage::view, class T, class offset_t> anyrank< T, offset_t, _meta_view< offset_t >, Space > as_anyrank(T * data, offset_t * shape, offset_t * stride, int ndim)

Build an anyrank that wraps the caller's shape/stride arrays with no copy (the default) — e.g.

straight off a DLPack tensor. The arrays must outlive the carrier. HOST only: the pointers are not valid inside a device kernel, so peel/dispatch on the host and pass the resulting fixed-rank views to the device. To instead copy into an inline, device-passable store, pass the copy_meta tag (overload below). DLPack strides are in ELEMENTS; numpy __array_interface__ in BYTES (divide by the itemsize first).

Space is the memory space of data (default [storage::view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a1bda80f2be4d3658e0baa43fbe7ae8c1) = host); pass as_anyrank<[storage::gpu_view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a716b431c57855c3a30f4c286ad4f0299)>(...) for a device pointer so the views peeled off it are gpu_view-tagged. (The shape/stride metadata arrays are host either way — Space labels the DATA, not the metadata store.)


as_anyrank

template<size_t MaxRank = TNY_MAX_RANK, storage Space = storage::view, class T, class offset_t> anyrank< T, offset_t, _meta_store< offset_t, MaxRank >, Space > as_anyrank(T * data, const offset_t * shape, const offset_t * stride, int ndim, copy_meta_t)

as_anyrank(data, shape, stride, ndim, copy_meta) — COPY shape/stride into an inline store, so the carrier is trivially copyable and can be passed into a CUDA kernel by value (peel on device).

MaxRank sets the inline capacity (default TNY_MAX_RANK); pass it as as_anyrank<64>(..., copy_meta). Accepts const arrays (it copies).


as_anyrank

template<storage Space = storage::view, class T, class offset_t, class S, class Layout = keep_strides, enable_if_t< _is_anyshape< S >::value, int > = 0> auto as_anyrank(T * data, offset_t * shape, offset_t * stride, int ndim, S, Layout = {})

as_anyrank(..., anyshape<etc,c,c>{}[, layout]) — carry a STATIC TRAILING shape (and, with a layout tag, static trailing STRIDES) in the carrier's type, so fixed/peel_front hand out cells with those inner extents/strides already folded (no per-call recast).

The runtime shape/strides' trailing dims are debug-checked against the tag once, here, then trusted. etc = the erased batch; the dims after it are the static tail (see anyshape). The optional layout tag chooses the trailing strides (like recast's 2nd arg): [keep_strides](#keep_strides) (default — strides stay runtime), ccontiguous/fcontiguous (fold the contiguous inner block — the "input is contiguous" precondition, checked here), or strides<S...> (impose them). Wraps the caller's arrays (no copy).


as_anyrank

template<size_t MaxRank = TNY_MAX_RANK, storage Space = storage::view, class T, class offset_t, class S, class Layout = keep_strides, enable_if_t< _is_anyshape< S >::value, int > = 0> auto as_anyrank(T * data, const offset_t * shape, const offset_t * stride, int ndim, copy_meta_t, S, Layout = {})

as_anyrank(..., copy_meta, anyshape<etc,c,c>{}[, layout]) — the static-tail carrier over an INLINE (device-passable) meta store.


dispatch_index

template<class Idx2 = int32_t, class V, class F> void dispatch_index(V && v, F && f)

Narrow a fixed-rank view's OFFSET INDEX WIDTH to Idx2 (default int32_t) when its element span fits, then call f — else call f with the view as-is.

The kernel-boundary primitive behind the int32 fast path (#115): it instantiates f for BOTH widths and picks at run time via index_fits/reindex, so a genuinely dynamic view runs its offset math in 32-bit (half the by-value footprint, fewer device registers) exactly when that is lossless. _TNY_HOST; preserves the view's mutability. Use it standalone on a known-rank view (or a peel_front batch cell), or via dispatch_rank<narrow_index> to fuse it with the rank dispatch.

for (auto cell : at.peel_front<-Sr>()) dispatch_index(cell, [&](auto c){ kernel<Sr>(c); });


dispatch_layout

template<class T, class E, storage O, class F> void dispatch_layout(tensor< T, E, dynamic_strides, O > v, F && f)

Runtime-classify a DYNAMIC-strided view's contiguity and hand f a view whose LAYOUT is baked into the type — ccontiguous (C-order) or fcontiguous (F-order) when the runtime strides match, else the original dynamic_strides.

The layout counterpart of dispatch_index. An anyrank boundary erases the producer's contiguity into layout_stride, so a later recast<shape<…>> can only KEEP runtime strides. dispatch_layout cheaply checks (is_dense<ccontiguous>() / <fcontiguous>() — a stride compare, no data touched) and, in the contiguous arms, hands f a view whose strides are EXTENT-DERIVED — so recast<shape<-1,c,c>>() then folds the inner strides to immediates SAFELY (no "I promise it's contiguous" — the runtime check already proved it). f is instantiated up to 3× (only the matching arm runs), so make it generic over the view type.

OPT-IN per call site (like dispatch_index): do NOT wrap from_dlpack in it by default — it triples instantiations and composes multiplicatively with the rank/width dispatchers. Reach for it when the inner block's folded strides actually matter (a small static-C kernel; see the efficient-kernels guide).

for (auto cell : at.peel_front<-Sr>())
    dispatch_layout(cell, [&](auto v){ kernel<Sr>(v.recast(shape<-1,c,c>{})); });


dispatch_rank

template<bool Narrow = false, class T, class offset_t, class Meta, storage Space, class Tail, class TailS, class Head, class HeadS, class F> bool dispatch_rank(const anyrank< T, offset_t, Meta, Space, Tail, TailS, Head, HeadS > & t, F && f)

Call f with a fixed-rank view of t chosen by its runtime ndim.

f is a generic callable instantiated once per possible rank; the kernel it launches is fully static. Returns false if ndim exceeds max_rank. Prefer peel_front<-Sr> when only the trailing dims need to be static — one instantiation instead of one per total rank.

dispatch_rank(as_anyrank(data, size, stride, ndim), [&](auto v){ kernel(v); });
Opt into the int32 fast path with the compile-time narrow_index flag: each fixed cell is then also dispatch_index-narrowed (rank OUTER, width INNER — only the leaf doubles). Narrow = false (the default) is exactly the plain rank dispatch — no extra instantiation.
dispatch_rank<narrow_index>(at, [&](auto v){ kernel(v); });   // int32 cells when they fit


dispatch_value

template<int... Vs, class F> bool dispatch_value(int v, F && f)

Turn a runtime value into a compile-time one from a candidate list.

dispatch_value<1,2,3>(D, f) calls f(Int<k>{}) for the matching candidate k == D (so f receives a static integral_constant it can use as a template argument), and returns whether any matched.

dispatch_value<1,2,3>(ndim_spatial, [&](auto d){ kernel<d.value>(view); });


slice

template<class A, class B> auto slice(A start, B stop)

A python-like slice [start : stop : step) for operator() / take_along.

none marks an open end; negative bounds wrap (count from the back); step defaults to 1 and may exceed 1.

slice(1, 4) = [1,4); slice(none, 4) = [0,4); slice(2, none) = [2,end); slice(0, none, 2) = every other element; slice(none, none) keeps the whole axis (== all, which is preferable when you want the axis kept — it folds and preserves static extents). A ranged axis is resolved at run time (its extent becomes dynamic); axes kept with all stay static.


slice

template<class A, class B, class S> auto slice(A start, B stop, S step)

slice

template<long Start, long Stop, long Step = 1> auto slice()

peel_at

template<size_t... Axes, class MD> auto peel_at(const MD & src, typename MD::index_type i)

The i-th sub-view obtained by peeling Axes... (0 <= i < product of the peeled extents).

Peeled axes vary in row-major order (the last listed axis fastest). Returns a [tny::tensor](#tensor) view. A raw mdspan carries no memory space, so this tags the result as a host view; the [tny::tensor](#tensor) overloads below preserve the source's space.


peel_at

template<long... Axes, class T, class E, class L, storage O> auto peel_at(tensor< T, E, L, O > & t, typename tensor< T, E, L, O >::index_type i)

peel_at

template<long... Axes, class T, class E, class L, storage O> auto peel_at(const tensor< T, E, L, O > & t, typename tensor< T, E, L, O >::index_type i)

peel_at

template<long... Axes, class T, class E, class L, storage O> auto peel_at(tensor< T, E, L, O > & t, typename tensor< T, E, L, O >::index_type i, axis< Axes... >)

peel_at

template<long... Axes, class T, class E, class L, storage O> auto peel_at(const tensor< T, E, L, O > & t, typename tensor< T, E, L, O >::index_type i, axis< Axes... >)

peel

template<long... Axes, class T, class E, class L, storage O> auto peel(tensor< T, E, L, O > & t)

Build a range of sub-views by peeling Axes... of t.

Non-const t yields mutable peel; const t yields read-only peel.


peel

template<long... Axes, class T, class E, class L, storage O> auto peel(const tensor< T, E, L, O > & t)

peel

template<long... Axes, class T, class E, class L, storage O> auto peel(tensor< T, E, L, O > & t, axis< Axes... >)

peel

template<long... Axes, class T, class E, class L, storage O> auto peel(const tensor< T, E, L, O > & t, axis< Axes... >)

peel_of

template<size_t... Axes, class MD> peel_range< MD, storage::view, Axes... > peel_of(const MD & m)

Build a range of sub-views over a raw mdspan.


peel_front

template<long N, class T, class E, class L, storage O> auto peel_front(tensor< T, E, L, O > & t)

Peel the FIRST N axes -> a range of sub-views over the rest — the runtime-batch-rank half of (*batch, *spatial, C).

N is signed: peel_front<3> peels 3 leading dims; peel_front<-1> keeps the last axis (peels all but it), so negative = "keep the last |N|".


peel_front

template<long N, class T, class E, class L, storage O> auto peel_front(const tensor< T, E, L, O > & t)

peel_front_at

template<long N, class T, class E, class L, storage O> auto peel_front_at(tensor< T, E, L, O > & t, typename tensor< T, E, L, O >::index_type i)

The i-th sub-view obtained by peeling the first N axes (grid-stride style).


peel_front_at

template<long N, class T, class E, class L, storage O> auto peel_front_at(const tensor< T, E, L, O > & t, typename tensor< T, E, L, O >::index_type i)

size_front

template<long N, class T, class E, class L, storage O> tensor< T, E, L, O >::index_type size_front(const tensor< T, E, L, O > & t)

The number of sub-views peel_front<N>(t) would yield — the product of the peeled leading extents — computed directly, without materialising the range.

Same signed N as peel_front: size_front<3>(t) multiplies the first 3 extents; size_front<-2>(t) the all-but-last-two (the flattened batch count of a (*batch, C, C) tensor).


operator+

template<class S, class T, class E, class L, storage O, enable_if_t< is_arithmetic< S >::value, int > = 0> auto operator+(S s, const tensor< T, E, L, O > & a)

operator*

template<class S, class T, class E, class L, storage O, enable_if_t< is_arithmetic< S >::value, int > = 0> auto operator*(S s, const tensor< T, E, L, O > & a)

operator-

template<class S, class T, class E, class L, storage O, enable_if_t< is_arithmetic< S >::value, int > = 0> auto operator-(S s, const tensor< T, E, L, O > & a)

operator/

template<class S, class T, class E, class L, storage O, enable_if_t< is_arithmetic< S >::value, int > = 0> auto operator/(S s, const tensor< T, E, L, O > & a)

operator-

template<class T, class E, class L, storage O> auto operator-(const tensor< T, E, L, O > & a)

operator~

template<class T, class E, class L, storage O, enable_if_t< is_integral< T >::value, int > = 0> auto operator~(const tensor< T, E, L, O > & a)

sum

template<class Acc = void, class T, class E, class L, storage O> auto sum(const tensor< T, E, L, O > & a)

Sum of all elements (empty -> 0).

Accumulates in the reduce type (double for small floats), result cast to T; sum<Acc>(a) returns Acc.


prod

template<class Acc = void, class T, class E, class L, storage O> auto prod(const tensor< T, E, L, O > & a)

Product of all elements (empty -> 1).

Accumulates in the reduce type, result cast to T; prod<Acc>(a) returns Acc.


max

template<class Acc = void, class T, class E, class L, storage O> auto max(const tensor< T, E, L, O > & a)

Maximum element.

Requires a non-empty tensor. Result type T (max<Acc>(a) returns Acc).


min

template<class Acc = void, class T, class E, class L, storage O> auto min(const tensor< T, E, L, O > & a)

Minimum element.

Requires a non-empty tensor. Result type T (min<Acc>(a) returns Acc).


mean

template<long... Axes, class T, class E, class L, storage O, class R = reduce_type_t<T>, enable_if_t<(sizeof...(Axes) > 0) &&_md::reduced_extents< E, Axes... >::rank_dynamic()==0, int > = 0> auto mean(const tensor< T, E, L, O > & a)

Mean over the named axes -> a lower-rank tensor (sum / reduced count).

For a floating T, accumulates in the reduce type and the result is cast to T. For an INTEGER T the result element type is double (numpy: integer mean is float64; divides in double, not truncating). mean<Acc, Axes...>(a) makes Acc both the accumulator and result type.


mean

template<long... Axes, class T, class E, class L, storage O, enable_if_t<(sizeof...(Axes) > 0) &&_md::reduced_extents< E, Axes... >::rank_dynamic()==0, int > = 0> auto mean(const tensor< T, E, L, O > & a, axis< Axes... >)

mean

template<class Acc, long... Axes, class T, class E, class L, storage O, enable_if_t<(sizeof...(Axes) > 0) &&_md::reduced_extents< E, Axes... >::rank_dynamic()==0, int > = 0> auto mean(const tensor< T, E, L, O > & a, axis< Axes... >)

dot

template<class Acc = void, class Ta, class Ea, class La, storage Oa, class Tb, class Eb, class Lb, storage Ob> auto dot(const tensor< Ta, Ea, La, Oa > & a, const tensor< Tb, Eb, Lb, Ob > & b)

Inner product over matching extents.

Accumulates in the reduce type of the promoted element type (double for small floats), result cast to promote(Ta,Tb); dot<Acc>(a, b) returns Acc.


sqnorm

template<class Acc = void, class T, class E, class L, storage O> auto sqnorm(const tensor< T, E, L, O > & a)

Squared Euclidean norm — the sum of squares Σ aᵢ², over ALL axes.

Just dot(a, a): accumulates in the reduce type, result cast to the element type (sqnorm<Acc>(a) accumulates AND returns Acc).


norm

template<class Acc = void, class T, class E, class L, storage O> auto norm(const tensor< T, E, L, O > & a)

Euclidean (L2) norm √Σ aᵢ², over ALL axes.

Accumulates the squares in the reduce type and takes the root there, then casts to the result type: a floating element type keeps its type, an INTEGER one yields double (numpy/mean rule). norm<Acc>(a) makes Acc accumulator AND result.


norm

template<long... Axes, class T, class E, class L, storage O, class Res = _mean_result_t<T>, class R = reduce_type_t<T>, class D = conditional_t<is_floating_point<R>::value, R, double>, enable_if_t<(sizeof...(Axes) > 0) &&_md::reduced_extents< E, Axes... >::rank_dynamic()==0, int > = 0> auto norm(const tensor< T, E, L, O > & a)

norm

template<class Acc, long... Axes, class T, class E, class L, storage O, enable_if_t<(sizeof...(Axes) > 0) &&_md::reduced_extents< E, Axes... >::rank_dynamic()==0, int > = 0> auto norm(const tensor< T, E, L, O > & a)

norm

template<long... Axes, class T, class E, class L, storage O, enable_if_t<(sizeof...(Axes) > 0) &&_md::reduced_extents< E, Axes... >::rank_dynamic()==0, int > = 0> auto norm(const tensor< T, E, L, O > & a, axis< Axes... >)

norm

template<class Acc, long... Axes, class T, class E, class L, storage O, enable_if_t<(sizeof...(Axes) > 0) &&_md::reduced_extents< E, Axes... >::rank_dynamic()==0, int > = 0> auto norm(const tensor< T, E, L, O > & a, axis< Axes... >)

normalize

template<class T, class E, class L, storage O> auto normalize(const tensor< T, E, L, O > & a)

Out-of-place unit vector a / norm(a) -> a NEW dense tensor (static shape -> stack, dynamic -> heap).

The result element type is floating (integer input -> double, like norm). A zero vector yields NaNs (no epsilon — exact math; add one at the call site if you need it).


normalize

template<class T, class E, class L, storage O, class D> auto & normalize(const tensor< T, E, L, O > & a, into_t< D > out)

normalize(a, into(y)) — the unit vector into a caller buffer y.


normalize

template<long... Axes, class T, class E, class L, storage O, enable_if_t<(sizeof...(Axes) > 0), int > = 0> auto normalize(const tensor< T, E, L, O > & a)

normalize<Axes...>(a) — unit vectors along the named axes: each element divided by the L2 norm over those axes (keepdim broadcast).

Floating result (integer -> double). Axes distinct & ascending (numpy-normalised).


normalize

template<long... Axes, class T, class E, class L, storage O, enable_if_t<(sizeof...(Axes) > 0), int > = 0> auto normalize(const tensor< T, E, L, O > & a, axis< Axes... >)

cross

template<class Ta, class Ea, class La, storage Oa, class Tb, class Eb, class Lb, storage Ob> auto cross(const tensor< Ta, Ea, La, Oa > & a, const tensor< Tb, Eb, Lb, Ob > & b)

3D cross product a × b -> a NEW stack 3-vector of promote(Ta,Tb).

Both operands are rank-1, length 3. In place: the member a.cross_(b) (a becomes a × b). Into a preallocated slot: cross(a, b, into(y)).


cross

template<class Ta, class Ea, class La, storage Oa, class Tb, class Eb, class Lb, storage Ob, class D> auto & cross(const tensor< Ta, Ea, La, Oa > & a, const tensor< Tb, Eb, Lb, Ob > & b, into_t< D > out)

cross(a, b, into(y)) — the cross product into a caller buffer y (rank-1, length 3); y may alias a or b.

This is ff's "crossto".


allclose

template<class Ta, class Ea, class La, storage Oa, class Tb, class Eb, class Lb, storage Ob> bool allclose(const tensor< Ta, Ea, La, Oa > & a, const tensor< Tb, Eb, Lb, Ob > & b, double rtol = 1e-5, double atol = 1e-8)

True if every element satisfies |a-b| <= atol + rtol*|b| (numpy allclose; broadcasts, computes in the compute type).


minimum

template<class Ta, class Ea, class La, storage Oa, class Tb, class Eb, class Lb, storage Ob> auto minimum(const tensor< Ta, Ea, La, Oa > & a, const tensor< Tb, Eb, Lb, Ob > & b)

maximum

template<class Ta, class Ea, class La, storage Oa, class Tb, class Eb, class Lb, storage Ob> auto maximum(const tensor< Ta, Ea, La, Oa > & a, const tensor< Tb, Eb, Lb, Ob > & b)

minimum

template<class T, class E, class L, storage O, class S, enable_if_t< is_arithmetic< S >::value, int > = 0> auto minimum(const tensor< T, E, L, O > & a, S s)

maximum

template<class T, class E, class L, storage O, class S, enable_if_t< is_arithmetic< S >::value, int > = 0> auto maximum(const tensor< T, E, L, O > & a, S s)

minimum

template<class Ta, class Ea, class La, storage Oa, class Tb, class Eb, class Lb, storage Ob, class D> auto & minimum(const tensor< Ta, Ea, La, Oa > & a, const tensor< Tb, Eb, Lb, Ob > & b, into_t< D > out)

maximum

template<class Ta, class Ea, class La, storage Oa, class Tb, class Eb, class Lb, storage Ob, class D> auto & maximum(const tensor< Ta, Ea, La, Oa > & a, const tensor< Tb, Eb, Lb, Ob > & b, into_t< D > out)

minimum

template<class T, class E, class L, storage O, class S, class D, enable_if_t< is_arithmetic< S >::value, int > = 0> auto & minimum(const tensor< T, E, L, O > & a, S s, into_t< D > out)

maximum

template<class T, class E, class L, storage O, class S, class D, enable_if_t< is_arithmetic< S >::value, int > = 0> auto & maximum(const tensor< T, E, L, O > & a, S s, into_t< D > out)

clamp

template<class T, class E, class L, storage O> auto clamp(const tensor< T, E, L, O > & a, T lo, T hi)

clamp(a, lo, hi) -> a new tensor with each element clamped; clamp(a, lo, hi, into(y)) writes into y.


clamp

template<class T, class E, class L, storage O, class D> auto & clamp(const tensor< T, E, L, O > & a, T lo, T hi, into_t< D > out)

mean

template<class Acc = void, class T, class E, class L, storage O> auto mean(const tensor< T, E, L, O > & a)

Arithmetic mean of all elements.

For a floating T, accumulates in the reduce type (double for small floats) and the result is cast to T. For an INTEGER T the result is double (numpy: integer mean is float64; the division runs in double, not truncating integer division). mean<Acc>(a) makes Acc both the accumulator and the result type.


dot

class Ea class La storage Oa class Tb class Eb class Lb storage Ob class D auto & dot(const tensor< Ta, Ea, La, Oa > & a, const tensor< Tb, Eb, Lb, Ob > & b, into_t< D > out)

storage_is_owning

constexpr noexcept

constexpr constexpr bool storage_is_owning(storage o) noexcept

Whether the mode owns (and therefore allocates) its storage.


storage_is_view

constexpr noexcept

constexpr constexpr bool storage_is_view(storage o) noexcept

Whether the mode is a non-owning view (view/gpu_view/pinned_view/ mapped_view) — the pointer-wrapping modes (vs stack's inline array).


storage_is_device

constexpr noexcept

constexpr constexpr bool storage_is_device(storage o) noexcept

Whether the storage lives in device (GPU) memory (owning or view).


storage_is_host_accessible

constexpr noexcept

constexpr constexpr bool storage_is_host_accessible(storage o) noexcept

Whether the storage is dereferenceable from the host.


storage_view_of

constexpr noexcept

constexpr constexpr storage storage_view_of(storage o) noexcept

The non-owning VIEW kind that preserves a source's memory space: a device source (gpu/gpu_view) -> gpu_view, a pinned/mapped source -> pinned_view/mapped_view, anything else -> view.

Every view-producing op (slice / permute / peel / reshape / at) tags its result with this so a view never loses (or misreports) its space.


storage_resolve

constexpr noexcept

constexpr constexpr storage storage_resolve(storage o, bool static_shape) noexcept

Resolve a factory's ownership: an explicitly named mode passes through, storage_deduce becomes stack for a static shape / heap for a dynamic one.


as_tensor

template<storage OW = storage::view, class MD> tensor< typename MD::element_type, typename MD::extents_type, typename MD::layout_type, OW > as_tensor(const MD & m)

Wrap any cuda::std::mdspan (e.g.

a submdspan result) as a non-owning [tny::tensor](#tensor) view, so the tensor API applies to it.


fetch_add

noexcept

template<class T> void fetch_add(T * p, T v) noexcept

Accumulate v into *p, atomic on the device only.

INTERNAL primitive behind the atomic accumulate ops — prefer a.atomic_add_(x) / t.at(i...).atomic_add_(v) in user code.

The scatter/"push" write: on the device many threads accumulate into overlapping outputs, which a plain += would race. Device -> atomicAdd (double needs sm_60+, __half sm_70+; not all integer widths have an overload — that surfaces as an nvcc error at instantiation).

WARNING: on the host this is a plain *p += v — NOT atomic. A push kernel parallelised with std::thread over overlapping outputs races; guard those writes yourself (per-thread partials, a mutex, or std::atomic_ref).


into

noexcept

template<class T, class E, class L, storage O> into_t< tensor< T, E, L, O > > into(tensor< T, E, L, O > & d) noexcept

into(y) — the output-destination tag: pass it as the last argument to an out-of-place math producer (a.add(b, into(y)), cross(a,b,into(y)), exp(a, into(y)), …) to write the result into y (one fused pass, no allocation) and get y& back, instead of a freshly allocated result.


reindex

template<class Idx2, class T, class E, class L, storage O> auto reindex(tensor< T, E, L, O > & t)

Free forms of reindex/index_fits — deduce the tensor, so a type-dependent receiver avoids .template: reindex<int32_t>(t), index_fits<int32_t>(t).

(Idx2 is a TYPE, so there is no value form.)


reindex

template<class Idx2, class T, class E, class L, storage O> auto reindex(const tensor< T, E, L, O > & t)

index_fits

template<class Idx2, class T, class E, class L, storage O> bool index_fits(const tensor< T, E, L, O > & t)

wrap

template<class Layout = ccontiguous, storage Space = storage::view, class T, class Shape> tensor< T, Shape, Layout, storage_view_of(Space)> wrap(T * p, Shape e, storage_c< Space > = {})

Wrap p as a non-owning view with a contiguous layout (default C-order).

This is the factory; the view<T,E> alias is the type it produces, and the member t.view() re-views an existing tensor.

MEMORY SPACE: p is a host pointer unless a trailing storage_c<Space>{} (or storage_v<Space>) tag names where it lives — pass the plain BACKEND the memory is in ([storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947) for a device pointer, [storage::pinned](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a8a4f12ef77f9e30413cabd15cf16c913)/[storage::mapped](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a55c0eb766bdf4045fa0997d162971e31) for page-locked host memory). Since wrap always yields a VIEW, the space folds to its view kind (gpu -> gpu_view, …) via storage_view_of — you never spell the _view kinds. Symmetric with as_anyrank<Space> / from_dlpack<T,Space>.


wrap

template<storage Space = storage::view, class T, class Shape> tensor< T, Shape, layout_stride, storage_view_of(Space)> wrap(T * p, Shape e, array< typename Shape::index_type, Shape::rank()> st, storage_c< Space > = {})

Wrap p as a non-owning view with explicit runtime strides (a layout_stride view).

Pass one stride per dimension — an array or a braced list — in ELEMENTS; strides may be negative (a reversed view).

wrap(p, shape<2,3>{}, {3, 1}) is the row-major view; {1, 2} the column-major one. For strides known at compile time pass a strides<S...>{} instead (overload below) so they fold into the type. A trailing storage_c<Space>{} tags the memory space (default host; the plain backend folds to its view kind, e.g. [storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947) -> gpu_view).

wrap TRUSTS the strides you give it: a stride 0 (or a stride smaller than an inner extent) makes a SELF-OVERLAPPING view where several indices alias one element. Reading such a view is fine (that is how a broadcast works), but an in-place write into it (v.add_(b), v.iota_(...)) applies the update to the same element repeatedly — a host-debug check rejects an in-place write whose destination has an extent > 1 axis with stride 0. clone() to a dense tensor first if you need to write.


wrap

template<int64_t... Strides, storage Space = storage::view, class T, class Shape> tensor< T, Shape, strides< Strides... >, storage_view_of(Space)> wrap(T * p, Shape e, strides< Strides... >, storage_c< Space > = {})

Wrap p as a non-owning view with per-dimension compile-time strides (may be negative): pass a strides<S...>{} as the third argument.

wrap(p, shape<3,3>{}, strides<4,1>{}) folds the strides into the type (strides<S...> layout, EBO). Every stride must be a compile-time value — a strides<...> tag is a stateless layout, so it cannot carry runtime strides. For a mix of static and runtime strides, use the template form below; for all-runtime strides the {s...} overload above (a layout_stride view) is simplest.


wrap

template<int64_t S0, int64_t... Srest, storage Space = storage::view, class T, class Shape> tensor< T, Shape, strides< S0, Srest... >, storage_view_of(Space)> wrap(T * p, Shape e, array< typename Shape::index_type, strides< S0, Srest... >::ndyn()> dyn, storage_c< Space > = {})

Wrap p with a mix of static and runtime strides — the exact analogue of shape<-1,2,3,-1>{d0,d1} for strides.

Give the per-dim pattern as template args (a compile-time stride, or dynamic_stride for a runtime one) and the runtime strides for the dynamic_stride slots as a braced list, in order:

wrap<dynamic_stride, 1>(ptr, shape<3,3>{}, {4});   // outer=4 (runtime), inner=1 (folds)
wrap<dynamic_stride, dynamic_stride>(ptr, sh, {4,1}); // both runtime (a strides<> layout)
The static slots fold into the type; only the runtime ones are stored. A trailing storage_c<Space>{} tags the memory space (default host; the plain backend folds to its view kind, e.g. [storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947) -> gpu_view).


make_view

template<class Layout = ccontiguous, storage Space = storage::view, class T, class Shape> auto make_view(T * p, Shape e, storage_c< Space > tag = {})

make_view<L>(ptr, extents) — a non-owning view (alias of wrap).

Takes the same optional trailing storage_c<Space>{} memory-space tag.


empty

template<class T = float, storage O = storage_deduce, class Layout = ccontiguous, class Shape, enable_if_t< storage_resolve(O, Shape::rank_dynamic()==0)==storage::stack, int > = 0> auto empty(Shape = Shape{})

empty<T>(extents) — a new UNINITIALISED tensor.

The one factory the make_* family fuses into: ownership is deduced from the shape (fully static -> stack (host+device); any dynamic extent -> heap (host)) unless a backend is named — empty<T, [storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)>(extents), or the value-tag spelling empty<T>(extents, storage_c<[storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)>{}). gpu/pinned/mapped require <[teeny/cuda.h](#cudah)> (their storage lives there). T defaults to float. Split by the resolved ownership so the stack case stays _TNY_API (host+device) while the allocating cases are _TNY_HOST.


empty

template<class T = float, class Layout = ccontiguous, class Shape, storage O> auto empty(Shape e, storage_c< O >)

Value-tag backend form: empty<T>(extents, storage_c<[storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)>{}).

Always _TNY_HOST (a host-side convenience); for a device-usable static-shape build spell the backend as a template arg — empty<T, [storage::stack](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508afac2a47adace059aff113283a03f6760)>(extents).


make_local

template<class T = float, class Layout = ccontiguous, class Shape> auto make_local(Shape = Shape{})

make_local<T>(extents) — a stack-owned tensor (static shape).

T defaults to float (numpy's default float dtype). Thin spelling of empty<T, [storage::stack](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508afac2a47adace059aff113283a03f6760)>.


make_heap

template<class T = float, class Layout = ccontiguous, class Shape> auto make_heap(Shape e)

make_heap<T>(extents) — a heap-owned tensor (host, move-only).

T defaults to float. Thin spelling of empty<T, [storage::heap](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a4d4a9aa362b6ffe089fd2e992ccf4f5f)>.


full

template<class T = void, storage O = storage_deduce, class Layout = ccontiguous, class Shape, class V, class ET = conditional_t<is_same<T, void>::value, V, T>, enable_if_t< storage_resolve(O, Shape::rank_dynamic()==0)==storage::stack, int > = 0> auto full(Shape e, V v)

full(extents, v) — a new tensor filled with v.

The element type defaults to the value's type (numpy/pytorch: full(s, 3) is int, full(s, 3.0) is float); pass full<T>(...) to override. Unlike the value-less zeros/ones (which default to float), there is a value here to infer from, so we do.

Ownership is deduced from the shape (static -> stack, dynamic -> heap) unless a backend is named — full<T, [storage::pinned](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a8a4f12ef77f9e30413cabd15cf16c913)>(s, v) or the value-tag full<T>(s, v, storage_c<[storage::pinned](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a8a4f12ef77f9e30413cabd15cf16c913)>{}). Because it fills host-side, only host-accessible backends (stack/heap/pinned/mapped) are allowed; a device (gpu) fill needs a kernel launch, so it is a static_assert steering you to to<[storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)>(full<T>(s, v)). Split by resolved ownership for the _TNY_API/_TNY_HOST annotation.


full

template<class T = void, class Layout = ccontiguous, class Shape, class V, storage O> auto full(Shape e, V v, storage_c< O >)

Value-tag backend form: full<T>(extents, v, storage_c<[storage::pinned](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a8a4f12ef77f9e30413cabd15cf16c913)>{}).


zeros

template<class T = float, storage O = storage_deduce, class Layout = ccontiguous, class Shape, enable_if_t< storage_resolve(O, Shape::rank_dynamic()==0)==storage::stack, int > = 0> auto zeros(Shape e)

zeros<T>(extents) / ones<T>(extents) — a new tensor of 0s / 1s.

T defaults to float. Same ownership deduction and backend selector as full (a device backend static_asserts — fill via to<[storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)>(zeros<T>(shape))); the annotation is split to match the full overload each routes to.


zeros

template<class T = float, class Layout = ccontiguous, class Shape, storage O> auto zeros(Shape e, storage_c< O >)

ones

template<class T = float, storage O = storage_deduce, class Layout = ccontiguous, class Shape, enable_if_t< storage_resolve(O, Shape::rank_dynamic()==0)==storage::stack, int > = 0> auto ones(Shape e)

ones

template<class T = float, class Layout = ccontiguous, class Shape, storage O> auto ones(Shape e, storage_c< O >)

arange

template<class T = int64_t, storage O = storage_deduce> auto arange(long n)

arange<T>(n) — a 1-D tensor [0, 1, ..., n-1] (heap, host).

T defaults to int64_t (an integer range, like numpy [arange(n)](#arange)). A host-accessible backend may be named — arange<T, [storage::pinned](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a8a4f12ef77f9e30413cabd15cf16c913)>(n) or arange<T>(n, storage_c<[storage::pinned](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a8a4f12ef77f9e30413cabd15cf16c913)>{}); a device backend static_asserts (use to<[storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)>(arange<T>(n))). The static-N forms below stay stack.


arange

template<class T = int64_t, storage O> auto arange(long n, storage_c< O >)

Value-tag backend form: arange<T>(n, storage_c<[storage::pinned](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a8a4f12ef77f9e30413cabd15cf16c913)>{}).


arange

template<class T = int64_t, long N> auto arange()

Static arange<T, N>() — a stack [0..N-1] (host+device, folds).


arange

template<class T = int64_t, class V, V N> auto arange(integral_constant< V, N >)

arange<T>(Int<N>()) — the static form spelled with a static integer.

Variables

Return Name Description
constexpr ellipsis_t ellipsis constexpr
constexpr ellipsis_t etc constexpr
constexpr full_extent_t all constexpr Keep-this-axis marker for slicing (an alias of full_extent).
constexpr copy_meta_t copy_meta constexpr
constexpr bool narrow_index constexpr The spelling for dispatch_rank's opt-in flag: dispatch_rank<narrow_index>(at, f).
constexpr none_t none constexpr
constexpr none_t newaxis constexpr
constexpr int64_t dynamic_stride constexpr Per-dimension dynamic-stride sentinel.
constexpr storage storage_deduce constexpr Factory sentinel meaning "deduce the ownership from the shape" — a fully static shape -> stack (host+device), any dynamic extent -> heap (host).
constexpr storage_c< O > storage_v constexpr A ready-made storage_c<O> VALUE — the no-braces spelling of the value tag: wrap(p, e, storage_v<[storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)>) instead of storage_c<[storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)>{}.
constexpr bool is_view_v constexpr Compile-time memory-space traits (SFINAE-friendly free forms of the tensor's is_view/is_device/… members): is_view_v<decltype(x)>.
constexpr bool is_owning_v constexpr
constexpr bool is_device_v constexpr
constexpr bool is_host_accessible_v constexpr

ellipsis

constexpr

constexpr ellipsis_t ellipsis {}

etc

constexpr

constexpr ellipsis_t etc = 

all

constexpr

constexpr full_extent_t all {}

Keep-this-axis marker for slicing (an alias of full_extent).


copy_meta

constexpr

constexpr copy_meta_t copy_meta {}

narrow_index

constexpr

constexpr bool narrow_index = true

The spelling for dispatch_rank's opt-in flag: dispatch_rank<narrow_index>(at, f).


none

constexpr

constexpr none_t none {}

newaxis

constexpr

constexpr none_t newaxis = 

dynamic_stride

constexpr

constexpr int64_t dynamic_stride = numeric_limits<int64_t>()

Per-dimension dynamic-stride sentinel.

Strides are signed: a negative stride is a legitimate value (reversed / flipped views, and DLPack tensors carry them). So — unlike shape<...>, where -1 marks a dynamic extent — we cannot use -1 to mean "runtime" for a stride. Instead a reserved out-of-band value (INT64_MIN) marks a dynamic stride, leaving every ordinary stride (including negatives) expressible.


storage_deduce

constexpr

constexpr storage storage_deduce = static_cast<>(-1)

Factory sentinel meaning "deduce the ownership from the shape" — a fully static shape -> stack (host+device), any dynamic extent -> heap (host).

It is the default backend of empty (and the creation factories), out of the enum's normal range so it never names storage.


storage_v

constexpr

constexpr storage_c< O > storage_v {}

A ready-made storage_c<O> VALUE — the no-braces spelling of the value tag: wrap(p, e, storage_v<[storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)>) instead of storage_c<[storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)>{}.


is_view_v

constexpr

constexpr bool is_view_v = Tn::is_view

Compile-time memory-space traits (SFINAE-friendly free forms of the tensor's is_view/is_device/… members): is_view_v<decltype(x)>.


is_owning_v

constexpr

constexpr bool is_owning_v = Tn::is_owning

is_device_v

constexpr

constexpr bool is_device_v = Tn::is_device

is_host_accessible_v

constexpr

constexpr bool is_host_accessible_v = Tn::is_host_accessible

anyrank

#include <dynamic.h>
template<class T, class offset_t = int64_t, class Meta = _meta_store<offset_t, TNY_MAX_RANK>, storage Space = storage::view, class Tail = shape<>, class TailS = _runtime_strides_t<Tail::rank()>, class Head = shape<>, class HeadS = _runtime_strides_t<Head::rank()>>
struct anyrank

Defined in include/teeny/dynamic.h:241

A rank-erased tensor for the host/ndarray dispatch boundary.

Holds a data pointer, a runtime ndim, and 1-D shape/stride tensors (Meta). as_anyrank(...)wraps the caller's arrays with no copy (a _meta_view store, HOST only) — the default; as_anyrank(..., copy_meta) COPIES them into an INLINE TNY_MAX_RANK store, so the carrier is trivially copyable and passes into a CUDA kernel by value (device_passable == true).

You do NOT compute on it — it is a doorway, not a room. Turn it into a statically-typed view at the boundary and compute on that:

  • fixed<R>() — force a known total rank R.

  • dispatch_rank(...) — pick R from the runtime ndim.

  • peel_front<-Sr>() — the batch idiom: peel the runtime number of leading batch dims, keep the trailing Sr "interesting" dims STATIC. One kernel per Sr. NB the template arg is NEGATIVE: pass -Sr (peel_front<-2>() keeps the last two dims), matching the tensor's peel_front sign rule — a positive front-count would leave a runtime rank, which can't be a static view (asserted).

Deliberately no add_/mul_/etc.: a runtime-rank arithmetic path would loop over ndim (killing folding) or dispatch to every rank (the bloat peel_front<-Sr> avoids). Do host-side math on a fixed<R>()/peel_front<-Sr>() view instead.

List of all members

Name Kind Owner
data variable Declared here
shape variable Declared here
stride variable Declared here
ndim variable Declared here
size function Declared here
step function Declared here
fixed function Declared here
peel_front_at function Declared here
peel_front_at function Declared here
peel_front_at function Declared here
peel_front_at function Declared here
peel_front function Declared here
size_front function Declared here
tail_rank variable Declared here
head_rank variable Declared here
ends_rank variable Declared here
space variable Declared here
is_device variable Declared here
view_space variable Declared here
max_rank variable Declared here
device_passable variable Declared here
tail_type typedef Declared here
tail_stride_type typedef Declared here
head_type typedef Declared here
head_stride_type typedef Declared here

Public Attributes

Return Name Description
T * data
Meta shape
Meta stride
int ndim

data

T * data = nullptr

Defined in include/teeny/dynamic.h:242


shape

Meta shape {}

Defined in include/teeny/dynamic.h:243


stride

Meta stride {}

Defined in include/teeny/dynamic.h:244


ndim

int ndim = 0

Defined in include/teeny/dynamic.h:245

Public Methods

Return Name Description
offset_t size const inline noexcept
offset_t step const inline noexcept
_ends_cell< T, offset_t, R, Head, HeadS, Tail, TailS, view_space > fixed const inline View this tensor as a fixed rank R (requires ndim == R).
auto peel_front_at const inline The lin-th sub-view keeping the last \|N\| axes static (grid-stride style).
auto peel_front_at const inline The lin-th cell peeled DIRECTLY to a target trailing shape — fuses peel_front_at<-NewE::rank()>(lin).recast<NewE, NewL>() into one call, so no separate recast in the caller.
auto peel_front_at const inline Value-form twins (no .template on a dependent receiver): pass the target shape (and optional layout) as a tag — at.peel_front_at(i, shape<-1,c,c>{}) / at.peel_front_at(i, shape<-1,c,c>{}, ccontiguous{}).
auto peel_front_at const inline
anyrank_front< T, offset_t, Meta, Space, Tail, TailS, static_cast< size_t >(N< 0 ? -N :0)> peel_front const inline Peel the leading batch axes -> an iterable of fixed-rank-\|N\| sub-views (range-for, [size()](#size-1), operator[]).
offset_t size_front const inline noexcept The number of cells peel_front<N>() would yield — the product of the peeled leading (batch) extents — computed directly, without building the range.

size

const inline noexcept

inline offset_t size(int i) const noexcept

Defined in include/teeny/dynamic.h:297


step

const inline noexcept

inline offset_t step(int i) const noexcept

Defined in include/teeny/dynamic.h:298


fixed

const inline

template<size_t R> inline _ends_cell< T, offset_t, R, Head, HeadS, Tail, TailS, view_space > fixed() const

Defined in include/teeny/dynamic.h:335

View this tensor as a fixed rank R (requires ndim == R).

BOTH the static Head (first head_rank dims) and Tail (last tail_rank) fold — the full-rank window has a compile-time left edge, so the Head anchors.


peel_front_at

const inline

template<long N> inline auto peel_front_at(offset_t lin) const

Defined in include/teeny/dynamic.h:361

The lin-th sub-view keeping the last |N| axes static (grid-stride style).

N is negative — matching the tensor's peel_front, negative means "keep the last |N| dims". (A positive front-count would leave a runtime rank, which can't be a static view — hence the assert.) Follow with recast<shape<-1,...>>().


peel_front_at

const inline

template<class NewE, class NewL = keep_strides, enable_if_t< _is_extents< NewE >::value, int > = 0> inline auto peel_front_at(offset_t lin) const

Defined in include/teeny/dynamic.h:381

The lin-th cell peeled DIRECTLY to a target trailing shape — fuses peel_front_at<-NewE::rank()>(lin).recast<NewE, NewL>() into one call, so no separate recast in the caller.

NewE's rank = the number of KEPT trailing dims (the batch is the leading ndim - rank dims, decoded into the pointer); a static extent in NewE folds, a -1 extent stays dynamic (read from the carrier). (*batch, *spatial, C) -> 2-D pull with C=3 is peel_front_at<shape<-1,-1,3>>(i). Removes the hand-kept Sr == recast-shape rank invariant. STRIDES: NewL defaults to [keep_strides](#keep_strides) so the cell keeps the carrier's RUNTIME strides (layout_stride) — an anyrank has no compile-time stride info to fold. To fold the inner strides, either pass a layout (peel_front_at<shape<-1,c,c>, ccontiguous> — a debug-checked "I promise it's contiguous") or use the runtime-proven dispatch_layout on the result. UB if a baked static extent doesn't match the carrier (debug-checked in recast, same contract).


peel_front_at

const inline

template<class NewE, enable_if_t< _is_extents< NewE >::value, int > = 0> inline auto peel_front_at(offset_t lin, NewE) const

Defined in include/teeny/dynamic.h:388

Value-form twins (no .template on a dependent receiver): pass the target shape (and optional layout) as a tag — at.peel_front_at(i, shape<-1,c,c>{}) / at.peel_front_at(i, shape<-1,c,c>{}, ccontiguous{}).


peel_front_at

const inline

template<class NewE, class NewL, enable_if_t< _is_extents< NewE >::value, int > = 0> inline auto peel_front_at(offset_t lin, NewE, NewL) const

Defined in include/teeny/dynamic.h:390


peel_front

const inline

template<long N> inline anyrank_front< T, offset_t, Meta, Space, Tail, TailS, static_cast< size_t >(N< 0 ? -N :0)> peel_front() const

Defined in include/teeny/dynamic.h:398

Peel the leading batch axes -> an iterable of fixed-rank-|N| sub-views (range-for, [size()](#size-1), operator[]).

The (*batch, *spatial, C) boundary with |N| = spatial + channels: one kernel instantiation for |N|, not one per total rank. N is negative (keep the last |N| dims), as on the tensor.


size_front

const inline noexcept

template<long N> inline offset_t size_front() const noexcept

Defined in include/teeny/dynamic.h:411

The number of cells peel_front<N>() would yield — the product of the peeled leading (batch) extents — computed directly, without building the range.

N is NEGATIVE (keep the last |N| dims), the same sign as peel_front; size_front<-2>() is the flattened batch count of a (*batch, C, C) carrier.

Public Static Attributes

Return Name Description
constexpr size_t tail_rank static constexpr
constexpr size_t head_rank static constexpr
constexpr size_t ends_rank static constexpr
constexpr storage space static constexpr
constexpr bool is_device static constexpr
constexpr storage view_space static constexpr
constexpr size_t max_rank static constexpr
constexpr bool device_passable static constexpr

tail_rank

static constexpr

constexpr size_t tail_rank = Tail::rank()

Defined in include/teeny/dynamic.h:262


head_rank

static constexpr

constexpr size_t head_rank = Head::rank()

Defined in include/teeny/dynamic.h:263


ends_rank

static constexpr

constexpr size_t ends_rank =  + 

Defined in include/teeny/dynamic.h:264


space

static constexpr

constexpr storage space = Space

Defined in include/teeny/dynamic.h:273


is_device

static constexpr

constexpr bool is_device = (Space)

Defined in include/teeny/dynamic.h:274


view_space

static constexpr

constexpr storage view_space = (Space)

Defined in include/teeny/dynamic.h:276


max_rank

static constexpr

constexpr size_t max_rank =
        Meta::extents_type::static_extent(0) != dynamic_extent
            ? Meta::extents_type::static_extent(0) : size_t()

Defined in include/teeny/dynamic.h:280


device_passable

static constexpr

constexpr bool device_passable =
        (Meta::extents_type::static_extent(0) != dynamic_extent)

Defined in include/teeny/dynamic.h:294

Public Types

Name Description
tail_type
tail_stride_type
head_type
head_stride_type

tail_type

using tail_type = Tail

Defined in include/teeny/dynamic.h:258


tail_stride_type

using tail_stride_type = TailS

Defined in include/teeny/dynamic.h:259


head_type

using head_type = Head

Defined in include/teeny/dynamic.h:260


head_stride_type

using head_stride_type = HeadS

Defined in include/teeny/dynamic.h:261

anyrank_front

#include <dynamic.h>
template<class T, class offset_t, class Meta, storage Space, class Tail, class TailS, size_t Sr>
struct anyrank_front

Defined in include/teeny/dynamic.h:423

A range of fixed-rank-Sr sub-views over an anyrank's batch axes.

Inherits the carrier's Space, so each cell is a host or gpu_view view accordingly.

List of all members

Name Kind Owner
src variable Declared here
size function Declared here
operator[] function Declared here
begin function Declared here
end function Declared here
subrange function Declared here
enumerate function Declared here
MaxNb variable Declared here
Cell typedef Declared here

Public Attributes

Return Name Description
anyrank< T, offset_t, Meta, Space, Tail, TailS > src

src

anyrank< T, offset_t, Meta, Space, Tail, TailS > src

Defined in include/teeny/dynamic.h:424

Public Methods

Return Name Description
offset_t size const inline noexcept
auto operator[] const inline
iterator begin const inline
iterator end const inline
subrange_t subrange const inline
enum_range enumerate const inline

size

const inline noexcept

inline offset_t size() const noexcept

Defined in include/teeny/dynamic.h:428


operator[]

const inline

inline auto operator[](offset_t i) const

Defined in include/teeny/dynamic.h:430


begin

const inline

inline iterator begin() const

Defined in include/teeny/dynamic.h:478


end

const inline

inline iterator end() const

Defined in include/teeny/dynamic.h:479


subrange

const inline

inline subrange_t subrange(offset_t lo, offset_t hi) const

Defined in include/teeny/dynamic.h:489


enumerate

const inline

inline enum_range enumerate() const

Defined in include/teeny/dynamic.h:531

Public Static Attributes

Return Name Description
constexpr size_t MaxNb static constexpr

MaxNb

static constexpr

constexpr size_t MaxNb = <T, offset_t, Meta, Space, Tail, TailS>::max_rank

Defined in include/teeny/dynamic.h:426

Public Types

Name Description
Cell

Cell

using Cell = _tail_cell< T, offset_t, Sr, Tail, TailS, storage_view_of(Space)>

Defined in include/teeny/dynamic.h:425

coord

#include <dynamic.h>
struct coord

Defined in include/teeny/dynamic.h:503

List of all members

Name Kind Owner
ctr variable Declared here
nb variable Declared here
lin variable Declared here
operator[] function Declared here
rank function Declared here
linear function Declared here

Public Attributes

Return Name Description
const offset_t * ctr
int nb
offset_t lin

ctr

const offset_t * ctr

Defined in include/teeny/dynamic.h:504


nb

int nb

Defined in include/teeny/dynamic.h:504


lin

offset_t lin

Defined in include/teeny/dynamic.h:504

Public Methods

Return Name Description
offset_t operator[] const inline noexcept
int rank const inline noexcept
offset_t linear const inline noexcept

operator[]

const inline noexcept

inline offset_t operator[](int d) const noexcept

Defined in include/teeny/dynamic.h:505


rank

const inline noexcept

inline int rank() const noexcept

Defined in include/teeny/dynamic.h:506


linear

const inline noexcept

inline offset_t linear() const noexcept

Defined in include/teeny/dynamic.h:507

enum_iterator

#include <dynamic.h>
struct enum_iterator

Defined in include/teeny/dynamic.h:510

List of all members

Name Kind Owner
it variable Declared here
operator* function Declared here
operator++ function Declared here
operator!= function Declared here
operator== function Declared here

Public Attributes

Return Name Description
iterator it

it

iterator it

Defined in include/teeny/dynamic.h:511

Public Methods

Return Name Description
item operator* const inline
enum_iterator & operator++ inline
bool operator!= const inline
bool operator== const inline

operator*

const inline

inline item operator*() const

Defined in include/teeny/dynamic.h:512


operator++

inline

inline enum_iterator & operator++()

Defined in include/teeny/dynamic.h:513


operator!=

const inline

inline bool operator!=(const enum_iterator & o) const

Defined in include/teeny/dynamic.h:514


operator==

const inline

inline bool operator==(const enum_iterator & o) const

Defined in include/teeny/dynamic.h:515

enum_range

#include <dynamic.h>
struct enum_range

Defined in include/teeny/dynamic.h:517

List of all members

Name Kind Owner
r variable Declared here
begin function Declared here
end function Declared here
subrange function Declared here

Public Attributes

Return Name Description
anyrank_front r

r

anyrank_front r

Defined in include/teeny/dynamic.h:518

Public Methods

Return Name Description
enum_iterator begin const inline
enum_iterator end const inline
enum_subrange subrange const inline

begin

const inline

inline enum_iterator begin() const

Defined in include/teeny/dynamic.h:519


end

const inline

inline enum_iterator end() const

Defined in include/teeny/dynamic.h:520


subrange

const inline

inline enum_subrange subrange(offset_t lo, offset_t hi) const

Defined in include/teeny/dynamic.h:526

enum_subrange

#include <dynamic.h>
struct enum_subrange

Defined in include/teeny/dynamic.h:521

List of all members

Name Kind Owner
b variable Declared here
e variable Declared here
begin function Declared here
end function Declared here

Public Attributes

Return Name Description
enum_iterator b
enum_iterator e

b

enum_iterator b

Defined in include/teeny/dynamic.h:522


e

enum_iterator e

Defined in include/teeny/dynamic.h:522

Public Methods

Return Name Description
enum_iterator begin const inline
enum_iterator end const inline

begin

const inline

inline enum_iterator begin() const

Defined in include/teeny/dynamic.h:523


end

const inline

inline enum_iterator end() const

Defined in include/teeny/dynamic.h:524

item

#include <dynamic.h>
struct item

Defined in include/teeny/dynamic.h:509

List of all members

Name Kind Owner
index variable Declared here
cell variable Declared here

Public Attributes

Return Name Description
coord index
Cell cell

index

coord index

Defined in include/teeny/dynamic.h:509


cell

Cell cell

Defined in include/teeny/dynamic.h:509

iterator

#include <dynamic.h>
struct iterator

Defined in include/teeny/dynamic.h:437

List of all members

Name Kind Owner
tmpl variable Declared here
base variable Declared here
ctr variable Declared here
ext variable Declared here
str variable Declared here
nb variable Declared here
off variable Declared here
lin variable Declared here
operator* function Declared here
operator++ function Declared here
operator!= function Declared here
operator== function Declared here
index function Declared here
nbatch function Declared here
linear function Declared here

Public Attributes

Return Name Description
Cell tmpl
T * base
offset_t ctr
offset_t ext
offset_t str
int nb
offset_t off
offset_t lin

tmpl

Cell tmpl

Defined in include/teeny/dynamic.h:438


base

T * base

Defined in include/teeny/dynamic.h:439


ctr

offset_t ctr

Defined in include/teeny/dynamic.h:440


ext

offset_t ext

Defined in include/teeny/dynamic.h:441


str

offset_t str

Defined in include/teeny/dynamic.h:442


nb

int nb

Defined in include/teeny/dynamic.h:443


off

offset_t off

Defined in include/teeny/dynamic.h:444


lin

offset_t lin

Defined in include/teeny/dynamic.h:444

Public Methods

Return Name Description
Cell operator* const inline
iterator & operator++ inline
bool operator!= const inline
bool operator== const inline
offset_t index const inline noexcept
int nbatch const inline noexcept
offset_t linear const inline noexcept

operator*

const inline

inline Cell operator*() const

Defined in include/teeny/dynamic.h:445


operator++

inline

inline iterator & operator++()

Defined in include/teeny/dynamic.h:446


operator!=

const inline

inline bool operator!=(const iterator & o) const

Defined in include/teeny/dynamic.h:454


operator==

const inline

inline bool operator==(const iterator & o) const

Defined in include/teeny/dynamic.h:455


index

const inline noexcept

inline offset_t index(int d) const noexcept

Defined in include/teeny/dynamic.h:461


nbatch

const inline noexcept

inline int nbatch() const noexcept

Defined in include/teeny/dynamic.h:462


linear

const inline noexcept

inline offset_t linear() const noexcept

Defined in include/teeny/dynamic.h:463

subrange_t

#include <dynamic.h>
struct subrange_t

Defined in include/teeny/dynamic.h:484

A [lo, hi) slice of the batch cells for chunked/threaded sweeps: seed the incremental cursor once at lo, then O(1) per step.

Split [0, [size()](#size-2)) across threads/blocks; each sweeps its own chunk.

List of all members

Name Kind Owner
b variable Declared here
e variable Declared here
begin function Declared here
end function Declared here

Public Attributes

Return Name Description
iterator b
iterator e

b

iterator b

Defined in include/teeny/dynamic.h:485


e

iterator e

Defined in include/teeny/dynamic.h:485

Public Methods

Return Name Description
iterator begin const inline
iterator end const inline

begin

const inline

inline iterator begin() const

Defined in include/teeny/dynamic.h:486


end

const inline

inline iterator end() const

Defined in include/teeny/dynamic.h:487

anyshape

#include <alias.h>
template<auto... Es>
struct anyshape

Defined in include/teeny/alias.h:188

The shape spelling for the rank-erased anyrank boundary: exactly one etc marks the dynamic-rank region, the dims AFTER it are the static Tail (anchored at ndim), the dims BEFORE it are the static Head (anchored at 0).

Each non-etc slot is a per-dim static extent or -1 (dynamic), exactly like shape<...>. Hand it to as_anyrank(..., anyshape<etc,-1,-1,3>{}) or from_dlpack<T, anyshape<etc,-1,-1,3>>(m) so the peeled cells fold those inner dims — anyshape<etc,-1,-1,3> == (*batch, spatial, spatial, C=3).

A static leading Head (dims BEFORE etc) is allowed too: anyshape<A, B, etc, C, D> == (A, B, *middle, C, D) — e.g. anyshape<3, etc, 5> for (C_in=3, *spatial, C_out=5). The Head folds in fixed/dispatch_rank (full-rank materialisation); peel_front<-Sr> stays trailing-oriented (a leading Head is normally peeled into the batch).

Unlike a plain shape<...> (a concrete fixed-rank extents), an anyshape is a SPEC, not a tensor type — a runtime-rank object needs the data + runtime arrays, not just a type.

List of all members

Name Kind Owner
head typedef Declared here
tail typedef Declared here

Public Types

Name Description
head
tail

using head = typename _sp::head

Defined in include/teeny/alias.h:192


tail

using tail = typename _sp::tail

Defined in include/teeny/alias.h:193

axis

#include <alias.h>
template<long... Axes>
struct axis

Defined in include/teeny/alias.h:208

Compile-time axis selector — a value tag carrying a list of axes, the sibling of shape<...> for axis arguments.

It lets axis-taking ops be spelled by VALUE (deducing the axes from the argument type) instead of an explicit template list, so on a type-dependent receiver they need no .template: peel(t, axis<0,1>{}) == peel<0,1>(t), t.take_along(axis<0,2>{}, i, slice(1,4)) == t.take_along<0,2>(i, slice(1,4)).

Like numpy's axis: int | list[int], one variadic tag covers both a single axis (axis<0>{}) and a list (axis<0,2>{}); axes are signed (negatives count from the back, as everywhere in teeny). rank is the axis count.

List of all members

Name Kind Owner
rank variable Declared here

Public Static Attributes

Return Name Description
constexpr size_t rank static constexpr

rank

static constexpr

constexpr size_t rank = sizeof...(Axes)

Defined in include/teeny/alias.h:208

compute_type

#include <half.h>
template<class T>
struct compute_type

Defined in include/teeny/half.h:137

The type math should ACCUMULATE / compute in for element type T.

Half types compute in float (16-bit accumulation loses precision fast, the usual mixed-precision rule: accumulate wider than you store — and it lets the engines avoid depending on native half host operators). Everything else computes in itself.

List of all members

Name Kind Owner
type typedef Declared here

Public Types

Name Description
type

type

using type = T

Defined in include/teeny/half.h:137

compute_type< bfloat16 >

#include <half.h>
struct compute_type< bfloat16 >

Defined in include/teeny/half.h:139

List of all members

Name Kind Owner
type typedef Declared here

Public Types

Name Description
type

type

using type = float

Defined in include/teeny/half.h:139

compute_type< half >

#include <half.h>
struct compute_type< half >

Defined in include/teeny/half.h:138

List of all members

Name Kind Owner
type typedef Declared here

Public Types

Name Description
type

type

using type = float

Defined in include/teeny/half.h:138

copy_meta_t

#include <dynamic.h>
struct copy_meta_t

Defined in include/teeny/dynamic.h:207

Tag for as_anyrank(..., copy_meta): COPY shape/stride into an inline, device-passable store instead of wrapping the caller's arrays.

Named copy_meta, not copy: a bare copy variable in tny would, under using namespace tny, shadow an unqualified std::copy(...) call (finding a variable suppresses ADL) — a nasty surprise.

cpp_alloc

#include <storage.h>
struct cpp_alloc

Defined in include/teeny/storage.h:90

Host allocator using C++ new[] / delete[].

List of all members

Name Kind Owner
allocate function Declared here
allocate_uninit function Declared here
deallocate function Declared here

Public Static Methods

Return Name Description
T * allocate static inline
T * allocate_uninit static inline
void deallocate static inline

allocate

static inline

template<class T> static inline T * allocate(size_t n)

Defined in include/teeny/storage.h:91


allocate_uninit

static inline

template<class T> static inline T * allocate_uninit(size_t n)

Defined in include/teeny/storage.h:92


deallocate

static inline

template<class T> static inline void deallocate(T * p)

Defined in include/teeny/storage.h:93

cuda_gpu_alloc

#include <cuda.h>
struct cuda_gpu_alloc

Defined in include/teeny/cuda.h:30

Device (GPU) memory (cudaMalloc).

Not host-dereferenceable.

List of all members

Name Kind Owner
allocate function Declared here
allocate_uninit function Declared here
deallocate function Declared here

Public Static Methods

Return Name Description
T * allocate static inline
T * allocate_uninit static inline
void deallocate static inline

allocate

static inline

template<class T> static inline T * allocate(size_t n)

Defined in include/teeny/cuda.h:31


allocate_uninit

static inline

template<class T> static inline T * allocate_uninit(size_t n)

Defined in include/teeny/cuda.h:34


deallocate

static inline

template<class T> static inline void deallocate(T * p)

Defined in include/teeny/cuda.h:35

cuda_mapped_alloc

#include <cuda.h>
struct cuda_mapped_alloc

Defined in include/teeny/cuda.h:48

Page-locked + device-mapped (zero-copy) host memory (cudaHostAlloc).

List of all members

Name Kind Owner
allocate function Declared here
allocate_uninit function Declared here
deallocate function Declared here

Public Static Methods

Return Name Description
T * allocate static inline
T * allocate_uninit static inline
void deallocate static inline

allocate

static inline

template<class T> static inline T * allocate(size_t n)

Defined in include/teeny/cuda.h:49


allocate_uninit

static inline

template<class T> static inline T * allocate_uninit(size_t n)

Defined in include/teeny/cuda.h:52


deallocate

static inline

template<class T> static inline void deallocate(T * p)

Defined in include/teeny/cuda.h:53

cuda_pinned_alloc

#include <cuda.h>
struct cuda_pinned_alloc

Defined in include/teeny/cuda.h:39

Page-locked ("pinned") host memory (cudaMallocHost).

List of all members

Name Kind Owner
allocate function Declared here
allocate_uninit function Declared here
deallocate function Declared here

Public Static Methods

Return Name Description
T * allocate static inline
T * allocate_uninit static inline
void deallocate static inline

allocate

static inline

template<class T> static inline T * allocate(size_t n)

Defined in include/teeny/cuda.h:40


allocate_uninit

static inline

template<class T> static inline T * allocate_uninit(size_t n)

Defined in include/teeny/cuda.h:43


deallocate

static inline

template<class T> static inline void deallocate(T * p)

Defined in include/teeny/cuda.h:44

into_t

#include <tensor.h>
template<class D>
struct into_t

Defined in include/teeny/tensor.h:30

List of all members

Name Kind Owner
dest variable Declared here

Public Attributes

Return Name Description
D & dest

dest

D & dest

Defined in include/teeny/tensor.h:30

keep_strides

#include <layout.h>
struct keep_strides

Defined in include/teeny/layout.h:162

Sentinel Layout selector for recast<NewShape, [keep_strides](#keep_strides)>() (the default): PRESERVE the source strides (fold where the source layout makes them derivable, keep runtime otherwise).

Contrast an explicit layout — recast<NewShape, ccontiguous>() reinterprets AS that layout, deriving the strides from the extents (the "I promise this is C-contiguous" form). Not a real layout (it has no mapping) — only a recast tag.

none_t

#include <indexing.h>
struct none_t

Defined in include/teeny/indexing.h:82

Open-ended slice sentinel — teeny's None (python a[:n] / a[m:]).

slice(none, n) starts at 0, slice(m, none) runs to the end, and slice(none, none)folds to full_extent — so all == slice(none, none), keeping the axis and its static extent (all is built from it). Combined with runtime bounds it resolves at run time, so the one sentinel covers both.

A BARE noneargument to operator()/uget is a different thing: numpy newaxis (a[None]), which inserts a size-1 axis — see _is_newaxis below. newaxis is a named alias of none for that bare-argument spelling (numpy calls the same value None when it's a slice bound and np.newaxis when it's inserting an axis; teeny's none/newaxis mirror that with one type).

owning_storage

#include <storage.h>
template<class T, class Alloc>
struct owning_storage

Defined in include/teeny/storage.h:107

Generic owning storage (move-only, no ref-counting), parameterised by an allocator policy.

Shared by all owning storage modes.

List of all members

Name Kind Owner
p variable Declared here
owning_storage function Declared here
owning_storage function Declared here
owning_storage function Declared here
owning_storage function Declared here
owning_storage function Declared here
data function Declared here
data function Declared here

Public Attributes

Return Name Description
T * p

p

T * p = nullptr

Defined in include/teeny/storage.h:108

Public Methods

Return Name Description
owning_storage Defaulted constructor.
owning_storage inline explicit
owning_storage inline
owning_storage Deleted constructor.
owning_storage inline noexcept
T * data inline noexcept
const T * data const inline noexcept

owning_storage

owning_storage() = default

Defined in include/teeny/storage.h:109

Defaulted constructor.


owning_storage

inline explicit

inline explicit owning_storage(size_t n)

Defined in include/teeny/storage.h:110


owning_storage

inline

inline owning_storage(size_t n, _uninit_t)

Defined in include/teeny/storage.h:111


owning_storage

owning_storage(const owning_storage &) = delete

Defined in include/teeny/storage.h:112

Deleted constructor.


owning_storage

inline noexcept

inline owning_storage(owning_storage && o) noexcept

Defined in include/teeny/storage.h:114


data

inline noexcept

inline T * data() noexcept

Defined in include/teeny/storage.h:120


data

const inline noexcept

inline const T * data() const noexcept

Defined in include/teeny/storage.h:121

peel_range

#include <iterate.h>
template<class MD, storage OW, size_t... Axes>
struct peel_range

Defined in include/teeny/iterate.h:151

A range of sub-views obtained by peeling Axes....

Supports [size()](#size-3), random-access operator[] (grid-stride loops), range-for (an INCREMENTAL cursor — #110 — that advances the pointer instead of re-decoding each step, and builds the loop-invariant sub-view mapping once), and subrange(lo,hi) for chunked/threaded sweeps.

List of all members

Name Kind Owner
src variable Declared here
size function Declared here
operator[] function Declared here
begin function Declared here
end function Declared here
subrange function Declared here
enumerate function Declared here
Nd variable Declared here
index_type typedef Declared here
Cell typedef Declared here
El typedef Declared here

Public Attributes

Return Name Description
MD src

src

MD src

Defined in include/teeny/iterate.h:154

Public Methods

Return Name Description
index_type size const inline noexcept
auto operator[] const inline
iterator begin const inline
iterator end const inline
subrange_t subrange const inline
enum_range enumerate const inline

size

const inline noexcept

inline index_type size() const noexcept

Defined in include/teeny/iterate.h:156


operator[]

const inline

inline auto operator[](index_type i) const

Defined in include/teeny/iterate.h:164


begin

const inline

inline iterator begin() const

Defined in include/teeny/iterate.h:199


end

const inline

inline iterator end() const

Defined in include/teeny/iterate.h:200


subrange

const inline

inline subrange_t subrange(index_type lo, index_type hi) const

Defined in include/teeny/iterate.h:210


enumerate

const inline

inline enum_range enumerate() const

Defined in include/teeny/iterate.h:245

Public Static Attributes

Return Name Description
constexpr size_t Nd static constexpr

Nd

static constexpr

constexpr size_t Nd = sizeof...(Axes)

Defined in include/teeny/iterate.h:153

Public Types

Name Description
index_type
Cell
El

index_type

using index_type = typename MD::index_type

Defined in include/teeny/iterate.h:152


Cell

using Cell = decltype(_md::peel_at_ow< OW, Axes... >(declval< const MD & >(), index_type(0)))

Defined in include/teeny/iterate.h:169


El

using El = typename Cell::element_type

Defined in include/teeny/iterate.h:170

enum_iterator

#include <iterate.h>
struct enum_iterator

Defined in include/teeny/iterate.h:224

List of all members

Name Kind Owner
it variable Declared here
operator* function Declared here
operator++ function Declared here
operator!= function Declared here
operator== function Declared here

Public Attributes

Return Name Description
iterator it

it

iterator it

Defined in include/teeny/iterate.h:225

Public Methods

Return Name Description
item operator* const inline
enum_iterator & operator++ inline
bool operator!= const inline
bool operator== const inline

operator*

const inline

inline item operator*() const

Defined in include/teeny/iterate.h:226


operator++

inline

inline enum_iterator & operator++()

Defined in include/teeny/iterate.h:227


operator!=

const inline

inline bool operator!=(const enum_iterator & o) const

Defined in include/teeny/iterate.h:228


operator==

const inline

inline bool operator==(const enum_iterator & o) const

Defined in include/teeny/iterate.h:229

enum_range

#include <iterate.h>
struct enum_range

Defined in include/teeny/iterate.h:231

List of all members

Name Kind Owner
r variable Declared here
begin function Declared here
end function Declared here
subrange function Declared here

Public Attributes

Return Name Description
peel_range r

r

peel_range r

Defined in include/teeny/iterate.h:232

Public Methods

Return Name Description
enum_iterator begin const inline
enum_iterator end const inline
enum_subrange subrange const inline

begin

const inline

inline enum_iterator begin() const

Defined in include/teeny/iterate.h:233


end

const inline

inline enum_iterator end() const

Defined in include/teeny/iterate.h:234


subrange

const inline

inline enum_subrange subrange(index_type lo, index_type hi) const

Defined in include/teeny/iterate.h:240

enum_subrange

#include <iterate.h>
struct enum_subrange

Defined in include/teeny/iterate.h:235

List of all members

Name Kind Owner
b variable Declared here
e variable Declared here
begin function Declared here
end function Declared here

Public Attributes

Return Name Description
enum_iterator b
enum_iterator e

b

enum_iterator b

Defined in include/teeny/iterate.h:236


e

enum_iterator e

Defined in include/teeny/iterate.h:236

Public Methods

Return Name Description
enum_iterator begin const inline
enum_iterator end const inline

begin

const inline

inline enum_iterator begin() const

Defined in include/teeny/iterate.h:237


end

const inline

inline enum_iterator end() const

Defined in include/teeny/iterate.h:238

item

#include <iterate.h>
struct item

Defined in include/teeny/iterate.h:223

List of all members

Name Kind Owner
index variable Declared here
cell variable Declared here

Public Attributes

Return Name Description
array< index_type, Nd ? Nd :1 > index
Cell cell

index

array< index_type, Nd ? Nd :1 > index

Defined in include/teeny/iterate.h:223


cell

Cell cell

Defined in include/teeny/iterate.h:223

iterator

#include <iterate.h>
struct iterator

Defined in include/teeny/iterate.h:171

List of all members

Name Kind Owner
tmpl variable Declared here
base variable Declared here
cur variable Declared here
operator* function Declared here
operator++ function Declared here
operator!= function Declared here
operator== function Declared here
index function Declared here
index function Declared here

Public Attributes

Return Name Description
Cell tmpl
El * base
_md::peel_cursor< index_type, Nd > cur

tmpl

Cell tmpl

Defined in include/teeny/iterate.h:172


base

El * base

Defined in include/teeny/iterate.h:173


cur

_md::peel_cursor< index_type, Nd > cur

Defined in include/teeny/iterate.h:174

Public Methods

Return Name Description
Cell operator* const inline
iterator & operator++ inline
bool operator!= const inline
bool operator== const inline
index_type index const inline noexcept
array< index_type, Nd ? Nd :1 > index const inline noexcept

operator*

const inline

inline Cell operator*() const

Defined in include/teeny/iterate.h:175


operator++

inline

inline iterator & operator++()

Defined in include/teeny/iterate.h:176


operator!=

const inline

inline bool operator!=(const iterator & o) const

Defined in include/teeny/iterate.h:177


operator==

const inline

inline bool operator==(const iterator & o) const

Defined in include/teeny/iterate.h:178


index

const inline noexcept

inline index_type index(size_t d) const noexcept

Defined in include/teeny/iterate.h:183


index

const inline noexcept

inline array< index_type, Nd ? Nd :1 > index() const noexcept

Defined in include/teeny/iterate.h:184

subrange_t

#include <iterate.h>
struct subrange_t

Defined in include/teeny/iterate.h:205

A [lo, hi) slice of the cells for chunked/threaded sweeps: seed the incremental cursor once at lo, then O(1) per step within the chunk.

(Split [0,[size()](#size-3)) across threads/blocks; each sweeps its chunk.)

List of all members

Name Kind Owner
b variable Declared here
e variable Declared here
begin function Declared here
end function Declared here

Public Attributes

Return Name Description
iterator b
iterator e

b

iterator b

Defined in include/teeny/iterate.h:206


e

iterator e

Defined in include/teeny/iterate.h:206

Public Methods

Return Name Description
iterator begin const inline
iterator end const inline

begin

const inline

inline iterator begin() const

Defined in include/teeny/iterate.h:207


end

const inline

inline iterator end() const

Defined in include/teeny/iterate.h:208

ptr_storage

#include <storage.h>
template<class T>
struct ptr_storage

Defined in include/teeny/storage.h:137

Subclassed by: gpu_view, N >, mapped_view, N >, pinned_view, N >, view, N >

List of all members

Name Kind Owner
p variable Declared here
ptr_storage function Declared here
ptr_storage function Declared here
data function Declared here

Public Attributes

Return Name Description
T * p

p

T * p = nullptr

Defined in include/teeny/storage.h:138

Public Methods

Return Name Description
ptr_storage Defaulted constructor.
constexpr ptr_storage inline constexpr noexcept
constexpr T * data const inline constexpr noexcept

ptr_storage

ptr_storage() = default

Defined in include/teeny/storage.h:139

Defaulted constructor.


ptr_storage

inline constexpr noexcept

constexpr inline constexpr ptr_storage(T * q) noexcept

Defined in include/teeny/storage.h:140


data

const inline constexpr noexcept

constexpr inline constexpr T * data() const noexcept

Defined in include/teeny/storage.h:141

storage_policy

template<class T, storage O, size_t N>
struct storage_policy

Defined in include/teeny/storage.h:129

gpu, N >

#include <cuda.h>
template<class T, size_t N>
struct gpu, N >

Defined in include/teeny/cuda.h:61

Inherits: owning_storage< T, cuda_gpu_alloc >

List of all members

Name Kind Owner
p variable Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
data function Inherited from owning_storage
data function Inherited from owning_storage

Inherited from owning_storage

Kind Name Description
variable p
function owning_storage Defaulted constructor.
function owning_storage inline explicit
function owning_storage inline
function owning_storage Deleted constructor.
function owning_storage inline noexcept
function data inline noexcept
function data const inline noexcept

gpu_view, N >

#include <storage.h>
template<class T, size_t N>
struct gpu_view, N >

Defined in include/teeny/storage.h:144

Inherits: ptr_storage< T >

List of all members

Name Kind Owner
p variable Inherited from ptr_storage
ptr_storage function Inherited from ptr_storage
ptr_storage function Inherited from ptr_storage
data function Inherited from ptr_storage

Inherited from ptr_storage

Kind Name Description
variable p
function ptr_storage Defaulted constructor.
function ptr_storage inline constexpr noexcept
function data const inline constexpr noexcept

heap, N >

#include <storage.h>
template<class T, size_t N>
struct heap, N >

Defined in include/teeny/storage.h:164

Inherits: owning_storage< T, cpp_alloc >

List of all members

Name Kind Owner
p variable Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
data function Inherited from owning_storage
data function Inherited from owning_storage

Inherited from owning_storage

Kind Name Description
variable p
function owning_storage Defaulted constructor.
function owning_storage inline explicit
function owning_storage inline
function owning_storage Deleted constructor.
function owning_storage inline noexcept
function data inline noexcept
function data const inline noexcept

mapped, N >

#include <cuda.h>
template<class T, size_t N>
struct mapped, N >

Defined in include/teeny/cuda.h:69

Inherits: owning_storage< T, cuda_mapped_alloc >

List of all members

Name Kind Owner
p variable Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
data function Inherited from owning_storage
data function Inherited from owning_storage

Inherited from owning_storage

Kind Name Description
variable p
function owning_storage Defaulted constructor.
function owning_storage inline explicit
function owning_storage inline
function owning_storage Deleted constructor.
function owning_storage inline noexcept
function data inline noexcept
function data const inline noexcept

mapped_view, N >

#include <storage.h>
template<class T, size_t N>
struct mapped_view, N >

Defined in include/teeny/storage.h:146

Inherits: ptr_storage< T >

List of all members

Name Kind Owner
p variable Inherited from ptr_storage
ptr_storage function Inherited from ptr_storage
ptr_storage function Inherited from ptr_storage
data function Inherited from ptr_storage

Inherited from ptr_storage

Kind Name Description
variable p
function ptr_storage Defaulted constructor.
function ptr_storage inline constexpr noexcept
function data const inline constexpr noexcept

pinned, N >

#include <cuda.h>
template<class T, size_t N>
struct pinned, N >

Defined in include/teeny/cuda.h:65

Inherits: owning_storage< T, cuda_pinned_alloc >

List of all members

Name Kind Owner
p variable Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
owning_storage function Inherited from owning_storage
data function Inherited from owning_storage
data function Inherited from owning_storage

Inherited from owning_storage

Kind Name Description
variable p
function owning_storage Defaulted constructor.
function owning_storage inline explicit
function owning_storage inline
function owning_storage Deleted constructor.
function owning_storage inline noexcept
function data inline noexcept
function data const inline noexcept

pinned_view, N >

#include <storage.h>
template<class T, size_t N>
struct pinned_view, N >

Defined in include/teeny/storage.h:145

Inherits: ptr_storage< T >

List of all members

Name Kind Owner
p variable Inherited from ptr_storage
ptr_storage function Inherited from ptr_storage
ptr_storage function Inherited from ptr_storage
data function Inherited from ptr_storage

Inherited from ptr_storage

Kind Name Description
variable p
function ptr_storage Defaulted constructor.
function ptr_storage inline constexpr noexcept
function data const inline constexpr noexcept

stack, N >

#include <storage.h>
template<class T, size_t N>
struct stack, N >

Defined in include/teeny/storage.h:150

List of all members

Name Kind Owner
a variable Declared here
storage_policy function Declared here
storage_policy function Declared here
data function Declared here
data function Declared here

Public Attributes

Return Name Description
array< T, N > a

a

array< T, N > a

Defined in include/teeny/storage.h:151

Public Methods

Return Name Description
constexpr storage_policy inline constexpr noexcept
storage_policy inline noexcept
constexpr T * data inline constexpr noexcept
constexpr const T * data const inline constexpr noexcept

storage_policy

inline constexpr noexcept

constexpr inline constexpr storage_policy() noexcept

Defined in include/teeny/storage.h:156


storage_policy

inline noexcept

inline storage_policy(_uninit_t) noexcept

Defined in include/teeny/storage.h:157


data

inline constexpr noexcept

constexpr inline constexpr T * data() noexcept

Defined in include/teeny/storage.h:158


data

const inline constexpr noexcept

constexpr inline constexpr const T * data() const noexcept

Defined in include/teeny/storage.h:159

view, N >

#include <storage.h>
template<class T, size_t N>
struct view, N >

Defined in include/teeny/storage.h:143

Inherits: ptr_storage< T >

List of all members

Name Kind Owner
p variable Inherited from ptr_storage
ptr_storage function Inherited from ptr_storage
ptr_storage function Inherited from ptr_storage
data function Inherited from ptr_storage

Inherited from ptr_storage

Kind Name Description
variable p
function ptr_storage Defaulted constructor.
function ptr_storage inline constexpr noexcept
function data const inline constexpr noexcept

storage_size

#include <storage.h>
template<class Mapping, bool Stack>
struct storage_size

Defined in include/teeny/storage.h:170

Storage element count for a stack tensor (0 for view/owning).

List of all members

Name Kind Owner
value variable Declared here

Public Static Attributes

Return Name Description
constexpr size_t value static constexpr

value

static constexpr

constexpr size_t value = 0

Defined in include/teeny/storage.h:170

storage_size< Mapping, true >

#include <storage.h>
template<class Mapping>
struct storage_size< Mapping, true >

Defined in include/teeny/storage.h:172

List of all members

Name Kind Owner
value variable Declared here

Public Static Attributes

Return Name Description
constexpr size_t value static constexpr

value

static constexpr

constexpr size_t value =
        static_cast<size_t>(Mapping().required_span_size())

Defined in include/teeny/storage.h:173

strides

#include <layout.h>
template<int64_t... S>
struct strides

Defined in include/teeny/layout.h:66

An mdspan layout policy with per-dimension static or dynamic strides — the stride analogue of extents/shape.

ccontiguous/fcontiguous (mdspan layout_right/layout_left) give contiguous (extent-derived) strides; layout_stride stores every stride at run time. strides<S...> bakes the KNOWN strides into the type (folding to immediates) — including negative strides — while any dimension marked dynamic_stride is supplied at run time:

tensor<float, shape<3,4>, strides<4,1>>(ptr);                    // static, folds
tensor<float, shape<3,4>, strides<-4,1>>(ptr);                   // reversed rows
tensor<float, shape<-1,4>, strides<dynamic_stride,1>>(ptr, {n}); // outer stride runtime
When every stride is static the mapping is empty (EBO), so a stack tensor is still exactly sizeof its data. Only the dynamic strides are stored.

Note: CCCL's submdspan is only defined for the standard layouts, so it does not apply here — but teeny's own slicing/take_along/permute/flip/ peel build their views by hand (no submdspan), so they all work on a strides<...> source and in fact fold their output strides the same way. And required_span_size assumes non-negative strides — negative strides are for VIEWS into existing storage, not owning allocation.

Template Parameters

  • S One stride per dimension: a compile-time value (may be negative), or dynamic_stride for a runtime stride.

List of all members

Name Kind Owner
N variable Declared here
S_ variable Declared here
ndyn function Declared here
all_static function Declared here
slot function Declared here

Public Static Attributes

Return Name Description
constexpr size_t N static constexpr
constexpr int64_t S_ static constexpr

N

static constexpr

constexpr size_t N = sizeof...(S)

Defined in include/teeny/layout.h:67


S_

static constexpr

constexpr int64_t S_ = { S... }

Defined in include/teeny/layout.h:68

Public Static Methods

Return Name Description
constexpr size_t ndyn static inline constexpr noexcept
constexpr bool all_static static inline constexpr noexcept
constexpr size_t slot static inline constexpr noexcept

ndyn

static inline constexpr noexcept

constexpr static inline constexpr size_t ndyn() noexcept

Defined in include/teeny/layout.h:70


all_static

static inline constexpr noexcept

constexpr static inline constexpr bool all_static() noexcept

Defined in include/teeny/layout.h:73


slot

static inline constexpr noexcept

constexpr static inline constexpr size_t slot(size_t r) noexcept

Defined in include/teeny/layout.h:75

mapping

#include <layout.h>
template<class Shape>
struct mapping

Defined in include/teeny/layout.h:82

Inherits: ndyn()>, Shape

List of all members

Name Kind Owner
mapping function Declared here
mapping function Declared here
mapping function Declared here
extents function Declared here
stride function Declared here
operator() function Declared here
required_span_size function Declared here
is_unique function Declared here
is_exhaustive function Declared here
is_strided function Declared here
is_always_unique function Declared here
is_always_exhaustive function Declared here
is_always_strided function Declared here
extents_type typedef Declared here
index_type typedef Declared here
rank_type typedef Declared here
layout_type typedef Declared here

Public Methods

Return Name Description
mapping Defaulted constructor.
constexpr mapping inline constexpr Fully-static strides: construct from extents only.
constexpr mapping inline constexpr Mixed strides: extents + the runtime strides (dim order, dynamic ones only).
constexpr const Shape & extents const inline constexpr noexcept
constexpr index_type stride const inline constexpr noexcept
constexpr index_type operator() const inline constexpr noexcept
constexpr index_type required_span_size const inline constexpr noexcept
constexpr bool is_unique const inline constexpr noexcept
constexpr bool is_exhaustive const inline constexpr noexcept
constexpr bool is_strided const inline constexpr noexcept

mapping

mapping() = default

Defined in include/teeny/layout.h:90

Defaulted constructor.


mapping

inline constexpr

template<size_t M = strides::ndyn(), enable_if_t< M==0, int > = 0> constexpr inline constexpr mapping(const Shape & e)

Defined in include/teeny/layout.h:94

Fully-static strides: construct from extents only.


mapping

inline constexpr

template<class OtherIdx> constexpr inline constexpr mapping(const Shape & e, const array< OtherIdx, strides::ndyn()> & dyn)

Defined in include/teeny/layout.h:111

Mixed strides: extents + the runtime strides (dim order, dynamic ones only).

Templated on the array's element type so a reindex (narrowing the offset index width) can pass its wider source strides — each is cast to index_type; symmetric with mdspan's layout_stride.


extents

const inline constexpr noexcept

constexpr inline constexpr const Shape & extents() const noexcept

Defined in include/teeny/layout.h:114


stride

const inline constexpr noexcept

constexpr inline constexpr index_type stride(rank_type r) const noexcept

Defined in include/teeny/layout.h:115


operator()

const inline constexpr noexcept

template<class... I> constexpr inline constexpr index_type operator()(I... i) const noexcept

Defined in include/teeny/layout.h:119


required_span_size

const inline constexpr noexcept

constexpr inline constexpr index_type required_span_size() const noexcept

Defined in include/teeny/layout.h:125


is_unique

const inline constexpr noexcept

constexpr inline constexpr bool is_unique() const noexcept

Defined in include/teeny/layout.h:136


is_exhaustive

const inline constexpr noexcept

constexpr inline constexpr bool is_exhaustive() const noexcept

Defined in include/teeny/layout.h:137


is_strided

const inline constexpr noexcept

constexpr inline constexpr bool is_strided() const noexcept

Defined in include/teeny/layout.h:138

Public Static Methods

Return Name Description
constexpr bool is_always_unique static inline constexpr noexcept
constexpr bool is_always_exhaustive static inline constexpr noexcept
constexpr bool is_always_strided static inline constexpr noexcept

is_always_unique

static inline constexpr noexcept

constexpr static inline constexpr bool is_always_unique() noexcept

Defined in include/teeny/layout.h:133


is_always_exhaustive

static inline constexpr noexcept

constexpr static inline constexpr bool is_always_exhaustive() noexcept

Defined in include/teeny/layout.h:134


is_always_strided

static inline constexpr noexcept

constexpr static inline constexpr bool is_always_strided() noexcept

Defined in include/teeny/layout.h:135

Public Types

Name Description
extents_type
index_type
rank_type
layout_type

extents_type

using extents_type = Shape

Defined in include/teeny/layout.h:83


index_type

using index_type = typename Shape::index_type

Defined in include/teeny/layout.h:84


rank_type

using rank_type = typename Shape::rank_type

Defined in include/teeny/layout.h:85


layout_type

using layout_type = strides

Defined in include/teeny/layout.h:86

tensor

#include <tensor.h>
template<class T, class Shape, class Layout, storage O>
struct tensor

Defined in include/teeny/tensor.h:196

Inherits: template mapping< Shape >

One N-dimensional tensor, parameterised by ownership.

The layout / extents / offset mapping is delegated to cuda::std::mdspan (the mapping lives in an empty base, so a fully-static tensor is exactly the size of its data). Ownership is a policy: [storage::view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a1bda80f2be4d3658e0baa43fbe7ae8c1) (non-owning, trivially copyable, kernel-passable), [storage::stack](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508afac2a47adace059aff113283a03f6760) (inline storage, static shape), [storage::heap](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a4d4a9aa362b6ffe089fd2e992ccf4f5f) (host-only, move-only), the CUDA owners [storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947)/pinned/mapped (from [cuda.h](#cudah)), and the space-carrying views [storage::gpu_view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a716b431c57855c3a30f4c286ad4f0299)/pinned_view/ mapped_view (a view of device / page-locked memory keeps its space). The tensor's copy/move semantics are induced by the storage member, not hand-written.

Template Parameters

  • T Element type.

  • Shape The shape: any cuda::std::extents<Idx, E...> (static or dynamic per dim). Spell it with the shape<...> alias.

  • Layout mdspan layout policy (default ccontiguous).

  • O Ownership kind (default [storage::view](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a1bda80f2be4d3658e0baa43fbe7ae8c1)).

List of all members

Name Kind Owner
store_ variable Declared here
tensor function Declared here
tensor function Declared here
tensor function Declared here
tensor function Declared here
tensor function Declared here
tensor function Declared here
tensor function Declared here
tensor function Declared here
tensor function Declared here
tensor function Declared here
mapping function Declared here
extents function Declared here
extent function Declared here
extent function Declared here
shape function Declared here
shape function Declared here
strides function Declared here
stride function Declared here
stride function Declared here
numel function Declared here
is_dense function Declared here
is_dense function Declared here
is_dense function Declared here
is_contiguous function Declared here
is_contiguous function Declared here
data function Declared here
data function Declared here
mdspan function Declared here
mdspan function Declared here
view function Declared here
view function Declared here
operator() function Declared here
operator() function Declared here
at function Declared here
at function Declared here
operator() function Declared here
operator() function Declared here
uget function Declared here
uget function Declared here
uget function Declared here
uget function Declared here
uget function Declared here
uget function Declared here
uat function Declared here
uat function Declared here
operator() function Declared here
operator() function Declared here
operator T function Declared here
item function Declared here
take_along function Declared here
take_along function Declared here
take_along function Declared here
take_along function Declared here
permute function Declared here
permute function Declared here
flip function Declared here
flip function Declared here
clone function Declared here
to function Declared here
to function Declared here
to function Declared here
to function Declared here
reshape function Declared here
reshape function Declared here
can_reshape_without_copy function Declared here
recast function Declared here
recast function Declared here
index_fits function Declared here
reindex function Declared here
reindex function Declared here
flatten function Declared here
flatten function Declared here
unsqueeze function Declared here
unsqueeze function Declared here
unsqueeze function Declared here
unsqueeze function Declared here
squeeze function Declared here
squeeze function Declared here
squeeze function Declared here
squeeze function Declared here
flip function Declared here
flip function Declared here
squeeze function Declared here
squeeze function Declared here
unsqueeze function Declared here
unsqueeze function Declared here
permute function Declared here
permute function Declared here
reshape function Declared here
reshape function Declared here
recast function Declared here
recast function Declared here
recast function Declared here
recast function Declared here
add_ function Declared here
sub_ function Declared here
mul_ function Declared here
div_ function Declared here
add_ function Declared here
sub_ function Declared here
mul_ function Declared here
div_ function Declared here
add_ function Declared here
sub_ function Declared here
atomic_add_ function Declared here
atomic_sub_ function Declared here
atomic_add_ function Declared here
atomic_sub_ function Declared here
operator+= function Declared here
operator-= function Declared here
operator*= function Declared here
operator/= function Declared here
copy_ function Declared here
fill_ function Declared here
zero_ function Declared here
iota_ function Declared here
add function Declared here
sub function Declared here
mul function Declared here
div function Declared here
pow function Declared here
add function Declared here
sub function Declared here
mul function Declared here
div function Declared here
pow function Declared here
add function Declared here
sub function Declared here
add function Declared here
sub function Declared here
maximum function Declared here
minimum function Declared here
maximum function Declared here
clamp function Declared here
clamp function Declared here
normalize function Declared here
normalize function Declared here
cross function Declared here
cross function Declared here
map_ function Declared here
zip_with_ function Declared here
map function Declared here
all function Declared here
any function Declared here
dot function Declared here
dot function Declared here
neg_ function Declared here
abs_ function Declared here
exp_ function Declared here
log_ function Declared here
sin_ function Declared here
cos_ function Declared here
sqrt_ function Declared here
tanh_ function Declared here
floor_ function Declared here
ceil_ function Declared here
round_ function Declared here
trunc_ function Declared here
sign_ function Declared here
pow_ function Declared here
clamp_ function Declared here
normalize_ function Declared here
normalize_ function Declared here
cross_ function Declared here
operator++ function Declared here
operator-- function Declared here
operator++ function Declared here
operator-- function Declared here
add_ function Declared here
sub_ function Declared here
mul_ function Declared here
div_ function Declared here
add_ function Declared here
sub_ function Declared here
add_ function Declared here
sub_ function Declared here
atomic_add_ function Declared here
atomic_sub_ function Declared here
copy_ function Declared here
map_ function Declared here
zip_with_ function Declared here
cross_ function Declared here
normalize_ function Declared here
minimum function Declared here
ownership variable Declared here
is_static variable Declared here
is_view variable Declared here
is_owning variable Declared here
is_device variable Declared here
is_host_accessible variable Declared here
buffer_size variable Declared here
is_strides_layout variable Declared here
is_contiguous_layout variable Declared here
rank function Declared here
element_type typedef Declared here
extents_type typedef Declared here
shape_type typedef Declared here
layout_type typedef Declared here
index_type typedef Declared here
mapping_type typedef Declared here
view_type typedef Declared here
const_view_type typedef Declared here

Public Attributes

Return Name Description
storage_policy< T, O, buffer_size > store_

store_

storage_policy< T, O, buffer_size > store_ {}

Defined in include/teeny/tensor.h:216

Public Methods

Return Name Description
tensor Defaulted constructor.
tensor Defaulted constructor.
tensor Defaulted constructor.
tensor inline View constructor: wrap p with the given mapping.
tensor inline explicit View constructor from a pointer alone — for a fully-static geometry (static extents AND a fully determined layout: contiguous, or an all-static strides<...>).
tensor inline View constructor from a pointer + extents (contiguous / static-stride layouts).
tensor inline explicit Owning constructor: allocate storage for m (heap/device/host/pinned).
tensor inline explicit Owning constructor from extents (contiguous / static-stride layouts).
tensor inline explicit UNINITIALISED constructors (numpy np.empty) used by [empty()](#empty): the buffer is left indeterminate — fill before reading.
tensor inline
constexpr const mapping_type & mapping const inline constexpr noexcept
constexpr const Shape & extents const inline constexpr noexcept
constexpr auto extent const inline constexpr noexcept Extent of an axis given by a STATIC index (extent(Int<0>())): a compile-time integral_constant when that extent is static, else a runtime index_type.
constexpr index_type extent const inline constexpr noexcept Extent of an axis given by a RUNTIME index (extent(0)).
constexpr auto shape const inline constexpr noexcept [shape()](#shape) — the extents as an array-like accessor: [shape()](#shape)[Int<k>()] folds to a compile-time value where static, [shape()](#shape)[i] (runtime) is a value, and it converts to the raw extents() for interop.
constexpr auto shape const inline constexpr noexcept
constexpr auto strides const inline constexpr noexcept strides() — the strides as an array-like accessor (twin of [shape()](#shape)): strides()[Int<k>()] folds where the layout makes the stride derivable, strides()[i] (runtime) is a value.
constexpr auto stride const inline constexpr noexcept Stride of an axis given by a STATIC index (stride(Int<0>())): a compile-time integral_constant when known statically (static- stride layout; a contiguous layout over static extents; or the always-unit stride of a contiguous layout even for dynamic shapes).
constexpr index_type stride const inline constexpr noexcept Stride of an axis given by a RUNTIME index (stride(0)).
constexpr auto numel const inline constexpr noexcept Number of elements.
constexpr bool is_dense const inline constexpr noexcept Whether the elements occupy a dense block of memory, in some axis order — true for a C- or F-contiguous tensor, and also for a permuted one (a permuted C-contiguous view still packs the same memory densely).
bool is_dense const inline noexcept Exact denseness in layout L (e.g.
bool is_dense const inline noexcept
bool is_contiguous const inline noexcept Whether the elements are contiguous in a specific orderC-order by default (numpy/pytorch's is_contiguous), or F-order via is_contiguous<fcontiguous>().
bool is_contiguous const inline noexcept
T * data inline noexcept
const T * data const inline noexcept
view_type mdspan inline noexcept The raw cuda::std::mdspan over this tensor's storage.
const_view_type mdspan const inline noexcept
auto view inline noexcept A non-owning teeny view of this tensor's storage — a view (or gpu_view, for a device tensor) that aliases the same memory (no copy), keeping the source layout.
auto view const inline noexcept
T & operator() inline noexcept Element access when every argument is an integer (negatives wrap).
const T & operator() const inline noexcept
auto at inline noexcept at(i...) — a single element as a rank-0 VIEW (all-integer args; negatives wrap).
auto at const inline noexcept
auto operator() inline noexcept Sub-view when any argument is a slice (all, slice(a,b[,step])) or a bare none (numpy newaxis).
auto operator() const inline noexcept
T & uget inline noexcept
const T & uget const inline noexcept
auto uget inline noexcept
auto uget const inline noexcept
decltype(auto) uget inline noexcept
decltype(auto) uget const inline noexcept
auto uat inline noexcept Unchecked at: a single element as a rank-0 VIEW, no negative wrap.
auto uat const inline noexcept
decltype(auto) operator() inline noexcept Ellipsis form: exactly one ellipsis in the args expands to rank - (#other args) copies of all, then the call re-runs — so t(1, ellipsis, 2) on rank 5 is t(1, all, all, all, 2).
decltype(auto) operator() const inline noexcept
operator T const inline noexcept
T item const inline noexcept The single element of a rank-0 tensor (explicit reader).
auto take_along inline noexcept Index/slice one or more named axes; other axes are kept.
auto take_along const inline noexcept
auto take_along inline noexcept Value form: t.take_along(axis<0,2>{}, i, slice(1,4)) == t.take_along<0,2>(i, slice(1,4)).
auto take_along const inline noexcept
auto permute inline noexcept Reorder the axes (a permutation of 0..N-1; negatives wrap) -> a rank-N view.
auto permute const inline noexcept
auto flip inline noexcept Reverse axis Ax (negatives wrap) -> a view (numpy flip).
auto flip const inline noexcept
auto clone const inline
auto to const inline & pytorch-like .to<T2>(): convert the element type to T2.
auto to const inline &
auto to const inline &&
auto to const inline &&
auto reshape inline noexcept View this tensor as a new shape — numpy semantics: a VIEW whenever the layout can be regrouped without a copy (not only when C-contiguous; a strided/permuted source often still views — split a contiguous axis, merge a contiguous run).
auto reshape const inline noexcept
bool can_reshape_without_copy const inline noexcept Whether reshape<NewExt...>() can produce a VIEW (no copy) of this tensor's actual layout — numpy's rule: not just C-contiguity, but any stride-compatible regrouping (splitting an axis, merging a contiguous run).
auto recast inline Reinterpret with a MORE-STATIC extents type of the same rank — recover statically-known inner dims at the dynamic (ndarray) boundary: a runtime (n,3,3) view -> .recast<shape<-1,3,3>>() so the 3s (extents) fold.
auto recast const inline
bool index_fits const inline noexcept Does every element offset of this view fit the index type Idx2? Computes the SIGNED reach directly (teeny has negative-stride views, so required_span_size's non-negative assumption doesn't apply): max = Σ_{s>0}(e−1)·s, min = Σ_{s<0}(e−1)·s; fits ⟺ min..maxIdx2.
auto reindex inline No-copy, layout-preserving retype of the offset index width to Idx2: same pointer, same layout KIND, the extents' index_type and any dynamic strides narrowed to Idx2 (a strides<...> literal pack is unchanged).
auto reindex const inline
auto flatten inline noexcept View as 1-D (ravel) — a VIEW whenever the layout is mergeable into a single contiguous run without a copy (numpy semantics; [clone()](#clone) first otherwise).
auto flatten const inline noexcept
auto unsqueeze inline noexcept Insert a size-1 axis at position Ax (numpy newaxis/unsqueeze) -> a rank-(N+1) view.
auto unsqueeze const inline noexcept
auto unsqueeze inline noexcept Insert size-1 axes at SEVERAL positions at once (numpy expand_dims(a, axis=(...))) -> a rank-(N+k) view.
auto unsqueeze const inline noexcept
auto squeeze inline noexcept Drop a size-1 axis Ax (negatives wrap) -> a rank-(N-1) view.
auto squeeze const inline noexcept
auto squeeze inline noexcept Drop SEVERAL size-1 axes at once (numpy squeeze(axis=(...))) -> a rank-(N-k) view.
auto squeeze const inline noexcept
auto flip inline noexcept
auto flip const inline noexcept
auto squeeze inline noexcept
auto squeeze const inline noexcept
auto unsqueeze inline noexcept
auto unsqueeze const inline noexcept
auto permute inline noexcept
auto permute const inline noexcept
auto reshape inline noexcept
auto reshape const inline noexcept
auto recast inline
auto recast const inline
auto recast inline
auto recast const inline
tensor & add_
tensor & sub_
tensor & mul_
tensor & div_
tensor & add_
tensor & sub_
tensor & mul_
tensor & div_
tensor & add_
tensor & sub_
tensor & atomic_add_
tensor & atomic_sub_
tensor & atomic_add_
tensor & atomic_sub_
tensor & operator+= inline
tensor & operator-= inline
tensor & operator*= inline
tensor & operator/= inline
tensor & copy_
tensor & fill_
tensor & zero_
tensor & iota_
auto add const
auto sub const
auto mul const
auto div const
auto pow const
auto & add const
auto & sub const
auto & mul const
auto & div const
auto & pow const
auto add const
auto sub const
auto & add const
auto & sub const
auto maximum const
auto & minimum const
auto & maximum const
auto clamp const
auto & clamp const
auto normalize const
auto & normalize const
auto cross const
auto & cross const
tensor & map_
tensor & zip_with_
auto map const
bool all const
bool any const
class Eb class Lb storage Ob auto dot const
auto & dot const
tensor & neg_
tensor & abs_
tensor & exp_
tensor & log_
tensor & sin_
tensor & cos_
tensor & sqrt_
tensor & tanh_
tensor & floor_
tensor & ceil_
tensor & round_
tensor & trunc_
tensor & sign_
tensor & pow_
tensor & clamp_
tensor & normalize_
tensor & normalize_
tensor & cross_
tensor & operator++ inline
tensor & operator-- inline
tensor< T, Shape, ccontiguous, storage::stack > operator++ inline
tensor< T, Shape, ccontiguous, storage::stack > operator-- inline
tensor< T, E, L, O > & add_
tensor< T, E, L, O > & sub_
tensor< T, E, L, O > & mul_
tensor< T, E, L, O > & div_
tensor< T, E, L, O > & add_
tensor< T, E, L, O > & sub_
tensor< T, E, L, O > & add_
tensor< T, E, L, O > & sub_
tensor< T, E, L, O > & atomic_add_
tensor< T, E, L, O > & atomic_sub_
tensor< T, E, L, O > & copy_
tensor< T, E, L, O > & map_
tensor< T, E, L, O > & zip_with_
tensor< T, E, L, O > & cross_
tensor< T, E, L, O > & normalize_
u_abs u_log u_cos u_tanh u_ceil u_trunc auto minimum const

tensor

tensor() = default

Defined in include/teeny/tensor.h:219

Defaulted constructor.


tensor

tensor(const tensor &) = default

Defined in include/teeny/tensor.h:225

Defaulted constructor.


tensor

tensor(tensor &&) = default

Defined in include/teeny/tensor.h:226

Defaulted constructor.


tensor

inline

template<storage OO = O, enable_if_t< storage_is_view(OO), int > = 0> inline tensor(T * p, mapping_type m)

Defined in include/teeny/tensor.h:230

View constructor: wrap p with the given mapping.


tensor

inline explicit

template<storage OO = O, enable_if_t< storage_is_view(OO) &&is_static &&(_contiguous_layout< Layout >::value||_strides_all_static< Layout >::value), int > = 0> inline explicit tensor(T * p)

Defined in include/teeny/tensor.h:237

View constructor from a pointer alone — for a fully-static geometry (static extents AND a fully determined layout: contiguous, or an all-static strides<...>).

e.g. tensor<float, shape<3,4>, strides<4,1>>(ptr).


tensor

inline

template<storage OO = O, enable_if_t< storage_is_view(OO) &&is_constructible< mapping_type, Shape >::value, int > = 0> inline tensor(T * p, Shape e)

Defined in include/teeny/tensor.h:241

View constructor from a pointer + extents (contiguous / static-stride layouts).


tensor

inline explicit

template<storage OO = O, enable_if_t< storage_is_owning(OO), int > = 0> inline explicit tensor(mapping_type m)

Defined in include/teeny/tensor.h:253

Owning constructor: allocate storage for m (heap/device/host/pinned).


tensor

inline explicit

template<storage OO = O, enable_if_t< storage_is_owning(OO) &&is_constructible< mapping_type, Shape >::value, int > = 0> inline explicit tensor(Shape e)

Defined in include/teeny/tensor.h:258

Owning constructor from extents (contiguous / static-stride layouts).


tensor

inline explicit

template<storage OO = O, enable_if_t< OO==storage::stack, int > = 0> inline explicit tensor(_uninit_t)

Defined in include/teeny/tensor.h:265

UNINITIALISED constructors (numpy np.empty) used by [empty()](#empty): the buffer is left indeterminate — fill before reading.

local<...>{} and zeros(...) keep their zero-fill; this is the opt-out.


tensor

inline

template<storage OO = O, enable_if_t< storage_is_owning(OO) &&is_constructible< mapping_type, Shape >::value, int > = 0> inline tensor(Shape e, _uninit_t)

Defined in include/teeny/tensor.h:267


mapping

const inline constexpr noexcept

constexpr inline constexpr const mapping_type & mapping() const noexcept

Defined in include/teeny/tensor.h:271


extents

const inline constexpr noexcept

constexpr inline constexpr const Shape & extents() const noexcept

Defined in include/teeny/tensor.h:272


extent

const inline constexpr noexcept

template<class Idx, enable_if_t< _is_ic< Idx >::value, int > = 0> constexpr inline constexpr auto extent(Idx) const noexcept

Defined in include/teeny/tensor.h:280

Extent of an axis given by a STATIC index (extent(Int<0>())): a compile-time integral_constant when that extent is static, else a runtime index_type.


extent

const inline constexpr noexcept

template<class Idx, enable_if_t<!_is_ic< Idx >::value, int > = 0> constexpr inline constexpr index_type extent(Idx d) const noexcept

Defined in include/teeny/tensor.h:284

Extent of an axis given by a RUNTIME index (extent(0)).


shape

const inline constexpr noexcept

constexpr inline constexpr auto shape() const noexcept

Defined in include/teeny/tensor.h:291

[shape()](#shape) — the extents as an array-like accessor: [shape()](#shape)[Int<k>()] folds to a compile-time value where static, [shape()](#shape)[i] (runtime) is a value, and it converts to the raw extents() for interop.

[shape(d)](#shape) is the per-axis shorthand (== extent(d)).


shape

const inline constexpr noexcept

template<class Idx> constexpr inline constexpr auto shape(Idx d) const noexcept

Defined in include/teeny/tensor.h:292


strides

const inline constexpr noexcept

constexpr inline constexpr auto strides() const noexcept

Defined in include/teeny/tensor.h:296

strides() — the strides as an array-like accessor (twin of [shape()](#shape)): strides()[Int<k>()] folds where the layout makes the stride derivable, strides()[i] (runtime) is a value.

strides(d) == stride(d).


stride

const inline constexpr noexcept

template<class Idx, enable_if_t< _is_ic< Idx >::value, int > = 0> constexpr inline constexpr auto stride(Idx) const noexcept

Defined in include/teeny/tensor.h:303

Stride of an axis given by a STATIC index (stride(Int<0>())): a compile-time integral_constant when known statically (static- stride layout; a contiguous layout over static extents; or the always-unit stride of a contiguous layout even for dynamic shapes).


stride

const inline constexpr noexcept

template<class Idx, enable_if_t<!_is_ic< Idx >::value, int > = 0> constexpr inline constexpr index_type stride(Idx d) const noexcept

Defined in include/teeny/tensor.h:307

Stride of an axis given by a RUNTIME index (stride(0)).


numel

const inline constexpr noexcept

constexpr inline constexpr auto numel() const noexcept

Defined in include/teeny/tensor.h:325

Number of elements.

A fully static shape folds to an integral_constant (so it propagates into later compile-time arithmetic, like extent(Int<k>())); any dynamic dim -> a runtime index_type.


is_dense

const inline constexpr noexcept

constexpr inline constexpr bool is_dense() const noexcept

Defined in include/teeny/tensor.h:346

Whether the elements occupy a dense block of memory, in some axis order — true for a C- or F-contiguous tensor, and also for a permuted one (a permuted C-contiguous view still packs the same memory densely).

Formally: the strides are a permutation of a dense nested packing (1, e0, e0·e1, ...). Size-1 axes are ignored (their stride is unconstrained); an empty tensor is trivially dense. Negative strides (flips) are not dense in this sense -> false.

Pass a layout for an exact check: is_dense<ccontiguous>() / is_dense<fcontiguous>() test C-/F-contiguity specifically (or any layout whose mapping is derivable from the extents). For the C-order question specifically, [is_contiguous()](#is_contiguous) (below) reads clearer.


is_dense

const inline noexcept

template<class L> inline bool is_dense() const noexcept

Defined in include/teeny/tensor.h:373

Exact denseness in layout L (e.g.

ccontiguous/fcontiguous): the actual strides equal what L produces for these extents. Two spellings — t.is_dense<ccontiguous>() (type form) and t.is_dense(ccontiguous()) (value form, layout deduced from the argument).


is_dense

const inline noexcept

template<class L> inline bool is_dense(L) const noexcept

Defined in include/teeny/tensor.h:384


is_contiguous

const inline noexcept

template<class L = ccontiguous> inline bool is_contiguous() const noexcept

Defined in include/teeny/tensor.h:392

Whether the elements are contiguous in a specific orderC-order by default (numpy/pytorch's is_contiguous), or F-order via is_contiguous<fcontiguous>().

A thin alias of is_dense<Layout>(); this (not [is_dense()](#is_dense)) is what reshape/flatten need. Value form: is_contiguous(ccontiguous{}).


is_contiguous

const inline noexcept

template<class L> inline bool is_contiguous(L) const noexcept

Defined in include/teeny/tensor.h:394


data

inline noexcept

inline T * data() noexcept

Defined in include/teeny/tensor.h:397


data

const inline noexcept

inline const T * data() const noexcept

Defined in include/teeny/tensor.h:398


mdspan

inline noexcept

inline view_type mdspan() noexcept

Defined in include/teeny/tensor.h:400

The raw cuda::std::mdspan over this tensor's storage.


mdspan

const inline noexcept

inline const_view_type mdspan() const noexcept

Defined in include/teeny/tensor.h:401


view

inline noexcept

inline auto view() noexcept

Defined in include/teeny/tensor.h:408

A non-owning teeny view of this tensor's storage — a view (or gpu_view, for a device tensor) that aliases the same memory (no copy), keeping the source layout.

On an already-non-owning tensor it re-wraps the same pointer (an equivalent view). For the raw mdspan, use [mdspan()](#mdspan).


view

const inline noexcept

inline auto view() const noexcept

Defined in include/teeny/tensor.h:409


operator()

inline noexcept

template<class... Args, enable_if_t<(_is_index< Args >::value &&...), int > = 0> inline T & operator()(Args... a) noexcept

Defined in include/teeny/tensor.h:594

Element access when every argument is an integer (negatives wrap).


operator()

const inline noexcept

template<class... Args, enable_if_t<(_is_index< Args >::value &&...), int > = 0> inline const T & operator()(Args... a) const noexcept

Defined in include/teeny/tensor.h:597


at

inline noexcept

template<class... Args, enable_if_t<(_is_index< Args >::value &&...), int > = 0> inline auto at(Args... a) noexcept

Defined in include/teeny/tensor.h:607

at(i...) — a single element as a rank-0 VIEW (all-integer args; negatives wrap).

Unlike operator(), which returns a plain T&, this is a view, so the whole tensor API applies to one element: x.at(i,j) = 3 writes it, float v = x.at(i,j) reads it (rank-0 tensors convert to/from T), and x.at(i,j).atomic_add_(v) is an atomic scatter.


at

const inline noexcept

template<class... Args, enable_if_t<(_is_index< Args >::value &&...), int > = 0> inline auto at(Args... a) const noexcept

Defined in include/teeny/tensor.h:612


operator()

inline noexcept

template<class... Args, enable_if_t<!(_is_index< Args >::value &&...) &&!_has_ellipsis< Args... >::value, int > = 0> inline auto operator()(Args... a) noexcept

Defined in include/teeny/tensor.h:624

Sub-view when any argument is a slice (all, slice(a,b[,step])) or a bare none (numpy newaxis).

Integer args drop their axis, all keeps it, a range keeps a strided window, and a bare none inserts a size-1 axis (static extent 1, stride 0) at its position — all via the one gather (folds static strides into strides<...>; works on any source layout). t(none,all,all) == unsqueeze<0>().


operator()

const inline noexcept

template<class... Args, enable_if_t<!(_is_index< Args >::value &&...) &&!_has_ellipsis< Args... >::value, int > = 0> inline auto operator()(Args... a) const noexcept

Defined in include/teeny/tensor.h:627


uget

inline noexcept

template<class... Args, enable_if_t<(_is_index< Args >::value &&...), int > = 0> inline T & uget(Args... a) noexcept

Defined in include/teeny/tensor.h:652


uget

const inline noexcept

template<class... Args, enable_if_t<(_is_index< Args >::value &&...), int > = 0> inline const T & uget(Args... a) const noexcept

Defined in include/teeny/tensor.h:655


uget

inline noexcept

template<class... Args, enable_if_t<!(_is_index< Args >::value &&...) &&!_has_ellipsis< Args... >::value, int > = 0> inline auto uget(Args... a) noexcept

Defined in include/teeny/tensor.h:660


uget

const inline noexcept

template<class... Args, enable_if_t<!(_is_index< Args >::value &&...) &&!_has_ellipsis< Args... >::value, int > = 0> inline auto uget(Args... a) const noexcept

Defined in include/teeny/tensor.h:663


uget

inline noexcept

template<class... Args, enable_if_t< _has_ellipsis< Args... >::value, int > = 0> inline decltype(auto) uget(Args... a) noexcept

Defined in include/teeny/tensor.h:668


uget

const inline noexcept

template<class... Args, enable_if_t< _has_ellipsis< Args... >::value, int > = 0> inline decltype(auto) uget(Args... a) const noexcept

Defined in include/teeny/tensor.h:671


uat

inline noexcept

template<class... Args, enable_if_t<(_is_index< Args >::value &&...), int > = 0> inline auto uat(Args... a) noexcept

Defined in include/teeny/tensor.h:676

Unchecked at: a single element as a rank-0 VIEW, no negative wrap.


uat

const inline noexcept

template<class... Args, enable_if_t<(_is_index< Args >::value &&...), int > = 0> inline auto uat(Args... a) const noexcept

Defined in include/teeny/tensor.h:681


operator()

inline noexcept

template<class... Args, enable_if_t< _has_ellipsis< Args... >::value, int > = 0> inline decltype(auto) operator()(Args... a) noexcept

Defined in include/teeny/tensor.h:691

Ellipsis form: exactly one ellipsis in the args expands to rank - (#other args) copies of all, then the call re-runs — so t(1, ellipsis, 2) on rank 5 is t(1, all, all, all, 2).

What remains decides the result (all integers -> element, else view).


operator()

const inline noexcept

template<class... Args, enable_if_t< _has_ellipsis< Args... >::value, int > = 0> inline decltype(auto) operator()(Args... a) const noexcept

Defined in include/teeny/tensor.h:694


operator T

const inline noexcept

template<size_t R = rank(), enable_if_t< R==0, int > = 0> inline operator T() const noexcept

Defined in include/teeny/tensor.h:714


item

const inline noexcept

template<size_t R = rank(), enable_if_t< R==0, int > = 0> inline T item() const noexcept

Defined in include/teeny/tensor.h:719

The single element of a rank-0 tensor (explicit reader).


take_along

inline noexcept

template<long... Axes, class... Args> inline auto take_along(Args... args) noexcept

Defined in include/teeny/tensor.h:767

Index/slice one or more named axes; other axes are kept.

take_along<Axes...>(args...) applies args[k] to axis Axes[k] (each an integer – negatives wrap – or a slice all/rng) and keeps every other axis, returning a view. e.g. t.take_along<1>(2) drops axis 1 at index 2; t.take_along<0,2>(i, rng(1,4)) binds axes 0 and 2 at once.


take_along

const inline noexcept

template<long... Axes, class... Args> inline auto take_along(Args... args) const noexcept

Defined in include/teeny/tensor.h:774


take_along

inline noexcept

template<long... Axes, class... Args> inline auto take_along(axis< Axes... >, Args... args) noexcept

Defined in include/teeny/tensor.h:785

Value form: t.take_along(axis<0,2>{}, i, slice(1,4)) == t.take_along<0,2>(i, slice(1,4)).

The leading axis<...> selector is a single distinct-typed argument, so it needs no .template on a dependent receiver AND disambiguates cleanly from the template form.


take_along

const inline noexcept

template<long... Axes, class... Args> inline auto take_along(axis< Axes... >, Args... args) const noexcept

Defined in include/teeny/tensor.h:787


permute

inline noexcept

template<long... Perm> inline auto permute() noexcept

Defined in include/teeny/tensor.h:791

Reorder the axes (a permutation of 0..N-1; negatives wrap) -> a rank-N view.


permute

const inline noexcept

template<long... Perm> inline auto permute() const noexcept

Defined in include/teeny/tensor.h:794


flip

inline noexcept

template<long Ax = 0> inline auto flip() noexcept

Defined in include/teeny/tensor.h:800

Reverse axis Ax (negatives wrap) -> a view (numpy flip).

Uses a negative stride, so the index type must be signed (shape<...> is).


flip

const inline noexcept

template<long Ax = 0> inline auto flip() const noexcept

Defined in include/teeny/tensor.h:803


clone

const inline

template<bool S = is_static, enable_if_t<!S, int > = 0> inline auto clone() const

Defined in include/teeny/tensor.h:817


to

const inline &

template<class T2 = element_type, bool Force = false, enable_if_t<!Force &&is_same< T2, element_type >::value, int > = 0> inline auto to() const &

Defined in include/teeny/tensor.h:854

pytorch-like .to<T2>(): convert the element type to T2.

No copy when it already matches — if T2 is the current element type and Force is false, this returns a (read-only) view of *this, no allocation, keeping the source layout. So x.to<>() is a zero-cost borrow, not a clone. Because it borrows, the result must not outlive the storage it points at — the same lifetime rule as [view()](#view-1)/[permute()](#permute)/slicing. Pass Force = true to always materialise a fresh owning copy even when the dtype already matches (x.to<float, true>() force-clones a float tensor); x.clone() is the unconditional-copy spelling.

On a temporary the borrow is only taken when it cannot dangle: a non-owning view rvalue (view/gpu_view — e.g. a slice or .to<>() result) points at storage owned elsewhere, so borrowing from it is safe and stays zero-cost. An owning rvalue (stack/heap/gpu/pinned/ mapped) would carry its storage off, so its matching-dtype case forces a fresh owning copy instead of a dangling borrow (mirroring the free to<Space>(tensor&&)).

When a conversion IS needed (T2 differs, or Force), the result is a dense, row-major OWNING copy cast elementwise (via copy_): static shape -> stack (host+device), dynamic -> heap (host only). The copy runs on the HOST, so it cannot dereference DEVICE memory: the dynamic-shape (_TNY_HOST) copying overload static_asserts that the source is host-accessible. To also move across memory spaces (host <-> CUDA) — or to convert a gpu/gpu_view tensor at all — use the to<[storage::gpu](#namespacetny_1a269cef88b5ff5cb896f1766df7f21508a0aa0be2a866411d9ff03515227454947), T2, Force>(x) free functions from <[teeny/cuda.h](#cudah)>, which copy device-aware.


to

const inline &

template<class T2 = element_type, bool Force = false, bool S = is_static, enable_if_t<(Force||!is_same< T2, element_type >::value) &&!S, int > = 0> inline auto to() const &

Defined in include/teeny/tensor.h:862


to

const inline &&

template<class T2 = element_type, bool Force = false, enable_if_t< storage_is_view(O) &&!Force &&is_same< T2, element_type >::value, int > = 0> inline auto to() const &&

Defined in include/teeny/tensor.h:881


to

const inline &&

template<class T2 = element_type, bool Force = false, bool S = is_static, enable_if_t<!(storage_is_view(O) &&!Force &&is_same< T2, element_type >::value) &&!S, int > = 0> inline auto to() const &&

Defined in include/teeny/tensor.h:889


reshape

inline noexcept

template<long... NewExt> inline auto reshape() noexcept

Defined in include/teeny/tensor.h:995

View this tensor as a new shape — numpy semantics: a VIEW whenever the layout can be regrouped without a copy (not only when C-contiguous; a strided/permuted source often still views — split a contiguous axis, merge a contiguous run).

The output is a folded strides<...> view (compile-time strides when the source is fully static). One extent may be -1 (numpy-style), inferred from the total size: t.reshape<6,-1>(). A non-viewable reshape is a compile error (static source) or a debug check (dynamic) — [clone()](#clone) first, or query can_reshape_without_copy.


reshape

const inline noexcept

template<long... NewExt> inline auto reshape() const noexcept

Defined in include/teeny/tensor.h:996


can_reshape_without_copy

const inline noexcept

template<long... NewExt> inline bool can_reshape_without_copy() const noexcept

Defined in include/teeny/tensor.h:1005

Whether reshape<NewExt...>() can produce a VIEW (no copy) of this tensor's actual layout — numpy's rule: not just C-contiguity, but any stride-compatible regrouping (splitting an axis, merging a contiguous run).

One -1 may be inferred. false -> the reshape needs a [clone()](#clone). (The result type of a viewable reshape is a folded strides<...> view.)


recast

inline

template<class NewShape, class NewLayout = keep_strides> inline auto recast()

Defined in include/teeny/tensor.h:1077

Reinterpret with a MORE-STATIC extents type of the same rank — recover statically-known inner dims at the dynamic (ndarray) boundary: a runtime (n,3,3) view -> .recast<shape<-1,3,3>>() so the 3s (extents) fold.

NewLayout chooses the STRIDES (default [keep_strides](#keep_strides)):

  • [keep_strides](#keep_strides) (default) — PRESERVE the source strides; works on ANY layout (no copy, no contiguity requirement), a strided/transposed source keeps its strides, a dynamic_strides source keeps them at run time. Never mis-addresses.

  • ccontiguous/fcontiguous — reinterpret AS that order, deriving the strides from the extents (folds the inner unit stride). The "I promise this is contiguous" form — UB if it isn't.

  • strides<S...> — impose those (static) strides; a dynamic_stride slot comes from the source.

Each static dim of NewShape is validated against the actual extent. Functional form: [recast(shape_value, layout_value)](#recast-4) (both may mix static/dynamic; the runtime values only deduce the types).


recast

const inline

template<class NewShape, class NewLayout = keep_strides> inline auto recast() const

Defined in include/teeny/tensor.h:1079


index_fits

const inline noexcept

template<class Idx2> inline bool index_fits() const noexcept

Defined in include/teeny/tensor.h:1088

Does every element offset of this view fit the index type Idx2? Computes the SIGNED reach directly (teeny has negative-stride views, so required_span_size's non-negative assumption doesn't apply): max = Σ_{s>0}(e−1)·s, min = Σ_{s<0}(e−1)·s; fits ⟺ min..maxIdx2.

Accumulates in a wide type; a broadcast (stride-0) axis adds 0. The precondition reindex<Idx2>() debug-checks.


reindex

inline

template<class Idx2> inline auto reindex()

Defined in include/teeny/tensor.h:1109

No-copy, layout-preserving retype of the offset index width to Idx2: same pointer, same layout KIND, the extents' index_type and any dynamic strides narrowed to Idx2 (a strides<...> literal pack is unchanged).

Narrowing the boundary view to shape32 halves the by-value footprint and runs offset math in 32-bit (big device win). Orthogonal to recast (which staticizes the extent VALUES) — they compose. Debug-checks index_fits<Idx2>(); UB if the caller lies (same contract as u*).


reindex

const inline

template<class Idx2> inline auto reindex() const

Defined in include/teeny/tensor.h:1114


flatten

inline noexcept

inline auto flatten() noexcept

Defined in include/teeny/tensor.h:1123

View as 1-D (ravel) — a VIEW whenever the layout is mergeable into a single contiguous run without a copy (numpy semantics; [clone()](#clone) first otherwise).

Just reshape<-1>() (one inferred dim), spelled out for discoverability.


flatten

const inline noexcept

inline auto flatten() const noexcept

Defined in include/teeny/tensor.h:1124


unsqueeze

inline noexcept

template<long Ax = 0> inline auto unsqueeze() noexcept

Defined in include/teeny/tensor.h:1130

Insert a size-1 axis at position Ax (numpy newaxis/unsqueeze) -> a rank-(N+1) view.

Negative Ax counts from the back, so .unsqueeze<-1>() appends a trailing axis: (H,W) -> (H,W,1).


unsqueeze

const inline noexcept

template<long Ax = 0> inline auto unsqueeze() const noexcept

Defined in include/teeny/tensor.h:1133


unsqueeze

inline noexcept

template<long Ax0, long Ax1, long... Rest> inline auto unsqueeze() noexcept

Defined in include/teeny/tensor.h:1143

Insert size-1 axes at SEVERAL positions at once (numpy expand_dims(a, axis=(...))) -> a rank-(N+k) view.

The positions are relative to the final rank N + k (negatives count from the back of it), and must be distinct & ascending — e.g. (H,W).unsqueeze<1,3>() -> (H,1,W,1), (H,W).unsqueeze<0,-1>() -> (1,H,W,1). Arity picks this overload; one axis still means unsqueeze<Ax>() above.


unsqueeze

const inline noexcept

template<long Ax0, long Ax1, long... Rest> inline auto unsqueeze() const noexcept

Defined in include/teeny/tensor.h:1153


squeeze

inline noexcept

template<long Ax = _ax_all> inline auto squeeze() noexcept

Defined in include/teeny/tensor.h:1185

Drop a size-1 axis Ax (negatives wrap) -> a rank-(N-1) view.

[squeeze()](#squeeze) (no axis) drops EVERY statically-size-1 axis.


squeeze

const inline noexcept

template<long Ax = _ax_all> inline auto squeeze() const noexcept

Defined in include/teeny/tensor.h:1194


squeeze

inline noexcept

template<long Ax0, long Ax1, long... Rest> inline auto squeeze() noexcept

Defined in include/teeny/tensor.h:1211

Drop SEVERAL size-1 axes at once (numpy squeeze(axis=(...))) -> a rank-(N-k) view.

The positions are relative to the source rank (negatives count from the back) and must be distinct & ascending; every named axis must have extent 1 (static_assert where the extent is static, _TNY_CHECK where it is dynamic). e.g. a (1,H,1,W) view .squeeze<0,2>() -> (H,W). Arity picks this overload; one axis (or none) still means squeeze<Ax>() above.


squeeze

const inline noexcept

template<long Ax0, long Ax1, long... Rest> inline auto squeeze() const noexcept

Defined in include/teeny/tensor.h:1222


flip

inline noexcept

template<class I, enable_if_t< _is_ic< I >::value, int > = 0> inline auto flip(I) noexcept

Defined in include/teeny/tensor.h:1237


flip

const inline noexcept

template<class I, enable_if_t< _is_ic< I >::value, int > = 0> inline auto flip(I) const noexcept

Defined in include/teeny/tensor.h:1238


squeeze

inline noexcept

template<class I, enable_if_t< _is_ic< I >::value, int > = 0> inline auto squeeze(I) noexcept

Defined in include/teeny/tensor.h:1239


squeeze

const inline noexcept

template<class I, enable_if_t< _is_ic< I >::value, int > = 0> inline auto squeeze(I) const noexcept

Defined in include/teeny/tensor.h:1240


unsqueeze

inline noexcept

template<class I, enable_if_t< _is_ic< I >::value, int > = 0> inline auto unsqueeze(I) noexcept

Defined in include/teeny/tensor.h:1241


unsqueeze

const inline noexcept

template<class I, enable_if_t< _is_ic< I >::value, int > = 0> inline auto unsqueeze(I) const noexcept

Defined in include/teeny/tensor.h:1242


permute

inline noexcept

template<class... I, enable_if_t<(sizeof...(I) > 0) &&(_is_ic< I >::value &&...), int > = 0> inline auto permute(I...) noexcept

Defined in include/teeny/tensor.h:1243


permute

const inline noexcept

template<class... I, enable_if_t<(sizeof...(I) > 0) &&(_is_ic< I >::value &&...), int > = 0> inline auto permute(I...) const noexcept

Defined in include/teeny/tensor.h:1244


reshape

inline noexcept

template<class... I, enable_if_t<(sizeof...(I) > 0) &&(_is_ic< I >::value &&...), int > = 0> inline auto reshape(I...) noexcept

Defined in include/teeny/tensor.h:1245


reshape

const inline noexcept

template<class... I, enable_if_t<(sizeof...(I) > 0) &&(_is_ic< I >::value &&...), int > = 0> inline auto reshape(I...) const noexcept

Defined in include/teeny/tensor.h:1246


recast

inline

template<class NewE> inline auto recast(NewE)

Defined in include/teeny/tensor.h:1247


recast

const inline

template<class NewE> inline auto recast(NewE) const

Defined in include/teeny/tensor.h:1248


recast

inline

template<class NewE, class NewL> inline auto recast(NewE, NewL)

Defined in include/teeny/tensor.h:1253


recast

const inline

template<class NewE, class NewL> inline auto recast(NewE, NewL) const

Defined in include/teeny/tensor.h:1254


add_

template<bool Atomic = false, class B, enable_if_t<!is_arithmetic< B >::value, int > = 0> tensor & add_(const B & b)

Defined in include/teeny/tensor.h:1261


sub_

template<bool Atomic = false, class B, enable_if_t<!is_arithmetic< B >::value, int > = 0> tensor & sub_(const B & b)

Defined in include/teeny/tensor.h:1262


mul_

template<class B, enable_if_t<!is_arithmetic< B >::value, int > = 0> tensor & mul_(const B & b)

Defined in include/teeny/tensor.h:1263


div_

template<class B, enable_if_t<!is_arithmetic< B >::value, int > = 0> tensor & div_(const B & b)

Defined in include/teeny/tensor.h:1264


add_

template<bool Atomic = false> tensor & add_(T s)

Defined in include/teeny/tensor.h:1265


sub_

template<bool Atomic = false> tensor & sub_(T s)

Defined in include/teeny/tensor.h:1266


mul_

tensor & mul_(T s)

Defined in include/teeny/tensor.h:1267


div_

tensor & div_(T s)

Defined in include/teeny/tensor.h:1268


add_

template<class B, enable_if_t<!is_arithmetic< B >::value, int > = 0> tensor & add_(const B & b, T alpha)

Defined in include/teeny/tensor.h:1273


sub_

template<class B, enable_if_t<!is_arithmetic< B >::value, int > = 0> tensor & sub_(const B & b, T alpha)

Defined in include/teeny/tensor.h:1274


atomic_add_

template<class B, enable_if_t<!is_arithmetic< B >::value, int > = 0> tensor & atomic_add_(const B & b)

Defined in include/teeny/tensor.h:1283


atomic_sub_

template<class B, enable_if_t<!is_arithmetic< B >::value, int > = 0> tensor & atomic_sub_(const B & b)

Defined in include/teeny/tensor.h:1284


atomic_add_

tensor & atomic_add_(T s)

Defined in include/teeny/tensor.h:1285


atomic_sub_

tensor & atomic_sub_(T s)

Defined in include/teeny/tensor.h:1286


operator+=

inline

template<class B> inline tensor & operator+=(const B & b)

Defined in include/teeny/tensor.h:1290


operator-=

inline

template<class B> inline tensor & operator-=(const B & b)

Defined in include/teeny/tensor.h:1291


operator*=

inline

template<class B> inline tensor & operator*=(const B & b)

Defined in include/teeny/tensor.h:1292


operator/=

inline

template<class B> inline tensor & operator/=(const B & b)

Defined in include/teeny/tensor.h:1293


copy_

template<class B> tensor & copy_(const B & b)

Defined in include/teeny/tensor.h:1296


fill_

tensor & fill_(T s)

Defined in include/teeny/tensor.h:1297


zero_

tensor & zero_()

Defined in include/teeny/tensor.h:1298


iota_

tensor & iota_(T start = T(0), T step = T(1))

Defined in include/teeny/tensor.h:1299


add

const

template<class B> auto add(const B & b) const

Defined in include/teeny/tensor.h:1302


sub

const

template<class B> auto sub(const B & b) const

Defined in include/teeny/tensor.h:1303


mul

const

template<class B> auto mul(const B & b) const

Defined in include/teeny/tensor.h:1304


div

const

template<class B> auto div(const B & b) const

Defined in include/teeny/tensor.h:1305


pow

const

template<class B> auto pow(const B & b) const

Defined in include/teeny/tensor.h:1306


add

const

template<class B, class D> auto & add(const B & b, into_t< D > out) const

Defined in include/teeny/tensor.h:1308


sub

const

template<class B, class D> auto & sub(const B & b, into_t< D > out) const

Defined in include/teeny/tensor.h:1309


mul

const

template<class B, class D> auto & mul(const B & b, into_t< D > out) const

Defined in include/teeny/tensor.h:1310


div

const

template<class B, class D> auto & div(const B & b, into_t< D > out) const

Defined in include/teeny/tensor.h:1311


pow

const

template<class B, class D> auto & pow(const B & b, into_t< D > out) const

Defined in include/teeny/tensor.h:1312


add

const

template<class B, enable_if_t<!is_arithmetic< B >::value, int > = 0> auto add(const B & b, T alpha) const

Defined in include/teeny/tensor.h:1316


sub

const

template<class B, enable_if_t<!is_arithmetic< B >::value, int > = 0> auto sub(const B & b, T alpha) const

Defined in include/teeny/tensor.h:1317


add

const

template<class B, class D, enable_if_t<!is_arithmetic< B >::value, int > = 0> auto & add(const B & b, T alpha, into_t< D > out) const

Defined in include/teeny/tensor.h:1318


sub

const

template<class B, class D, enable_if_t<!is_arithmetic< B >::value, int > = 0> auto & sub(const B & b, T alpha, into_t< D > out) const

Defined in include/teeny/tensor.h:1319


maximum

const

template<class B> auto maximum(const B & b) const

Defined in include/teeny/tensor.h:1336


minimum

const

template<class B, class D> auto & minimum(const B & b, into_t< D > out) const

Defined in include/teeny/tensor.h:1337


maximum

const

template<class B, class D> auto & maximum(const B & b, into_t< D > out) const

Defined in include/teeny/tensor.h:1338


clamp

const

auto clamp(T lo, T hi) const

Defined in include/teeny/tensor.h:1339


clamp

const

template<class D> auto & clamp(T lo, T hi, into_t< D > out) const

Defined in include/teeny/tensor.h:1340


normalize

const

auto normalize() const

Defined in include/teeny/tensor.h:1341


normalize

const

template<class D> auto & normalize(into_t< D > out) const

Defined in include/teeny/tensor.h:1342


cross

const

template<class Tb, class Eb, class Lb, storage Ob> auto cross(const tensor< Tb, Eb, Lb, Ob > & b) const

Defined in include/teeny/tensor.h:1343


cross

const

template<class Tb, class Eb, class Lb, storage Ob, class D> auto & cross(const tensor< Tb, Eb, Lb, Ob > & b, into_t< D > out) const

Defined in include/teeny/tensor.h:1344


map_

template<class F> tensor & map_(F f)

Defined in include/teeny/tensor.h:1350


zip_with_

template<class G, class B> tensor & zip_with_(G g, const B & b)

Defined in include/teeny/tensor.h:1351


map

const

template<class F> auto map(F f) const

Defined in include/teeny/tensor.h:1352


all

const

bool all() const

Defined in include/teeny/tensor.h:1356


any

const

bool any() const

Defined in include/teeny/tensor.h:1357


dot

const

class Eb class Lb storage Ob auto dot(const tensor< Tb, Eb, Lb, Ob > & b) const

Defined in include/teeny/tensor.h:1396


dot

const

template<class Acc = void, class Tb, class Eb, class Lb, storage Ob, class D> auto & dot(const tensor< Tb, Eb, Lb, Ob > & b, into_t< D > out) const

Defined in include/teeny/tensor.h:1398


neg_

tensor & neg_()

Defined in include/teeny/tensor.h:1401


abs_

tensor & abs_()

Defined in include/teeny/tensor.h:1402


exp_

tensor & exp_()

Defined in include/teeny/tensor.h:1403


log_

tensor & log_()

Defined in include/teeny/tensor.h:1404


sin_

tensor & sin_()

Defined in include/teeny/tensor.h:1405


cos_

tensor & cos_()

Defined in include/teeny/tensor.h:1406


sqrt_

tensor & sqrt_()

Defined in include/teeny/tensor.h:1407


tanh_

tensor & tanh_()

Defined in include/teeny/tensor.h:1408


floor_

tensor & floor_()

Defined in include/teeny/tensor.h:1409


ceil_

tensor & ceil_()

Defined in include/teeny/tensor.h:1410


round_

tensor & round_()

Defined in include/teeny/tensor.h:1411


trunc_

tensor & trunc_()

Defined in include/teeny/tensor.h:1412


sign_

tensor & sign_()

Defined in include/teeny/tensor.h:1413


pow_

tensor & pow_(T e)

Defined in include/teeny/tensor.h:1414


clamp_

tensor & clamp_(T lo, T hi)

Defined in include/teeny/tensor.h:1415


normalize_

tensor & normalize_()

Defined in include/teeny/tensor.h:1416


normalize_

template<long... Axes> tensor & normalize_()

Defined in include/teeny/tensor.h:1417


cross_

template<class Tb, class Eb, class Lb, storage Ob> tensor & cross_(const tensor< Tb, Eb, Lb, Ob > & b)

Defined in include/teeny/tensor.h:1419


operator++

inline

inline tensor & operator++()

Defined in include/teeny/tensor.h:1425


operator--

inline

inline tensor & operator--()

Defined in include/teeny/tensor.h:1426


operator++

inline

template<bool S = is_static, enable_if_t< S, int > = 0> inline tensor< T, Shape, ccontiguous, storage::stack > operator++(int)

Defined in include/teeny/tensor.h:1428


operator--

inline

template<bool S = is_static, enable_if_t< S, int > = 0> inline tensor< T, Shape, ccontiguous, storage::stack > operator--(int)

Defined in include/teeny/tensor.h:1430


add_

template<bool Atomic, class B, enable_if_t<!is_arithmetic< B >::value, int >> tensor< T, E, L, O > & add_(const B & b)

Defined in include/teeny/math.h:746


sub_

template<bool Atomic, class B, enable_if_t<!is_arithmetic< B >::value, int >> tensor< T, E, L, O > & sub_(const B & b)

Defined in include/teeny/math.h:752


mul_

template<class B, enable_if_t<!is_arithmetic< B >::value, int >> tensor< T, E, L, O > & mul_(const B & b)

Defined in include/teeny/math.h:758


div_

template<class B, enable_if_t<!is_arithmetic< B >::value, int >> tensor< T, E, L, O > & div_(const B & b)

Defined in include/teeny/math.h:760


add_

template<bool Atomic> tensor< T, E, L, O > & add_(T s)

Defined in include/teeny/math.h:762


sub_

template<bool Atomic> tensor< T, E, L, O > & sub_(T s)

Defined in include/teeny/math.h:768


add_

template<class B, enable_if_t<!is_arithmetic< B >::value, int >> tensor< T, E, L, O > & add_(const B & b, T alpha)

Defined in include/teeny/math.h:777


sub_

template<class B, enable_if_t<!is_arithmetic< B >::value, int >> tensor< T, E, L, O > & sub_(const B & b, T alpha)

Defined in include/teeny/math.h:779


atomic_add_

template<class B, enable_if_t<!is_arithmetic< B >::value, int >> tensor< T, E, L, O > & atomic_add_(const B & b)

Defined in include/teeny/math.h:783


atomic_sub_

template<class B, enable_if_t<!is_arithmetic< B >::value, int >> tensor< T, E, L, O > & atomic_sub_(const B & b)

Defined in include/teeny/math.h:785


copy_

template<class B> tensor< T, E, L, O > & copy_(const B & b)

Defined in include/teeny/math.h:789


map_

template<class F> tensor< T, E, L, O > & map_(F f)

Defined in include/teeny/math.h:939


zip_with_

template<class G, class B> tensor< T, E, L, O > & zip_with_(G g, const B & b)

Defined in include/teeny/math.h:941


cross_

template<class Tb, class Eb, class Lb, storage Ob> tensor< T, E, L, O > & cross_(const tensor< Tb, Eb, Lb, Ob > & b)

Defined in include/teeny/math.h:1307


normalize_

template<long... Axes> tensor< T, E, L, O > & normalize_()

Defined in include/teeny/math.h:1323


minimum

const

template<class B> u_abs u_log u_cos u_tanh u_ceil u_trunc auto minimum(const B & b) const

Defined in include/teeny/math.h:1533

Public Static Attributes

Return Name Description
constexpr storage ownership static constexpr
constexpr bool is_static static constexpr
constexpr bool is_view static constexpr
constexpr bool is_owning static constexpr
constexpr bool is_device static constexpr
constexpr bool is_host_accessible static constexpr
constexpr size_t buffer_size static constexpr
constexpr bool is_strides_layout static constexpr
constexpr bool is_contiguous_layout static constexpr

ownership

static constexpr

constexpr storage ownership = O

Defined in include/teeny/tensor.h:206


is_static

static constexpr

constexpr bool is_static = (Shape::rank_dynamic() == 0)

Defined in include/teeny/tensor.h:207


is_view

static constexpr

constexpr bool is_view = (O)

Defined in include/teeny/tensor.h:209


is_owning

static constexpr

constexpr bool is_owning = (O)

Defined in include/teeny/tensor.h:210


is_device

static constexpr

constexpr bool is_device = (O)

Defined in include/teeny/tensor.h:211


is_host_accessible

static constexpr

constexpr bool is_host_accessible = (O)

Defined in include/teeny/tensor.h:212


buffer_size

static constexpr

constexpr size_t buffer_size = <, O == >::value

Defined in include/teeny/tensor.h:213


is_strides_layout

static constexpr

constexpr bool is_strides_layout = _is_strides<Layout>::value

Defined in include/teeny/tensor.h:273


is_contiguous_layout

static constexpr

constexpr bool is_contiguous_layout = _contiguous_layout<Layout>::value

Defined in include/teeny/tensor.h:274

Public Static Methods

Return Name Description
constexpr size_t rank static inline constexpr noexcept

rank

static inline constexpr noexcept

constexpr static inline constexpr size_t rank() noexcept

Defined in include/teeny/tensor.h:270

Public Types

Name Description
element_type
extents_type
shape_type
layout_type
index_type
mapping_type
view_type
const_view_type

element_type

using element_type = T

Defined in include/teeny/tensor.h:197


extents_type

using extents_type = Shape

Defined in include/teeny/tensor.h:198


shape_type

using shape_type = Shape

Defined in include/teeny/tensor.h:199


layout_type

using layout_type = Layout

Defined in include/teeny/tensor.h:200


index_type

using index_type = typename Shape::index_type

Defined in include/teeny/tensor.h:201


mapping_type

using mapping_type = typename Layout::template mapping< Shape >

Defined in include/teeny/tensor.h:202


view_type

using view_type = mdspan< T, Shape, Layout >

Defined in include/teeny/tensor.h:203


const_view_type

using const_view_type = mdspan< const T, Shape, Layout >

Defined in include/teeny/tensor.h:204

mapping

#include <layout.h>
template<class Shape>
struct mapping

Defined in include/teeny/layout.h:82

Inherits: ndyn()>, Shape

List of all members

Name Kind Owner
mapping function Declared here
mapping function Declared here
mapping function Declared here
extents function Declared here
stride function Declared here
operator() function Declared here
required_span_size function Declared here
is_unique function Declared here
is_exhaustive function Declared here
is_strided function Declared here
is_always_unique function Declared here
is_always_exhaustive function Declared here
is_always_strided function Declared here
extents_type typedef Declared here
index_type typedef Declared here
rank_type typedef Declared here
layout_type typedef Declared here

Public Methods

Return Name Description
mapping Defaulted constructor.
constexpr mapping inline constexpr Fully-static strides: construct from extents only.
constexpr mapping inline constexpr Mixed strides: extents + the runtime strides (dim order, dynamic ones only).
constexpr const Shape & extents const inline constexpr noexcept
constexpr index_type stride const inline constexpr noexcept
constexpr index_type operator() const inline constexpr noexcept
constexpr index_type required_span_size const inline constexpr noexcept
constexpr bool is_unique const inline constexpr noexcept
constexpr bool is_exhaustive const inline constexpr noexcept
constexpr bool is_strided const inline constexpr noexcept

mapping

mapping() = default

Defined in include/teeny/layout.h:90

Defaulted constructor.


mapping

inline constexpr

template<size_t M = strides::ndyn(), enable_if_t< M==0, int > = 0> constexpr inline constexpr mapping(const Shape & e)

Defined in include/teeny/layout.h:94

Fully-static strides: construct from extents only.


mapping

inline constexpr

template<class OtherIdx> constexpr inline constexpr mapping(const Shape & e, const array< OtherIdx, strides::ndyn()> & dyn)

Defined in include/teeny/layout.h:111

Mixed strides: extents + the runtime strides (dim order, dynamic ones only).

Templated on the array's element type so a reindex (narrowing the offset index width) can pass its wider source strides — each is cast to index_type; symmetric with mdspan's layout_stride.


extents

const inline constexpr noexcept

constexpr inline constexpr const Shape & extents() const noexcept

Defined in include/teeny/layout.h:114


stride

const inline constexpr noexcept

constexpr inline constexpr index_type stride(rank_type r) const noexcept

Defined in include/teeny/layout.h:115


operator()

const inline constexpr noexcept

template<class... I> constexpr inline constexpr index_type operator()(I... i) const noexcept

Defined in include/teeny/layout.h:119


required_span_size

const inline constexpr noexcept

constexpr inline constexpr index_type required_span_size() const noexcept

Defined in include/teeny/layout.h:125


is_unique

const inline constexpr noexcept

constexpr inline constexpr bool is_unique() const noexcept

Defined in include/teeny/layout.h:136


is_exhaustive

const inline constexpr noexcept

constexpr inline constexpr bool is_exhaustive() const noexcept

Defined in include/teeny/layout.h:137


is_strided

const inline constexpr noexcept

constexpr inline constexpr bool is_strided() const noexcept

Defined in include/teeny/layout.h:138

Public Static Methods

Return Name Description
constexpr bool is_always_unique static inline constexpr noexcept
constexpr bool is_always_exhaustive static inline constexpr noexcept
constexpr bool is_always_strided static inline constexpr noexcept

is_always_unique

static inline constexpr noexcept

constexpr static inline constexpr bool is_always_unique() noexcept

Defined in include/teeny/layout.h:133


is_always_exhaustive

static inline constexpr noexcept

constexpr static inline constexpr bool is_always_exhaustive() noexcept

Defined in include/teeny/layout.h:134


is_always_strided

static inline constexpr noexcept

constexpr static inline constexpr bool is_always_strided() noexcept

Defined in include/teeny/layout.h:135

Public Types

Name Description
extents_type
index_type
rank_type
layout_type

extents_type

using extents_type = Shape

Defined in include/teeny/layout.h:83


index_type

using index_type = typename Shape::index_type

Defined in include/teeny/layout.h:84


rank_type

using rank_type = typename Shape::rank_type

Defined in include/teeny/layout.h:85


layout_type

using layout_type = strides

Defined in include/teeny/layout.h:86

item

#include <iterate.h>
struct item

Defined in include/teeny/iterate.h:223

List of all members

Name Kind Owner
index variable Declared here
cell variable Declared here

Public Attributes

Return Name Description
array< index_type, Nd ? Nd :1 > index
Cell cell

index

array< index_type, Nd ? Nd :1 > index

Defined in include/teeny/iterate.h:223


cell

Cell cell

Defined in include/teeny/iterate.h:223

item

#include <dynamic.h>
struct item

Defined in include/teeny/dynamic.h:509

List of all members

Name Kind Owner
index variable Declared here
cell variable Declared here

Public Attributes

Return Name Description
coord index
Cell cell

index

coord index

Defined in include/teeny/dynamic.h:509


cell

Cell cell

Defined in include/teeny/dynamic.h:509

coord

#include <dynamic.h>
struct coord

Defined in include/teeny/dynamic.h:503

List of all members

Name Kind Owner
ctr variable Declared here
nb variable Declared here
lin variable Declared here
operator[] function Declared here
rank function Declared here
linear function Declared here

Public Attributes

Return Name Description
const offset_t * ctr
int nb
offset_t lin

ctr

const offset_t * ctr

Defined in include/teeny/dynamic.h:504


nb

int nb

Defined in include/teeny/dynamic.h:504


lin

offset_t lin

Defined in include/teeny/dynamic.h:504

Public Methods

Return Name Description
offset_t operator[] const inline noexcept
int rank const inline noexcept
offset_t linear const inline noexcept

operator[]

const inline noexcept

inline offset_t operator[](int d) const noexcept

Defined in include/teeny/dynamic.h:505


rank

const inline noexcept

inline int rank() const noexcept

Defined in include/teeny/dynamic.h:506


linear

const inline noexcept

inline offset_t linear() const noexcept

Defined in include/teeny/dynamic.h:507

iterator

#include <iterate.h>
struct iterator

Defined in include/teeny/iterate.h:171

List of all members

Name Kind Owner
tmpl variable Declared here
base variable Declared here
cur variable Declared here
operator* function Declared here
operator++ function Declared here
operator!= function Declared here
operator== function Declared here
index function Declared here
index function Declared here

Public Attributes

Return Name Description
Cell tmpl
El * base
_md::peel_cursor< index_type, Nd > cur

tmpl

Cell tmpl

Defined in include/teeny/iterate.h:172


base

El * base

Defined in include/teeny/iterate.h:173


cur

_md::peel_cursor< index_type, Nd > cur

Defined in include/teeny/iterate.h:174

Public Methods

Return Name Description
Cell operator* const inline
iterator & operator++ inline
bool operator!= const inline
bool operator== const inline
index_type index const inline noexcept
array< index_type, Nd ? Nd :1 > index const inline noexcept

operator*

const inline

inline Cell operator*() const

Defined in include/teeny/iterate.h:175


operator++

inline

inline iterator & operator++()

Defined in include/teeny/iterate.h:176


operator!=

const inline

inline bool operator!=(const iterator & o) const

Defined in include/teeny/iterate.h:177


operator==

const inline

inline bool operator==(const iterator & o) const

Defined in include/teeny/iterate.h:178


index

const inline noexcept

inline index_type index(size_t d) const noexcept

Defined in include/teeny/iterate.h:183


index

const inline noexcept

inline array< index_type, Nd ? Nd :1 > index() const noexcept

Defined in include/teeny/iterate.h:184

enum_range

#include <iterate.h>
struct enum_range

Defined in include/teeny/iterate.h:231

List of all members

Name Kind Owner
r variable Declared here
begin function Declared here
end function Declared here
subrange function Declared here

Public Attributes

Return Name Description
peel_range r

r

peel_range r

Defined in include/teeny/iterate.h:232

Public Methods

Return Name Description
enum_iterator begin const inline
enum_iterator end const inline
enum_subrange subrange const inline

begin

const inline

inline enum_iterator begin() const

Defined in include/teeny/iterate.h:233


end

const inline

inline enum_iterator end() const

Defined in include/teeny/iterate.h:234


subrange

const inline

inline enum_subrange subrange(index_type lo, index_type hi) const

Defined in include/teeny/iterate.h:240

enum_subrange

#include <iterate.h>
struct enum_subrange

Defined in include/teeny/iterate.h:235

List of all members

Name Kind Owner
b variable Declared here
e variable Declared here
begin function Declared here
end function Declared here

Public Attributes

Return Name Description
enum_iterator b
enum_iterator e

b

enum_iterator b

Defined in include/teeny/iterate.h:236


e

enum_iterator e

Defined in include/teeny/iterate.h:236

Public Methods

Return Name Description
enum_iterator begin const inline
enum_iterator end const inline

begin

const inline

inline enum_iterator begin() const

Defined in include/teeny/iterate.h:237


end

const inline

inline enum_iterator end() const

Defined in include/teeny/iterate.h:238

iterator

#include <dynamic.h>
struct iterator

Defined in include/teeny/dynamic.h:437

List of all members

Name Kind Owner
tmpl variable Declared here
base variable Declared here
ctr variable Declared here
ext variable Declared here
str variable Declared here
nb variable Declared here
off variable Declared here
lin variable Declared here
operator* function Declared here
operator++ function Declared here
operator!= function Declared here
operator== function Declared here
index function Declared here
nbatch function Declared here
linear function Declared here

Public Attributes

Return Name Description
Cell tmpl
T * base
offset_t ctr
offset_t ext
offset_t str
int nb
offset_t off
offset_t lin

tmpl

Cell tmpl

Defined in include/teeny/dynamic.h:438


base

T * base

Defined in include/teeny/dynamic.h:439


ctr

offset_t ctr

Defined in include/teeny/dynamic.h:440


ext

offset_t ext

Defined in include/teeny/dynamic.h:441


str

offset_t str

Defined in include/teeny/dynamic.h:442


nb

int nb

Defined in include/teeny/dynamic.h:443


off

offset_t off

Defined in include/teeny/dynamic.h:444


lin

offset_t lin

Defined in include/teeny/dynamic.h:444

Public Methods

Return Name Description
Cell operator* const inline
iterator & operator++ inline
bool operator!= const inline
bool operator== const inline
offset_t index const inline noexcept
int nbatch const inline noexcept
offset_t linear const inline noexcept

operator*

const inline

inline Cell operator*() const

Defined in include/teeny/dynamic.h:445


operator++

inline

inline iterator & operator++()

Defined in include/teeny/dynamic.h:446


operator!=

const inline

inline bool operator!=(const iterator & o) const

Defined in include/teeny/dynamic.h:454


operator==

const inline

inline bool operator==(const iterator & o) const

Defined in include/teeny/dynamic.h:455


index

const inline noexcept

inline offset_t index(int d) const noexcept

Defined in include/teeny/dynamic.h:461


nbatch

const inline noexcept

inline int nbatch() const noexcept

Defined in include/teeny/dynamic.h:462


linear

const inline noexcept

inline offset_t linear() const noexcept

Defined in include/teeny/dynamic.h:463

subrange_t

#include <iterate.h>
struct subrange_t

Defined in include/teeny/iterate.h:205

A [lo, hi) slice of the cells for chunked/threaded sweeps: seed the incremental cursor once at lo, then O(1) per step within the chunk.

(Split [0,[size()](#size-3)) across threads/blocks; each sweeps its chunk.)

List of all members

Name Kind Owner
b variable Declared here
e variable Declared here
begin function Declared here
end function Declared here

Public Attributes

Return Name Description
iterator b
iterator e

b

iterator b

Defined in include/teeny/iterate.h:206


e

iterator e

Defined in include/teeny/iterate.h:206

Public Methods

Return Name Description
iterator begin const inline
iterator end const inline

begin

const inline

inline iterator begin() const

Defined in include/teeny/iterate.h:207


end

const inline

inline iterator end() const

Defined in include/teeny/iterate.h:208

enum_iterator

#include <iterate.h>
struct enum_iterator

Defined in include/teeny/iterate.h:224

List of all members

Name Kind Owner
it variable Declared here
operator* function Declared here
operator++ function Declared here
operator!= function Declared here
operator== function Declared here

Public Attributes

Return Name Description
iterator it

it

iterator it

Defined in include/teeny/iterate.h:225

Public Methods

Return Name Description
item operator* const inline
enum_iterator & operator++ inline
bool operator!= const inline
bool operator== const inline

operator*

const inline

inline item operator*() const

Defined in include/teeny/iterate.h:226


operator++

inline

inline enum_iterator & operator++()

Defined in include/teeny/iterate.h:227


operator!=

const inline

inline bool operator!=(const enum_iterator & o) const

Defined in include/teeny/iterate.h:228


operator==

const inline

inline bool operator==(const enum_iterator & o) const

Defined in include/teeny/iterate.h:229

enum_range

#include <dynamic.h>
struct enum_range

Defined in include/teeny/dynamic.h:517

List of all members

Name Kind Owner
r variable Declared here
begin function Declared here
end function Declared here
subrange function Declared here

Public Attributes

Return Name Description
anyrank_front r

r

anyrank_front r

Defined in include/teeny/dynamic.h:518

Public Methods

Return Name Description
enum_iterator begin const inline
enum_iterator end const inline
enum_subrange subrange const inline

begin

const inline

inline enum_iterator begin() const

Defined in include/teeny/dynamic.h:519


end

const inline

inline enum_iterator end() const

Defined in include/teeny/dynamic.h:520


subrange

const inline

inline enum_subrange subrange(offset_t lo, offset_t hi) const

Defined in include/teeny/dynamic.h:526

enum_subrange

#include <dynamic.h>
struct enum_subrange

Defined in include/teeny/dynamic.h:521

List of all members

Name Kind Owner
b variable Declared here
e variable Declared here
begin function Declared here
end function Declared here

Public Attributes

Return Name Description
enum_iterator b
enum_iterator e

b

enum_iterator b

Defined in include/teeny/dynamic.h:522


e

enum_iterator e

Defined in include/teeny/dynamic.h:522

Public Methods

Return Name Description
enum_iterator begin const inline
enum_iterator end const inline

begin

const inline

inline enum_iterator begin() const

Defined in include/teeny/dynamic.h:523


end

const inline

inline enum_iterator end() const

Defined in include/teeny/dynamic.h:524

subrange_t

#include <dynamic.h>
struct subrange_t

Defined in include/teeny/dynamic.h:484

A [lo, hi) slice of the batch cells for chunked/threaded sweeps: seed the incremental cursor once at lo, then O(1) per step.

Split [0, [size()](#size-2)) across threads/blocks; each sweeps its own chunk.

List of all members

Name Kind Owner
b variable Declared here
e variable Declared here
begin function Declared here
end function Declared here

Public Attributes

Return Name Description
iterator b
iterator e

b

iterator b

Defined in include/teeny/dynamic.h:485


e

iterator e

Defined in include/teeny/dynamic.h:485

Public Methods

Return Name Description
iterator begin const inline
iterator end const inline

begin

const inline

inline iterator begin() const

Defined in include/teeny/dynamic.h:486


end

const inline

inline iterator end() const

Defined in include/teeny/dynamic.h:487

enum_iterator

#include <dynamic.h>
struct enum_iterator

Defined in include/teeny/dynamic.h:510

List of all members

Name Kind Owner
it variable Declared here
operator* function Declared here
operator++ function Declared here
operator!= function Declared here
operator== function Declared here

Public Attributes

Return Name Description
iterator it

it

iterator it

Defined in include/teeny/dynamic.h:511

Public Methods

Return Name Description
item operator* const inline
enum_iterator & operator++ inline
bool operator!= const inline
bool operator== const inline

operator*

const inline

inline item operator*() const

Defined in include/teeny/dynamic.h:512


operator++

inline

inline enum_iterator & operator++()

Defined in include/teeny/dynamic.h:513


operator!=

const inline

inline bool operator!=(const enum_iterator & o) const

Defined in include/teeny/dynamic.h:514


operator==

const inline

inline bool operator==(const enum_iterator & o) const

Defined in include/teeny/dynamic.h:515

enum_subrange

#include <iterate.h>
struct enum_subrange

Defined in include/teeny/iterate.h:235

List of all members

Name Kind Owner
b variable Declared here
e variable Declared here
begin function Declared here
end function Declared here

Public Attributes

Return Name Description
enum_iterator b
enum_iterator e

b

enum_iterator b

Defined in include/teeny/iterate.h:236


e

enum_iterator e

Defined in include/teeny/iterate.h:236

Public Methods

Return Name Description
enum_iterator begin const inline
enum_iterator end const inline

begin

const inline

inline enum_iterator begin() const

Defined in include/teeny/iterate.h:237


end

const inline

inline enum_iterator end() const

Defined in include/teeny/iterate.h:238

enum_subrange

#include <dynamic.h>
struct enum_subrange

Defined in include/teeny/dynamic.h:521

List of all members

Name Kind Owner
b variable Declared here
e variable Declared here
begin function Declared here
end function Declared here

Public Attributes

Return Name Description
enum_iterator b
enum_iterator e

b

enum_iterator b

Defined in include/teeny/dynamic.h:522


e

enum_iterator e

Defined in include/teeny/dynamic.h:522

Public Methods

Return Name Description
enum_iterator begin const inline
enum_iterator end const inline

begin

const inline

inline enum_iterator begin() const

Defined in include/teeny/dynamic.h:523


end

const inline

inline enum_iterator end() const

Defined in include/teeny/dynamic.h:524

Generated by Moxygen