Neural Network Vectorization
From Ufldl
m (Fixed tt markup) |
|||
Line 137: | Line 137: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
- | + | Recall that when we vectorizing the gradient computations, <tt>delta2</tt> is replaced with matrices. Furthermore, notice that the <tt>sparsity_delta</tt> is the same regardless of the example we are processing; This suggests that vectorizing the computation can be done by simply adding the same values to each example when constructing the <tt>delta2</tt> matrix. Thus, to vectorize the above computations, we can simply add <tt>sparsity_delta</tt> (e.g., using <tt>repmat</tt>) to <tt>delta2</tt>. | |
- | + | ||
- | + |