Debugging ========= While it is often the case that a network works perfectly on the first try, bugs do happen. Gradient checking ----------------- If you add your own expression operations, you can debug the automatic differentiation using:: check_gradients(e) Printing expressions -------------------- If you print out an Expression object, you'll see the top-level operation in the expression. You won't see its value, or even its shape/dtype:: >>> print constant(1)+constant(1) add(<0>, <0>) However, there's (usually) no harm in calling ``compute_value`` in the middle of your code:: >>> print compute_value(constant(1)+constant(1)) 2 This will compute the value of x and all its subexpressions, and return the value of x. Tracing ------- :: debug.trace = True This lets you see the value and gradient of every subexpression:: >>> compute_value(constant(1)+constant(1)) <0> = constant(1) = array(1) <1> = constant(1) = array(1) <2> = add(<0>, <1>) = 2 2 Expression tracebacks --------------------- :: debug.stack = True If an exception is raised while computing a value or gradient, the usual traceback is not very helpful. This option turns on an "expression traceback" that shows you the line that created the offending expression.