OneHot.ftl 408 Bytes
Newer Older
Christian Fuß's avatar
Christian Fuß committed
1
<#assign input = element.inputs[0]>
2
<#assign size = element.size?c>
3
4
<#if mode == "FORWARD_FUNCTION">
        ${element.name} = F.one_hot(indices=${input}, depth=${size})
5
<#elseif mode == "PYTHON_INLINE">
Sebastian Nickels's avatar
Sebastian Nickels committed
6
                    ${element.name} = nd.one_hot(indices=${input}, depth=${size})
7
<#elseif mode == "CPP_INLINE">
Sebastian Nickels's avatar
Sebastian Nickels committed
8
    vector<float> ${element.name}(${size}, 0);
9
10
    ${element.name}[${input}[0]] = 1;
</#if>