Learning Fractals by Gradient Descent