Skip to content

Commit ef86ac3

Browse files
committed
Remove unnecessary CreateFrom
1 parent 7be77aa commit ef86ac3

File tree

3 files changed

+1
-35
lines changed

3 files changed

+1
-35
lines changed

torch_xla/csrc/tensor.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,42 +1242,15 @@ torch::lazy::Value XLATensor::MaybeCastIrValue(
12421242
}
12431243

12441244
XLATensorPtr XLATensor::CreateFrom(torch::lazy::Value ir_value) const {
1245-
ir_value = MaybeCastIrValue(std::move(ir_value), GetDevice(),
1246-
/*logical_element_type=*/c10::nullopt);
12471245
return Create(std::move(ir_value), GetDevice(), dtype_optional());
12481246
}
12491247

1250-
XLATensorPtr XLATensor::CreateFrom(
1251-
torch::lazy::Value ir_value,
1252-
const torch::lazy::BackendDevice& device) const {
1253-
ir_value = MaybeCastIrValue(std::move(ir_value), device,
1254-
/*logical_element_type=*/c10::nullopt);
1255-
return Create(std::move(ir_value), device, dtype_optional());
1256-
}
1257-
1258-
XLATensorPtr XLATensor::CreateFrom(torch::lazy::Value ir_value,
1259-
at::ScalarType logical_element_type) const {
1260-
ir_value =
1261-
MaybeCastIrValue(std::move(ir_value), GetDevice(), logical_element_type);
1262-
return Create(std::move(ir_value), GetDevice(), logical_element_type);
1263-
}
1264-
12651248
XLATensorPtr XLATensor::CreateFrom(
12661249
torch::lazy::Value ir_value,
12671250
c10::optional<at::ScalarType> logical_element_type_opt) const {
1268-
ir_value = MaybeCastIrValue(std::move(ir_value), GetDevice(),
1269-
logical_element_type_opt);
12701251
return Create(std::move(ir_value), GetDevice(), logical_element_type_opt);
12711252
}
12721253

1273-
XLATensorPtr XLATensor::CreateFrom(torch::lazy::Value ir_value,
1274-
const torch::lazy::BackendDevice& device,
1275-
at::ScalarType logical_element_type) const {
1276-
ir_value =
1277-
MaybeCastIrValue(std::move(ir_value), device, logical_element_type);
1278-
return Create(std::move(ir_value), device, logical_element_type);
1279-
}
1280-
12811254
void XLATensor::ApplyPendingGraph() {
12821255
DeviceBarrier(GetDevice());
12831256
// This method is called to ensure that the tensor data is available on

torch_xla/csrc/tensor.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,16 +1396,9 @@ class XLATensor : public c10::intrusive_ptr_target {
13961396
// Create a new XLA tensor with the same metadata of the input tensor (with
13971397
// possible overrides), and the new IR value.
13981398
XLATensorPtr CreateFrom(torch::lazy::Value ir_value) const;
1399-
XLATensorPtr CreateFrom(torch::lazy::Value ir_value,
1400-
const torch::lazy::BackendDevice& device) const;
1401-
XLATensorPtr CreateFrom(torch::lazy::Value ir_value,
1402-
at::ScalarType logical_element_type) const;
14031399
XLATensorPtr CreateFrom(
14041400
torch::lazy::Value ir_value,
14051401
c10::optional<at::ScalarType> logical_element_type_opt) const;
1406-
XLATensorPtr CreateFrom(torch::lazy::Value ir_value,
1407-
const torch::lazy::BackendDevice& device,
1408-
at::ScalarType logical_element_type) const;
14091402

14101403
// We build an XLA graph accumulating XLA operations, but at a given point we
14111404
// need to force a rendering, otherwise the graph can grow without control.

torch_xla/csrc/tensor_methods.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ XLATensorPtr XLATensor::full_like(const XLATensorPtr& input,
12041204
} else {
12051205
scalar_type = input->dtype();
12061206
}
1207-
return input->CreateFrom(
1207+
return XLATensor::Create(
12081208
GetIrValueForScalar(fill_value, tensor_shape, device), device,
12091209
*scalar_type);
12101210
}

0 commit comments

Comments
 (0)