Not necessarily [1]. I think you're missing an assumption there.
[1] https://en.wikipedia.org/wiki/Injective_function#/media/File...