All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
If you see somebody, an Imam or anybody else, practicing homosexuality with a child or somebody else, it is your duty to change such evil deed with your hand; i.e., to beat them to the extent that prevents them from such doing. But, you are to avoid telling people about such an incident unless you have three witnesses who saw that with you, since if such an incident is referred to courts and you have no such witnesses, you will be flagged according to the Islamic ruling concerning false accusation of unchastity; i.e., eighty strikes.
If you cannot change such evil deed with your hand, then you have to change it with your tongue; i.e., to frighten and remind them of Allah's Wrath and Punishment, to urge them to repent and return sincerely to Him, and to show them how their action is bad and transgresses sound morals. In addition, you can present them a book or tape with recordings about such a crime and its harms and bad consequence in this worldly life and in the Hereafter; you have to urge them not to meet again and to take new pious friends and so on.
After that, if you cannot change such evil deed with your tongue, then you are to consider that as evil in your heart and to hate them for their bad action.
For more benefit about the prohibition of homosexuality, please refer to Fataawa 82048, 89290, 92704 and 81617.
Allah knows best.