tensor.label_encoder
Maps each element in the input tensor to another value.
The mapping is determined by the two parallel attributes, 'keys_' and 'values_' attribute. The i-th value in the specified 'keys_' attribute would be mapped to the i-th value in the specified 'values_' attribute. It implies that input's element type and the element type of the specified 'keys_' should be identical while the output type is identical to the specified 'values_' attribute.
Args
self
(@Tensor<T>
) - The input tensor.default_list
(Option<Span<T>>
) - The default span.default_tensor
(Option<Tensor<T>>
) - The default tensor.keys
(Option<Span<T>>
) - The keys span.keys_tensor
(Option<Tensor<T>>
) - The keys tensor.values
(Option<Span<T>>
) - The values span.values_tensor
(Option<Tensor<T>>
) - The values tensor.
One and only one of 'default_'s should be set One and only one of 'keys's should be set One and only one of 'values*'s should be set.
Panics
Panics if the len/shape of keys and values are not the same.
Returns
A new Tensor<T>
which maps each element in the input tensor to another value..
Type Constraints
T
in (Tensor<FP>
,Tensor<i8>
,Tensor<i32>
,tensor<u32>,
)
Examples
Last updated