The stack trace points to an invalid index operation, so make sure to keep the bounds of idx:
block: [197,0,0], thread: [32,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed