The dimension of attractors of nonautonomous partial differential equations