Hi,
I been struggling for hours to figure out what is wrong. It says the Class “Neuron” is undefined in SynapseH.cu, but it is included right at the top. I’m using VS2013, and a CUDA v7.5 Project. Is it the fact that their are “Neuron” object pointers in SynapseH.cu, along with “Synapse” object pointers in NeuronH.cu??
Here is the Error:
error : identifier “Neuron” is undefined in SynapseH.cu
Thank you for the help,
Andrew
SynapseH.cu :
#ifndef SYNAPSEH_CU
#define SYNAPSEH_CU
#include "cuda_runtime.h"
#include "NeuronH.cu"
using namespace std;
#ifndef CUDA_CALLABLE_MEMBER
#define CUDA_CALLABLE_MEMBER __host__ __device__
#endif
class Synapse
{
public:
// Foward Prop.
double _weight;
// Back Prop.
double _weightDelta;
//
Neuron* _outputNeuron; // This is the Line where the Error occured
Neuron* _inputNeuron;
// Constructor
CUDA_CALLABLE_MEMBER Synapse();
// Destructor
CUDA_CALLABLE_MEMBER ~Synapse();
};
#endif
NeuronH.cu :
#ifndef NEURONH_CU
#define NEURONH_CU
#include "cuda_runtime.h"
#include "SynapseH.cu"
#include "ActivationFuncsH.cu"
using namespace std;
#ifndef CUDA_CALLABLE_MEMBER
#define CUDA_CALLABLE_MEMBER __host__ __device__
#endif
class Neuron
{
public:
typedef Synapse* SynapsePtr;
// Ctr For Neuron in Network
int _neuronCtr;
// Output & Inputs Synapses
Synapse* _outputSynapses;
SynapsePtr* _inputSynapses = nullptr;
int _outputSynapsesLen, _inputSynapsesLen;
// Neuron Weights
double m_bias;
double _biasDelta;
// Input
double _input;
// Output
double m_output;
// BackProp: Gradiant
double _gradiant;
// Ptr ActivationFunc
private:
ActivationFunc* _actvFunc = nullptr;
public:
// Constuctor
CUDA_CALLABLE_MEMBER Neuron();
// Destructor
CUDA_CALLABLE_MEMBER ~Neuron();
// Creates Construct
CUDA_CALLABLE_MEMBER void createNeuron(int numNeuronsNextLayer);
// Setters
// Sets Output & Weighted Output (m_wtdOutput)
CUDA_CALLABLE_MEMBER void setOutput(double output) { m_output = output; }
// Ini. / Puts together _inputSynapse*[]
CUDA_CALLABLE_MEMBER void iniInputSynapse(int numInputSynapse);
// Save the Pointer to the ActivationFunc.
CUDA_CALLABLE_MEMBER void Neuron::setActvFunc(ActivationFunc* actvFunc);
// Gets the Output Multiplied by the Weights
// <param name="NeuronIdx">The index of the Neuron at the Layer being Calc.
// Wants the Synapse info to put in its Input.</param>
// <returns>Synapse Output from the NeuronIdx</returns>
CUDA_CALLABLE_MEMBER double getSynapseOutput(int NeuronIdx);
// BackProp: Calc Error
CUDA_CALLABLE_MEMBER double calcError(double* target);
};
#endif