Cast - 6 vs 9¶
- Cast6 → Cast9 +19 -5
Cast6 → Cast9
RENAMED
@@ -1 +1 @@
|
|
1
1
|
The operator casts the elements of a given input tensor to a data type
|
2
2
|
specified by the 'to' argument and returns an output tensor of the same size in
|
3
3
|
the converted type. The 'to' argument must be one of the data types specified
|
4
4
|
in the 'DataType' enum field in the TensorProto message.
|
5
|
+
|
6
|
+
Casting from string tensor in plain (e.g., "3.14" and "1000") and scientific numeric representations
|
7
|
+
(e.g., "1e-5" and "1E8") to float types is supported. For example, converting string "100.5" to an integer may
|
5
|
-
|
8
|
+
result 100. There are some string literals reserved for special floating-point values;
|
9
|
+
"+INF" (and "INF"), "-INF", and "NaN" are positive infinity, negative infinity, and not-a-number, respectively.
|
10
|
+
Any string which can exactly match "+INF" in a case-insensitive way would be mapped to positive infinite. Similarly,
|
11
|
+
this case-insensitive rule is applied to "INF" and "NaN". When casting from numeric tensors
|
12
|
+
to string tensors, plain floating-point representation (such as "314.15926") would be used.
|
13
|
+
Converting non-numerical-literal string such as "Hello World!" is an undefined behavior. Cases
|
14
|
+
of converting string representing floating-point arithmetic value, such as "2.718", to INT is an undefined behavior.
|
15
|
+
|
16
|
+
Conversion from a numerical type to any numerical type is always allowed.
|
17
|
+
User must be aware of precision loss and value change caused by range difference between two types.
|
18
|
+
For example, a 64-bit float 3.1415926459 may be round to a 32-bit float 3.141592. Similarly, converting
|
19
|
+
an integer 36 to Boolean may produce 1 because we truncate bits which can't be stored in the targeted type.
|
6
20
|
**Attributes**
|
7
21
|
* **to** (required):
|
8
22
|
The data type to which the elements of the input tensor are cast.
|
9
23
|
Strictly must be one of the types from DataType enum in TensorProto
|
10
24
|
**Inputs**
|
11
25
|
* **input** (heterogeneous) - **T1**:
|
12
26
|
Input tensor to be cast.
|
13
27
|
**Outputs**
|
14
28
|
* **output** (heterogeneous) - **T2**:
|
15
29
|
Output tensor with the same shape as input with type specified by
|
16
30
|
the 'to' argument
|
17
31
|
**Type Constraints**
|
18
32
|
* **T1** in (
|
19
33
|
tensor(bool),
|
20
34
|
tensor(double),
|
21
35
|
tensor(float),
|
22
36
|
tensor(float16),
|
23
37
|
tensor(int16),
|
24
38
|
tensor(int32),
|
25
39
|
tensor(int64),
|
26
40
|
tensor(int8),
|
41
|
+
tensor(string),
|
27
42
|
tensor(uint16),
|
28
43
|
tensor(uint32),
|
29
44
|
tensor(uint64),
|
30
45
|
tensor(uint8)
|
31
46
|
):
|
32
|
-
Constrain input types. Casting from
|
47
|
+
Constrain input types. Casting from complex is not supported.
|
33
|
-
supported.
|
34
48
|
* **T2** in (
|
35
49
|
tensor(bool),
|
36
50
|
tensor(double),
|
37
51
|
tensor(float),
|
38
52
|
tensor(float16),
|
39
53
|
tensor(int16),
|
40
54
|
tensor(int32),
|
41
55
|
tensor(int64),
|
42
56
|
tensor(int8),
|
57
|
+
tensor(string),
|
43
58
|
tensor(uint16),
|
44
59
|
tensor(uint32),
|
45
60
|
tensor(uint64),
|
46
61
|
tensor(uint8)
|
47
62
|
):
|
48
|
-
Constrain output types. Casting to
|
63
|
+
Constrain output types. Casting to complex is not supported.? ^^ ^^^^^^^^^^^
|
49
|
-
supported.
|