Add test_value tags to input values for debugging. Refactor the way decoding weights are created. Move gain outside the wx+b calculation.