Gradient-Based Neuromorphic Learning on Dynamical RRAM Arrays