Skip to content

Commit

Permalink
initial tensor folder with type and memory comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelgsharp committed Feb 21, 2024
1 parent 62d47b6 commit 6c81f98
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions proposed/tensor/type-and-memory-comparison.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

| | libTorch | ONNX | Numpy | TensorFlow | Julia |
| --- | --- | --- | --- | --- | --- |
| **Types Supported** | | | | | |
| | | | | |
| byte | X | X | | X | X | X |
| sbyte | X | X | X | X | X |
| ushort | X | X | X | X | X |
| short | X | X | X | X | X |
| int | X | X | X | X | X |
| uint | X | X | X | X | X |
| long | X | X | X | X | X |
| ulong | X | X | X | X | X |
| bool (byte) | X | X | X | X | X |
| string (bytes) | | X | X | X
| string (unicode) | | | X |
| string (c++ std::string) | | X | |
| float | X | X | X | X | X |
| float16 | X | X | X | X | X |
| bfloat16 | X | X | | X |
| double | X | X | X | X | X |
| complex64 | X | | X | X | X |
| complex128 | X | | X | X
| long double (either 96 or 128 bits) | | | X | X |
| long double complex (either 192 or 256 bits) | | | X | |
| Timedelta | | | X | |
| Datetime | | | X | |
| PythonObjects | | | X | |
| Raw Data | | | X | |
| qint8 (quantized int) | X | | | X | |
| qint16 (quantized int) | | | | X | |
| qint32 (quantized int) | | | | X | |
| qint32 (quantized int) | X | | | X | |
| quint8 (quantized unsigned int) | X | | | X | |
| quint16 (quantized unsigned int) | | | | X | |
| quint32 (quantized unsigned int) | | | | X | |
| quint64 (quantized unsigned int) | | | | X | |
| quint2x4 | X | | | |
| quint4x2 | X | | | |
| Handle to mutable resource | | | | X | |
| | | | | |
| **Other** | | | | | |
| | | | | |
| Supports Contiguous Memory | X | X | X | X | |
| Supports Non-Contiguous Memory | | | X | X | |
| Supports Sparse Tensors | X | | X | X | |


* Both Numpy and TensorFlow support Non-Contiguous memory, but its often less performant
* OnnxRuntime technically supports sparse tensors, but no kernels actually use them and they are not exposed in C#
* Other frameworks that do support sparse tensors each supports various versions of "sparse"
* Long double is either 96 or 128 bits based on underlying hardware

0 comments on commit 6c81f98

Please sign in to comment.