Hi there,

I am a new of Pytorch.

I want to modify tensor `x`

to `y`

as a following rule:

```
y[i][j] = 1.0 ,if x[I][j] > 0,
y[i][j] = 0.0 ,if x[I][j] = 0,
y[i][j] = -1.0 ,if x[I][j] < 0.
```

For example:

```
x = tensor([
[0.0, 1.5, 0.5, 1.0],
[0.0, 0.0, 1.0, 1.5],
[-0.5, -1.0, -1.5, -0.5]
])
```

```
y = tensor([
[0.0, 1.0, 1.0, 1.0],
[0.0, 0.0, 1.0, 1.0],
[-1.0, -1.0, -1.0, -0.0]
])
```

(`x`

should have -1.5, -1.0, -0.5, 0, 0.5, 1 or 1.5)

For now, I implemented them below code:

```
x[x>0] = 1.0
x[x<0] = -1.0
y = x
```

I am using GPUs to run the above code, but actually `x`

and `y`

are very large tensors so it takes a lot of time.

I guess it is because my code isnâ€™t parallelized properly.

Does anyone have a better idea to modify the tensor?