pytensor icon indicating copy to clipboard operation
pytensor copied to clipboard

Should IncSubtensor ignore duplicase by default, like numpy?

Open ricardoV94 opened this issue 1 year ago • 0 comments

Description

import pytensor.tensor as pt
import numpy as np

x = np.zeros(3)
x[[0, 0, 0]] += 1
print(x)
# [1, 0, 0]

x = pt.zeros(3)
x = x[[0, 0, 0]].inc(1)
print(x.eval())
# [3, 0, 0]

x = pt.zeros(3)
x = x[[0, 0, 0]].inc(1, ignore_duplicates=True)
print(x.eval())
# [1, 0, 0]

ricardoV94 avatar Sep 01 '24 09:09 ricardoV94