execute.ftl 1.71 KB
Newer Older
1
<#list tc.architectureInputSymbols as input>
2
3
4
5
6
    vector<float> ${tc.getName(input)} = CNNTranslator::translate(${input.name}<#if input.arrayAccess.isPresent()>[${input.arrayAccess.get().intValue.get()?c}]</#if>);
</#list>
<#list tc.getLayerVariableMembers("1")?keys as member>
    vector<float> ${member}(${tc.join(tc.getLayerVariableMembers("1")[member], " * ")})
</#list>
7

8
<#list tc.architectureOutputSymbols as output>
9
    vector<float> ${tc.getName(output)}(${tc.join(output.ioDeclaration.type.dimensions, " * ")});
10
11
</#list>

Sebastian N.'s avatar
Sebastian N. committed
12
13
14
<#list tc.architecture.networkInstructions as networkInstruction>
<#if networkInstruction.body.isTrainable()>
    _predictor_${networkInstruction?index}_.predict(${tc.join(tc.getStreamInputNames(networkInstruction.body), ", ")}, ${tc.join(tc.getStreamOutputNames(networkInstruction.body), ", ")});
15
<#else>
Sebastian N.'s avatar
Sebastian N. committed
16
${tc.include(networkInstruction.body, "CPP_INLINE")}
17
18
</#if>
</#list>
19

20
<#list tc.architectureOutputSymbols as output>
21
<#assign shape = output.ioDeclaration.type.dimensions>
22
<#if shape?size == 1>
23
    ${output.name}<#if output.arrayAccess.isPresent()>[${output.arrayAccess.get().intValue.get()?c}]</#if> = CNNTranslator::translateToCol(${tc.getName(output)}, std::vector<size_t> {${shape[0]?c}});
24
25
</#if>
<#if shape?size == 2>
26
    ${output.name}<#if output.arrayAccess.isPresent()>[${output.arrayAccess.get().intValue.get()?c}]</#if> = CNNTranslator::translateToMat(${tc.getName(output)}, std::vector<size_t> {${shape[0]?c}, ${shape[1]?c}});
27
28
</#if>
<#if shape?size == 3>
29
    ${output.name}<#if output.arrayAccess.isPresent()>[${output.arrayAccess.get().intValue.get()?c}]</#if> = CNNTranslator::translateToCube(${tc.getName(output)}, std::vector<size_t> {${shape[0]?c}, ${shape[1]?c}, ${shape[2]?c}});
30
31
</#if>
</#list>