I don’t recognize all of these libraries but your variable X is a dict.
And dicts have no .shape attribute. So calling X.shape throws an error.
Try to print(X) or print(X.keys()) to see what X holds. Maybe one of the .values of X is a numpy.array or torch.tensor which both have the .shape attribute.