pycaffe: add unary CaffeNet constructor for uninitialized nets

Note that parameters are uninitialized, not zero-filled.
Merge pull request #365 from longjon/pycaffe-empty-nets

Add unary CaffeNet constructor for uninitialized nets
add HingeLossLayer for one-vs-all hinge loss

This layer implements a "one-vs-all" hinge loss, (1/n) sum_ij max(0, 1 -
y_ij x_ij), with bottom blob x_ij (i ranging over examples and j over
classes), and y_ij = +1/-1 indicating the label. No regularization is
included, since regularization is done via weight decay or using the
parameters of another layer. The gradient is taken to be zero at the
hinge point. This commit only provides the CPU implementation.
make gradient checker's kink use feature absolute value

In theory, layer functions could be nonsmooth anywhere; in all cases in
use so far, they are nonsmooth at either zero or +1 and -1. In the
future, it might be necessary to generalize the kink mechanism beyond
this stopgap measure.
test HingeLossLayer

Based on SoftmaxWithLossLayerTest.
set TRAIN in CommonTest.TestPhase

...to avoid effects of test execution order. The original intention was
to check that TRAIN is the default, but it is better to have consistent
results.
Merge pull request #366 from shelhamer/test-phase-fix

set TRAIN in CommonTest.TestPhase
scope data layer sequence tests to avoid leveldb contention
Merge pull request #368 from shelhamer/fix-data-layer-sequence-tests

Fix data layer sequence tests to avoid leveldb contention and lock failures
Merge pull request #303 from longjon/hinge-loss-layer

HingeLossLayer
Use Thrust to manage the underlying memory of SyncedMem
Implement and test SyncedMem::resize and reserve
Add Blob::capacity and make Blob::Reshape capacity aware
Merge the Blob constructors and initialize all the fields properly
Change the Makefile to be consistent in style
Use static_cast instead of reinterpret_cast to cast void pointers
minor cast/style fixes

make some casts static_casts

minor style fixes
minor makefile style/dependency fixes; move more general rule after more
specific ones (for older versions of make that take first match)
use handwritten resize methods instead of thrust host/device vectors
-- couldn't get the thrust version working at all
make TestResize less trivial given new syncedmem resize design