A versatile polarizer, independent on the polarization of the incident light, by coating the silicon waveguide with graphene is presented in this letter. The proposed polarizer works in two operation states, namely TE-pass state and TM-pass state, which are based on the different effective mode index variations. Therefore, it is able to combine both TE-pass and TM-pass functionalities into one single component. The proposed device provides a compact size of 69.65μm*2μm, a high extinction ratio of 19.15dB for the TE-pass state and of 20.68dB for the TM-pass state. Furthermore, this device exhibits a wide working bandwidth from 1500nm to 1800nm.