214 outputs.resize(inputs.size1(),m_matrix.size1());
216 noalias(outputs) = inputs % trans(m_matrix);
218 noalias(outputs)+=repeat(m_offset,inputs.size1());
220 m_activation.evalInPlace(outputs, state.
toState<
typename ActivationFunction::State>());
231 SIZE_CHECK(coefficients.size2()==m_matrix.size1());
232 SIZE_CHECK(coefficients.size1()==patterns.size1());
238 std::size_t matrixParams = numInputs*numOutputs;
240 auto weightGradient = blas::to_matrix(subrange(gradient,0,matrixParams), numOutputs,numInputs);
243 m_activation.multiplyDerivative(outputs,delta, state.
toState<
typename ActivationFunction::State>());
245 noalias(weightGradient) = trans(delta) % patterns;
248 noalias(subrange(gradient, matrixParams, matrixParams + numOutputs)) = sum(as_columns(delta));
259 SIZE_CHECK(coefficients.size2() == m_matrix.size1());
260 SIZE_CHECK(coefficients.size1() == patterns.size1());
264 m_activation.multiplyDerivative(outputs,delta, state.
toState<
typename ActivationFunction::State>());
266 derivative.resize(patterns.size1(),patterns.size2());
267 noalias(derivative) = delta % m_matrix;
278 SIZE_CHECK(coefficients.size2()==m_matrix.size1());
279 SIZE_CHECK(coefficients.size1()==patterns.size1());
286 m_activation.multiplyDerivative(outputs,delta, state.
toState<
typename ActivationFunction::State>());
289 inputDerivative.resize(patterns.size1(),numInputs);
290 noalias(inputDerivative) = delta % m_matrix;
294 parameterDerivative.clear();
295 std::size_t matrixParams = numInputs*numOutputs;
296 auto weightGradient = blas::to_matrix(subrange(parameterDerivative,0,matrixParams), numOutputs,numInputs);
297 auto offsetGradient = subrange(parameterDerivative,matrixParams,parameterDerivative.size());
300 noalias(weightGradient) = trans(delta) % patterns;
302 noalias(offsetGradient) = sum(as_columns(delta));