This function performs a one-hot encoding of the label, transform a label
with N
letters in a matrix of dimensions N
xlength(vocab)
. All the
labels must have the same length.
Value
torch tensor with dimensions length(all_letters)
xlength(vocab)
containing only zeros and ones. All rows sum exactly one.
Examples
if (torch::torch_is_installed()) {
vocab <- letters
resp <- captcha_transform_label(c("a","b","c","d","e"), vocab)
class(resp)
dim(resp)
}