HDMI freezes on High Sierra Sometimes when I plug my HDMI cable in, the macbook freezes.
It's 15inch retina, early 2013, recently clean installed macOS High Sierra.

I've resetted the NVRAM and the SMC, many times, problem is occasionally there.
And no, I won't replace the HDMI cable as it was working just fine with all previous versions of macOS/OSX.

On a quora thread I've read that possibly the automatic graphics card switching might be the reason, which can be found in Settings/Energy Saver. This might make sense, as this issue happens when I take my laptop off my desk (unplug charger and HDMI), and then plug it back in.
I have the exactly same issue.  It started to happen after my upgrade to High Sierra.  I own a Mid 2012 MacBook Pro with Retina display.  I googled a bit and found that this happens mostly to MacBook Pro with Retina owners 2012- or 2013-version.

Resetting NVRAM/PRAM or SMC did not work for me but turning off automatic graphic switching as you suggested worked. I will have to turn it off until Apple got to fix this.