Please see the following suttas in relation to forgiveness:
In this sutta, the Buddha doesn't accept the harm from another. Thus he doesn't get inflicted to the point that he needs to Forgive.
https://suttacentral.net/sn7.2/en/sujato
And this sutta, number 21 the first section, shows the importance of understanding one's own mistakes and forgiving others' mistakes.
https://suttacentral.net/an2.21-31/en/sujato
For more information on how to practice Forgiveness, see
Revised Instructions