Performance of top-quark and W-boson tagging with ATLAS in Run 2 of the LHC