Slicing assignment symbol object


is there a way to assign a specific value(e.g 1) to part of a symbol object using slicing method.

For example. I have a symbol data, with the shape (3, 4,4)

I want data[:,2:,2:] = 1

Unfortunately not, TypeError: 'Symbol' object does not support item assignment
An alternative is to use masks and create a new array that is a combination of a constant array of value 2 and your old array at specific positions.

1 Like