cleaning and small change in TransferFunction
This commit is contained in:
@@ -124,19 +124,14 @@ void FeedForward::solvePart(float *newSolution, register size_t begin, size_t en
|
||||
partialSolution=_mm_add_ps(partialSolution,w);
|
||||
}
|
||||
register float* memory=this->weights[layer][j];
|
||||
for(register size_t k=0;k<alignedPrev;k+=4)
|
||||
for(register size_t k=0;k<alignedPrev;k+=sizeof(float))
|
||||
{
|
||||
w = _mm_load_ps(memory+k);
|
||||
sols = _mm_load_ps(sol+k);
|
||||
w=_mm_mul_ps(w,sols);
|
||||
partialSolution=_mm_add_ps(partialSolution,w);
|
||||
}
|
||||
/* pre-SSE3 solution
|
||||
__m128 temp = _mm_add_ps(_mm_movehl_ps(foo128, foo128), foo128);
|
||||
float x;
|
||||
_mm_store_ss(&x, _mm_add_ss(temp, _mm_shuffle_ps(temp, 1)));
|
||||
*/
|
||||
#ifdef USE_SSE2
|
||||
#ifdef USE_SSE2 //pre-SSE3 solution
|
||||
partialSolution= _mm_add_ps(_mm_movehl_ps(partialSolution, partialSolution), partialSolution);
|
||||
partialSolution=_mm_add_ss(partialSolution, _mm_shuffle_ps(partialSolution,partialSolution, 1));
|
||||
#else
|
||||
|
||||
@@ -12,10 +12,11 @@ namespace TransferFunction
|
||||
class HyperbolicTangent: public TransferFunction
|
||||
{
|
||||
public:
|
||||
HyperbolicTangent() {}
|
||||
inline virtual float derivatedOutput(const float&,const float &output) override { return 1-pow(output,2); }
|
||||
inline virtual float operator()(const float &x) override { return tanh(x); };
|
||||
HyperbolicTangent(const float& lam=1):lambda(lam) {}
|
||||
inline virtual float derivatedOutput(const float&,const float &output) override { return lambda*(1-output*output); }
|
||||
inline virtual float operator()(const float &x) override { return tanh(lambda*x); };
|
||||
protected:
|
||||
float lambda;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user