You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/commands.md
+80-14Lines changed: 80 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,11 +50,38 @@ OK
50
50
```
51
51
52
52
!!! note "Uninitialized Tensor Values"
53
-
As both `BLOB` and `VALUES` are optional arguments, it is possible to use the `AI.TENSORSET` to create an uninitialized tensor.
53
+
As both `BLOB` and `VALUES` are optional arguments, it is possible to use the `AI.TENSORSET` to create an uninitialized tensor (it will contain zeros at all entries).
54
54
55
55
!!! important "Using `BLOB` is preferable to `VALUES`"
56
56
While it is possible to set the tensor using binary data or numerical values, it is recommended that you use the `BLOB` option. It requires fewer resources and performs better compared to specifying the values discretely.
57
57
58
+
###Boolean Tensors
59
+
The possible values for a tensor of type `BOOL` are `0` and `1`. The size of every bool element in a blob should be 1 byte.
60
+
61
+
**Examples**
62
+
63
+
Here are two ways of creating the following boolean tensor: $\begin{equation*} A = \begin{bmatrix} 0 & 1 \\ 0 & 1 \\ \end{bmatrix} \end{equation*}$
String tensors are tensors in which every element is a single utf-8 string (may or may not be null-terminated). A string element can be at any length, and it cannot contain another null character except for the last one if it is a null-terminated string.
73
+
A string tensor blob contains the encoded string elements concatenated, where the null character serves as a delimiter. Note that the size of string tensor blob equals to the total size of its elements, and it is not determined given the tensor's shapes (unlike in the rest of tensor types)
74
+
75
+
**Examples**
76
+
77
+
Here are two ways of creating the same 2X2 string tensor:
78
+
```
79
+
redis> AI.TENSORSET my_str_tensor STRING 2 2 VALUES first second third fourth
The **`AI.TENSORGET`** command returns a tensor stored as key's value.
60
87
@@ -81,51 +108,69 @@ Depending on the specified reply format:
81
108
1. The tensor's shape as an Array consisting of an item per dimension
82
109
***BLOB**: the tensor's binary data as a String. If used together with the **META** option, the binary data string will put after the metadata in the array reply.
83
110
***VALUES**: Array containing the numerical representation of the tensor's data. If used together with the **META** option, the binary data string will put after the metadata in the array reply.
84
-
* Default: **META** and **BLOB** are returned by default, in case that non of the arguments above is specified.
111
+
* Default: **META** and **BLOB** are returned by default, in case that none of the arguments above is specified.
85
112
86
113
87
114
**Examples**
88
115
89
-
Given a tensor value stored at the 'mytensor' key:
116
+
Given tensor values stored at 'my_tensor' and _my_str_tensor keys:
0 commit comments