Tensor inversion and its application to the tensor equations with Einstein product