I write a cpp extension and it is successfully compiled and installed.

I have a CUDA kernel like this:

```
__global__ void g(const float *x, float *y);
```

And a function with torch’s argument type like this:

```
torch::Tensor f(const torch::Tensor &x) {
auto y = torch::zeros_like(x);
g<<< 64, 1024, 0, at::cuda::getCurrentCUDAStream() >>>
(x.clone().data<float>(), y.data<float>());
return y;
}
```

This gives me expected results. However, when I remove `clone()`

:

```
torch::Tensor f(const torch::Tensor &x) {
auto y = torch::zeros_like(x);
g<<< 64, 1024, 0, at::cuda::getCurrentCUDAStream() >>>
(x.data<float>(), y.data<float>());
return y;
}
```

It gives me different and unexpercted results.

I can’t understand why this happens because `x`

is `const`

in both `f`

and `g`

.

Can someone tell me the reason of above phenomenon？