Add gradient test to innerproductlayer.