I guess the issue is that pycharm is not using the same python as the one in your console where you installed pytorch.
You will need to make sure that pycharm use the same python as the one you installed torch in.