Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/cpp/cpp_test_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ std::string GetTensorDotGraph(at::Tensor tensor) {
return ir::DumpUtil::ToDot({xtensor.GetIrValue().node.get()});
}

std::string GetTensorHloGraph(at::Tensor tensor) {
XLATensor xtensor = bridge::GetXlaTensor(tensor);
return ir::DumpUtil::ToHlo({xtensor.GetIrValue()});
}

ir::Value GetTensorIrValue(const at::Tensor& tensor, const Device& device) {
xla::ComputationClient::DataPtr data = TensorToXlaData(tensor, device);
return ir::MakeNode<ir::ops::DeviceData>(std::move(data));
Expand Down
2 changes: 2 additions & 0 deletions test/cpp/cpp_test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ std::string GetTensorTextGraph(at::Tensor tensor);

std::string GetTensorDotGraph(at::Tensor tensor);

std::string GetTensorHloGraph(at::Tensor tensor);

ir::Value GetTensorIrValue(const at::Tensor& tensor, const Device& device);

std::vector<xla::ComputationClient::DataPtr> Execute(
Expand Down