8 #include "SigmoidLayer.hpp" 11 #include "../include/default_params.h" 15 SigmoidLayer::SigmoidLayer() { initialize_base(); }
17 SigmoidLayer::SigmoidLayer(
const char *name, HyPerCol *hc) {
22 SigmoidLayer::~SigmoidLayer() {}
24 int SigmoidLayer::initialize_base() {
return PV_SUCCESS; }
26 int SigmoidLayer::initialize(
const char *name, HyPerCol *hc) {
27 int status_init = CloneVLayer::initialize(name, hc);
29 if (parent->columnId() == 0) {
31 InfoLog().printf(
"SigmoidLayer: Inverse flag is set\n");
33 InfoLog().printf(
"SigmoidLayer: True Sigmoid flag is set\n");
36 if (SigmoidAlpha < 0.0f || SigmoidAlpha > 1.0f) {
37 if (parent->columnId() == 0) {
39 "%s: SigmoidAlpha cannot be negative or greater than 1.\n", getDescription_c());
41 MPI_Barrier(parent->getCommunicator()->communicator());
50 ioParam_Vrest(ioFlag);
51 ioParam_VthRest(ioFlag);
52 ioParam_InverseFlag(ioFlag);
53 ioParam_SigmoidFlag(ioFlag);
54 ioParam_SigmoidAlpha(ioFlag);
58 void SigmoidLayer::ioParam_Vrest(
enum ParamsIOFlag ioFlag) {
59 parent->parameters()->ioParamValue(ioFlag, name,
"Vrest", &V0, (
float)V_REST);
61 void SigmoidLayer::ioParam_VthRest(
enum ParamsIOFlag ioFlag) {
62 parent->parameters()->ioParamValue(ioFlag, name,
"VthRest", &Vth, (
float)VTH_REST);
64 void SigmoidLayer::ioParam_InverseFlag(
enum ParamsIOFlag ioFlag) {
65 parent->parameters()->ioParamValue(ioFlag, name,
"InverseFlag", &InverseFlag, (
bool)INVERSEFLAG);
67 void SigmoidLayer::ioParam_SigmoidFlag(
enum ParamsIOFlag ioFlag) {
68 parent->parameters()->ioParamValue(ioFlag, name,
"SigmoidFlag", &SigmoidFlag, (
bool)SIGMOIDFLAG);
70 void SigmoidLayer::ioParam_SigmoidAlpha(
enum ParamsIOFlag ioFlag) {
71 parent->parameters()->ioParamValue(
72 ioFlag, name,
"SigmoidAlpha", &SigmoidAlpha, (
float)SIGMOIDALPHA);
76 SigmoidLayer::communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) {
77 return CloneVLayer::communicateInitInfo(message);
80 Response::Status SigmoidLayer::allocateDataStructures() {
81 auto status = CloneVLayer::allocateDataStructures();
84 pvAssert(GSyn ==
nullptr);
88 int SigmoidLayer::setActivity() {
89 float *activity = clayer->activity->data;
90 memset(activity, 0,
sizeof(
float) * clayer->numExtendedAllBatches);
94 Response::Status SigmoidLayer::updateState(
double timef,
double dt) {
100 getCLayer()->activity->data,
109 return Response::SUCCESS;
112 void SigmoidLayer::updateState(
128 int num_neurons = nx * ny * nf;
129 int nbatch = loc->nbatch;
130 updateV_SigmoidLayer();
131 setActivity_SigmoidLayer(
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override