Sometimes, usually after convolution layer, there can be found shapes in form ( width, height, depth) where depth is a number of filters from convolution operation.
I want to reproduce GoogleNet inception module and "squish" (width, height, depth) to (width, height, f(depth)) where f would produce a scalar value.
I know there is CNTKLib.Splice but that is not exactly what I need. I need to get a weighted sum of all values in the column with (x, y) coordinates.
How can that be done in C# API?
edit: added code sample
public static void PrintOutputDims(Function source)
{
var shape = source.Output.Shape;
var sb = new string[shape.Rank];
for (var i = 0; i < shape.Rank; ++i)
{
sb[i] = ($"dim{i}: {shape[i]}");
}
Console.WriteLine(string.Join(", ", sb));
}
static void Main(string[] args)
{
var variable = CNTKLib.InputVariable(NDShape.CreateNDShape(new[] { 100, 100, 20 }), DataType.Float, "source");
PrintOutputDims(variable); // dim0: 100, dim1: 100, dim2: 20
var squished = Squish(variable);
PrintOutputDims(variable); // dim0: 100, dim1: 100, dim2: 1
}
How Squish
function may be implemented?