/**
 * @time
 * @l
 */
int DatastoreDelayTestProbe::outputState(double timed) {
   HyPerLayer * l = getTargetLayer();
   InterColComm * icComm = l->getParent()->icCommunicator();
   const int rcvProc = 0;
   if( icComm->commRank() != rcvProc ) {
      return PV_SUCCESS;
   }
   int status = PV_SUCCESS;
   int numDelayLevels = l->getParent()->getLayer(0)->getNumDelayLevels();
   pvdata_t correctValue = numDelayLevels*(numDelayLevels+1)/2;
   if( timed >= numDelayLevels+2 ) {
      pvdata_t * V = l->getV();
      for( int k=0; k<l->getNumNeuronsAllBatches(); k++ ) {
         if( V[k] != correctValue ) {
            fprintf(outputstream->fp, "Layer \"%s\": timef = %f, neuron %d: value is %f instead of %d\n", l->getName(), timed, k, V[k], (int) correctValue);
            status = PV_FAILURE;
         }
      }
      if( status == PV_SUCCESS) {
         fprintf(outputstream->fp, "Layer \"%s\": timef = %f, all neurons have correct value %d\n", l->getName(), timed, (int) correctValue);
      }
   }
   assert(status == PV_SUCCESS);
   return PV_SUCCESS;
}
Ejemplo n.º 2
0
int checkComparisonNonzero(HyPerCol * hc, int argc, char * argv[]) {
   int status = PV_FAILURE;
   int numLayers = hc->numberOfLayers();
   int layerIndex;
   HyPerLayer * layer;
   for( layerIndex=0; layerIndex<numLayers; layerIndex++ ) {
      layer = hc->getLayer(layerIndex);
      if( !strcmp(hc->getLayer(layerIndex)->getName(), "Comparison") ) break;
   }
   if( layerIndex >= numLayers) {
      pvErrorNoExit().printf("%s: couldn't find layer \"Comparison\".", argv[0]);
      return PV_FAILURE;
   }
   pvdata_t * V = layer->getV();
   for( int k=0; k<layer->getNumNeurons(); k++ ) {
      if( V[k] ) {
         status = PV_SUCCESS;
         break;
      }
   }
   return status;
}