FullyConnected.ftl 882 Bytes
Newer Older
1 2
<#assign flatten = element.element.inputTypes[0].height != 1 || element.element.inputTypes[0].width != 1>
<#assign input = element.inputs[0]>
3 4 5 6
<#assign inputLayerType = element.element.getInputElement().get()?string>
<#assign inputChannels = element.element.inputTypes[0].channels?c>
<#assign inputHeight = element.element.inputTypes[0].height>
<#assign inputWidth = element.element.inputTypes[0].width>
7
<#--flatten is not needed since the fc layer applies it automatically-->
8
<#if inputLayerType?matches("FullyConnected") || (inputHeight == 1 && inputWidth == 1)>
9
    		${element.name} = brew.fc(model, ${input}, '${element.name}', dim_in=${inputChannels}, dim_out=${element.units?c})
10
<#else>
11
    		${element.name} = brew.fc(model, ${input}, '${element.name}', dim_in=${inputChannels} * ${inputHeight} * ${inputWidth}, dim_out=${element.units?c})
12 13
</#if>
<#include "OutputShape.ftl">