Learning to compute the metric dimension of graphs