Theano expressions

blocks.theano_expressions.hessian_times_vector(gradient, parameter, vector, r_op=False)

Return an expression for the Hessian times a vector.

Parameters:
  • gradient (TensorVariable) – The gradient of a cost with respect to parameter
  • parameter (TensorVariable) – The parameter with respect to which to take the gradient
  • vector (TensorVariable) – The vector with which to multiply the Hessian
  • r_op (bool, optional) – Whether to use Rop() or not. Defaults to False. Which solution is fastest normally needs to be determined by profiling.
blocks.theano_expressions.l2_norm(tensors)

Computes the total L2 norm of a set of tensors.

Converts all operands to TensorVariable (see as_tensor_variable()).

Parameters:tensors (iterable of TensorVariable (or compatible)) – The tensors.