File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
aten/src/ATen/native/vulkan/ops Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ static Tensor rand_like(
7070 // numbers from a uniform distribution on the interval [0,1). To match the CPU
7171 // implementation, we simplify the range to [0,1] and tolerate the small
7272 // chance of 1 being sampled.
73- return input_arg.clone ().detach ().uniform_ (0.0 , 1.0 );
73+ return input_arg.detach ().clone ().uniform_ (0.0 , 1.0 );
7474}
7575
7676static Tensor& normal_ (
@@ -129,7 +129,7 @@ static Tensor randn_like(
129129 const std::optional<c10::MemoryFormat> /* not implemented */ ) {
130130 // Returns a tensor with the same size as input that is filled with random
131131 // numbers from a normal distribution with mean 0 and standard deviation 1.
132- return input_arg.clone ().detach ().normal_ (0.0 , 1.0 );
132+ return input_arg.detach ().clone ().normal_ (0.0 , 1.0 );
133133}
134134
135135TORCH_LIBRARY_IMPL (aten, Vulkan, m) {
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ void TestBackward(
140140 const torch::Tensor& input = inputs[i];
141141 if (input.defined ()) {
142142 torch::Tensor oinput =
143- input.clone ().detach ().set_requires_grad (input.requires_grad ());
143+ input.detach ().clone ().set_requires_grad (input.requires_grad ());
144144 input_vars.push_back (oinput);
145145
146146 torch::Tensor xinput = CopyToDevice (input, device)
Original file line number Diff line number Diff line change @@ -1524,8 +1524,8 @@ Tensor new_tensor(
15241524 if (THPVariable_Check (data)) {
15251525 auto ret = PyErr_WarnEx (
15261526 PyExc_UserWarning,
1527- " To copy construct from a tensor, it is recommended to use sourceTensor.clone ().detach () "
1528- " or sourceTensor.clone ().detach ().requires_grad_(True), rather than tensor.new_tensor(sourceTensor)." ,
1527+ " To copy construct from a tensor, it is recommended to use sourceTensor.detach ().clone () "
1528+ " or sourceTensor.detach ().clone ().requires_grad_(True), rather than tensor.new_tensor(sourceTensor)." ,
15291529 1 );
15301530 if (ret != 0 )
15311531 throw python_error ();
You can’t perform that action at this time.
0 commit comments