execute.ftl 1.59 KB
Newer Older
1
2
3
4
5
6
<#list tc.architecture.inputs as input>
    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
<#list tc.architecture.outputs as output>
8
    vector<float> ${tc.getName(output)}(${tc.join(output.ioDeclaration.type.dimensions, " * ")});
9
10
</#list>

11
<#list tc.architecture.streams as stream>
12
13
<#if stream.isTrainable()>
    _predictor_${stream?index}_.predict(${tc.join(tc.getStreamInputNames(stream), ", ")}, ${tc.join(tc.getStreamOutputNames(stream), ", ")});
14
15
<#else>
${tc.include(stream, "CPP_INLINE")}
16
17
</#if>
</#list>
18
19

<#list tc.architecture.outputs as output>
20
<#assign shape = output.ioDeclaration.type.dimensions>
21
<#if shape?size == 1>
22
    ${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}});
23
24
</#if>
<#if shape?size == 2>
25
    ${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}});
26
27
</#if>
<#if shape?size == 3>
28
    ${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}});
29
30
</#if>
</#list>