From 38b78edc742a55fae7e4df42abce919664796a41 Mon Sep 17 00:00:00 2001 From: Julio Jerez Date: Thu, 2 Nov 2023 14:06:50 -0700 Subject: [PATCH] trace a single activation follwe by the objective (wip) --- .../sdk/dBrain/ndBrainLayerConvolutional.cpp | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/newton-4.00/sdk/dBrain/ndBrainLayerConvolutional.cpp b/newton-4.00/sdk/dBrain/ndBrainLayerConvolutional.cpp index f002f9a056..e1658553fa 100644 --- a/newton-4.00/sdk/dBrain/ndBrainLayerConvolutional.cpp +++ b/newton-4.00/sdk/dBrain/ndBrainLayerConvolutional.cpp @@ -59,6 +59,7 @@ ndBrainLayerConvolutional::ndBrainLayerConvolutional(ndInt32 inputWidth, ndInt32 //Debug(inputWidth, m_inputHeight, inputDepth, kernelSize, numberOfKernels); //Debug(7, 7, 2, 3, 3); Debug(4, 4, 2, 2, 3); + //Debug(4, 4, 2, 2, 2); } } @@ -350,6 +351,37 @@ void ndBrainLayerConvolutional::Debug(ndInt32 width, ndInt32 height, ndInt32 cha //ndTrace(("b(%d)\n\n", filter)); } + ndTrace(("\n")); + ndInt32 index = 0; + for (ndInt32 filter = 0; filter < filterCount; ++filter) + { + for (ndInt32 y = 0; y < outputWidth; ++y) + { + for (ndInt32 x = 0; x < outputHeight; ++x) + { + ndTrace(("z(%d) = g(y(%d,%d,%d))\n", index, filter, y, x)); + index++; + } + } + } + + ndTrace(("\n")); + ndTrace(("L2 =\n")); + index = 0; + for (ndInt32 filter = 0; filter < filterCount; ++filter) + { + for (ndInt32 y = 0; y < outputWidth; ++y) + { + ndTrace((" ")); + for (ndInt32 x = 0; x < outputHeight; ++x) + { + ndTrace(("1/2 * (z(%d) - k(%d))^2 + ", index, index)); + index++; + } + ndTrace(("\n")); + } + } + ndTrace(("\n")); // print convolutions ndTrace(("\n"));