Create one-hot encoding vector as a LazyTensor
object.
Arguments
- x
A
LazyTensor
encoding a scalar value.- D
an
integer
corresponding to the output dimension.
Details
If x
is a scalar value encoded as a LazyTensor
,
one_hot(x, D)
encodes, symbolically, a vector of length D
where round(x
)-th coordinate is equal to 1, and the other ones to 0.
Examples
if (FALSE) {
A <- 7
A_LT <- LazyTensor(A) # LazyTensor from scalar A
D <- 7
onehot_x <- one_hot(A_LT, D) # symbolic vector of length D
}