Skip to content

Commit

Permalink
cover mul
Browse files Browse the repository at this point in the history
(cherry picked from commit 30abe2be43defc25db8954c525d34f7f3de35292)
  • Loading branch information
Siyuan Liu committed Feb 6, 2024
1 parent 9df9f0c commit 3e4db72
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion torch_xla/csrc/tensor_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1848,8 +1848,12 @@ XLATensorPtr mul(const XLATensorPtr& input, const XLATensorPtr& other,

XLATensorPtr mul(const XLATensorPtr& input, const at::Scalar& other,
c10::optional<at::ScalarType> logical_element_type) {
const torch::lazy::BackendDevice& device = input->GetDevice();
torch::lazy::Value constant = XLAGraphExecutor::Get()->GetIrValueForScalar(
other, input->shape(), logical_element_type, input->GetDevice());
other,
xla::ShapeUtil::MakeScalarShape(
MakeXlaPrimitiveType(*logical_element_type, &device)),
logical_element_type, device);
return input->CreateFrom(input->GetIrValue() * constant,
logical_element_type);
}
Expand Down

0 comments on commit 3e4db72

Please sign in to comment.