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

<#list tc.getNoDuplicateArchitectureOutputs() as output>
11
<#if tc.getName(output)??>
12
    vector<float> ${tc.getName(output)}(${tc.join(output.ioDeclaration.type.dimensions, " * ")});
13
</#if>
14
15
</#list>

Sebastian N.'s avatar
Sebastian N. committed
16
17
18
<#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), ", ")});
19
<#else>
Sebastian N.'s avatar
Sebastian N. committed
20
${tc.include(networkInstruction.body, "CPP_INLINE")}
21
22
</#if>
</#list>
23
24

<#list tc.architecture.outputs as output>
25
<#if tc.getName(output)??>
26
<#assign shape = output.ioDeclaration.type.dimensions>
27
<#if shape?size == 1>
28
    ${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}});
29
30
</#if>
<#if shape?size == 2>
31
    ${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}});
32
33
</#if>
<#if shape?size == 3>
34
    ${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}});
35
</#if>
36
</#if>
37
</#list>