8 #include "L2ConnProbe.hpp" 12 L2ConnProbe::L2ConnProbe() {}
14 L2ConnProbe::L2ConnProbe(
const char *probename, HyPerCol *hc) : KernelProbe(probename, hc) {}
16 L2ConnProbe::~L2ConnProbe() {}
19 if (mOutputStreams.empty()) {
20 return Response::NO_ACTION;
23 const int rank = icComm->commRank();
24 assert(getTargetConn() != NULL);
25 int nxp = getTargetHyPerConn()->getPatchSizeX();
26 int nyp = getTargetHyPerConn()->getPatchSizeY();
27 int nfp = getTargetHyPerConn()->getPatchSizeF();
28 int patchSize = nxp * nyp * nfp;
30 int arborID = getArbor();
31 int numKern = getTargetHyPerConn()->getNumDataPatches();
33 if (numKern != getTargetHyPerConn()->getPre()->getLayerLoc()->nf) {
35 "L2ConnProbe %s: L2ConnProbe only works for 1-to-many or " 40 #ifdef PV_USE_OPENMP_THREADS 41 #pragma omp parallel for schedule(guided) 43 for (
int kernelIndex = 0; kernelIndex < numKern; ++kernelIndex) {
45 getTargetHyPerConn()->getWeightsDataStart(arborID) + patchSize * kernelIndex;
49 for (
int f = 0; f < nfp; f++) {
51 for (
int y = 0; y < nyp; y++) {
53 for (
int x = 0; x < nxp; x++) {
55 int k = kIndex(x, y, f, nxp, nyp, nfp);
56 float w = (float)wdata[k];
61 output(0) <<
"t=" << timed <<
", f=" << kernelIndex <<
", squaredL2=" << sumsq <<
"\n";
64 return Response::SUCCESS;
PrintStream & output(int b)
virtual Response::Status outputState(double timef) override