Depends like hell on circumstances. (For me, this is all hypothetical, but I know a lot of people who are, or have, exes.)
If my ex-in-laws are the sort who would shun me, then I wouldn’t go. If the breakup was peaceful and we maintained a friendship, then, certainly, I would.
I know people who wouldn’t be welcome at their ex’s funerals…and people who would be absolutely welcomed and greeting warmly.
The best advice is to try to stay friends with as many people as possible.
(I recently went to the funeral of a guy who, in life, was a jerk. A mean-spirited, loud-mouthed jackass. But…it’s his funeral. I was invited to attend. I went, and, when it was time for individuals to speak of their memories, I told of one of the good times. I figured, if it had been my funeral, he’d have come and done the same.)