Skip to main content

TensorTypes.h File

Tensor dtype, axis semantics, layout token, and minimal DLPack-like structs. More...

Included Headers

#include <cstdint>

Namespaces Index

namespacesimaai
namespaceneat
namespacedlpack

Minimal DLPack-shaped structs for zero-copy interop with NumPy/PyTorch. More...

Classes Index

structDLDevice

DLPack device descriptor: type + numeric ID. More...

structDLDataType

DLPack scalar dtype: code + bit width + SIMD lane count. More...

structDLTensor

DLPack non-owning tensor view: pointer + shape + strides + dtype + device. More...

structDLManagedTensor

DLPack managed tensor: owning wrapper that calls deleter on destruction. More...

Description

Tensor dtype, axis semantics, layout token, and minimal DLPack-like structs.

This header defines the small enum vocabulary every tensor consumer needs: data type (TensorDType), per-axis semantic tag (TensorAxisSemantic, the long-term direction), legacy layout token (TensorLayout, transitional), plus minimal DLPack-shaped structs for zero-copy bridges to NumPy/PyTorch via the standard DLPack interchange format.

See Also

TensorCore.h for the Tensor struct that uses these

See Also

"TensorAxisSemantic" rationale (§0.10 of the design deep dive)

File Listing

The file content with the documentation metadata removed is:

1
14#pragma once
15
16#include <cstdint>
17
18namespace simaai::neat {
19
28namespace dlpack {
29
31enum class DLDeviceType : int {
32 kDLCPU = 1,
33};
34
36struct DLDevice {
39};
40
42enum DLDataTypeCode : uint8_t {
43 kDLInt = 0,
44 kDLUInt = 1,
46};
47
49struct DLDataType {
50 uint8_t code;
51 uint8_t bits;
52 uint16_t lanes;
53};
54
56struct DLTensor {
57 void* data;
59 int ndim;
61 int64_t* shape;
62 int64_t* strides;
63 uint64_t byte_offset;
64};
65
69 void* manager_ctx;
70 void (*deleter)(DLManagedTensor* self);
71};
72
73} // namespace dlpack
74
83enum class TensorDType {
84 UInt8,
85 Int8,
86 UInt16,
87 Int16,
88 Int32,
90 Float32,
91 Float64,
92};
93
103enum class TensorAxisSemantic : uint8_t {
104 Unknown = 0,
105 N,
106 D,
107 H,
108 W,
109 C,
110};
111
122enum class TensorLayout {
123 Unknown = 0,
124 HWC,
125 CHW,
126 HW,
127};
128
129} // namespace simaai::neat

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.