A Truly Sparse and General Implementation of Gradient-Based Synaptic Plasticity