Out-of-plane and in-plane ferroelectricity of atom-thick two-dimensional InSe