fix layer_factory.cpp to support ThresholdLayer