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

Modified Pooling.ftl: Adapted stride and kernel parameters with same and...

Modified Pooling.ftl: Adapted stride and kernel parameters with same and different height and width.
parent c0a3c87d
<#assign input = element.inputs[0]>
<#assign strideHeight = element.stride[0]>
<#assign strideWidth = element.stride[1]>
<#assign kernelHeight = element.kernel[0]>
<#assign kernelWidth = element.kernel[1]>
<#if element.padding??>
<#-- TODO: check how to adapt CNNArchLang argument pad_width=${element.padding[0]} -->
</#if>
<#if strideHeight == strideWidth>
<#assign strideParameter = "stride=${strideHeight}">
<#else>
<#assign strideParameter = "stride_h=${strideHeight}, stride_w=${strideWidth}">
</#if>
<#if kernelHeight == kernelWidth>
<#assign kernelParameter = "kernel=${kernelHeight}">
<#else>
<#assign kernelParameter = "kernel_h=${kernelHeight}, kernel_w=${kernelWidth}">
</#if>
<#if element.poolType == "max">
<#if strideHeight == strideWidth>
${element.name} = brew.max_pool(model, ${input}, '${element.name}', kernel=${element.kernel[0]}, stride=${strideHeight})
<#else>
${element.name} = brew.max_pool(model, ${input}, '${element.name}', kernel=${element.kernel[0]}, stride_h=${strideHeight}, stride_w=${strideWidth})
</#if>
${element.name} = brew.max_pool(model, ${input}, '${element.name}', ${kernelParameter}, ${strideParameter})
<#elseif element.poolType == "avg">
<#if strideHeight == strideWidth>
${element.name} = brew.average_pool(model, ${input}, '${element.name}', kernel=${element.kernel[0]}, stride=${strideHeight})
<#else>
${element.name} = brew.average_pool(model, ${input}, '${element.name}', kernel=${element.kernel[0]}, stride_h=${strideHeight}, stride_w=${strideWidth})
</#if>
${element.name} = brew.average_pool(model, ${input}, '${element.name}', ${kernelParameter}, ${strideParameter})
</#if>
<#include "OutputShape.ftl">
\ No newline at end of file
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