Commit c0a3c87d authored by Carlos Alfredo Yeverino Rodriguez's avatar Carlos Alfredo Yeverino Rodriguez
Browse files

Modified Convolution.ftl: Adapted kernel parameter with same and different height and width.

parent cf4c054a
<#assign input = element.inputs[0]> <#assign input = element.inputs[0]>
<#assign strideHeight = element.stride[0]> <#assign strideHeight = element.stride[0]>
<#assign strideWidth = element.stride[1]> <#assign strideWidth = element.stride[1]>
<#assign kernelHeight = element.kernel[0]>
<#assign kernelWidth = element.kernel[1]>
<#if element.padding??> <#-- Check wheather padding null is. --> <#if element.padding??> <#-- Check wheather padding null is. -->
<#-- TODO: check how to adapt CNNArchLang argument pad_width=${element.padding[0]} --> <#-- TODO: check how to adapt CNNArchLang argument pad_width=${element.padding[0]} -->
</#if> </#if>
...@@ -9,10 +11,15 @@ ...@@ -9,10 +11,15 @@
<#else> <#else>
<#assign strideParameter = "stride_h=${strideHeight}, stride_w=${strideWidth}"> <#assign strideParameter = "stride_h=${strideHeight}, stride_w=${strideWidth}">
</#if> </#if>
<#if kernelHeight == kernelWidth>
<#assign kernelParameter = "kernel=${kernelHeight}">
<#else>
<#assign kernelParameter = "kernel=[${kernelHeight},${kernelWidth}]">
</#if>
<#if input = tc.architectureInputs[0]> <#-- TODO: CHECK COMPARISON --> <#if input = tc.architectureInputs[0]> <#-- TODO: CHECK COMPARISON -->
${element.name} = brew.conv(model, '${input}', '${element.name}', dim_in=1, dim_out=${element.channels?c}, kernel=${element.kernel[0]}, ${strideParameter}) ${element.name} = brew.conv(model, '${input}', '${element.name}', dim_in=1, dim_out=${element.channels?c}, ${kernelParameter}, ${strideParameter})
<#else> <#else>
${element.name} = brew.conv(model, ${input}, '${element.name}', dim_in=${element.element.inputTypes[0].channels?c}, dim_out=${element.channels?c}, kernel=${element.kernel[0]}, ${strideParameter}) ${element.name} = brew.conv(model, ${input}, '${element.name}', dim_in=${element.element.inputTypes[0].channels?c}, dim_out=${element.channels?c}, ${kernelParameter}, ${strideParameter})
</#if> </#if>
<#-- TODO: check how to adapt CNNArchLang argument no_bias=${element.noBias?string("True","False")} --> <#-- TODO: check how to adapt CNNArchLang argument no_bias=${element.noBias?string("True","False")} -->
<#include "OutputShape.ftl"> <#include "OutputShape.ftl">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment