This is expected behavior and the docs for index_put_ 2 mention:

If accumulate is True , the elements in value are added to self . If accumulate is False , the behavior is undefined if indices contain duplicate elements.