Skip to content
Merged
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
18 changes: 18 additions & 0 deletions include/cudnn_frontend/graph_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -2510,6 +2510,24 @@ class Graph : public ICudnn, public INode {
j["nodes"] = json::array();
j["tensors"] = json::array();
std::map<Tensor_attributes::uid_t, json> tensors;
std::vector<std::shared_ptr<Tensor_attributes>> tensors_in_graph;
status = collect_tensor_attributes_subtree(tensors_in_graph);
if (status.is_bad()) {
throw std::runtime_error(status.get_message());
}
std::unordered_set<Tensor_attributes const *> collected_ragged_offsets;
auto add_ragged_offsets = [&](auto const &self, std::shared_ptr<Tensor_attributes> const &tensor) -> void {
if (tensor == nullptr || !collected_ragged_offsets.insert(tensor.get()).second) {
return;
}
tensors.emplace(tensor->get_uid(), json(*tensor));
self(self, tensor->get_ragged_offset());
};
for (auto const &tensor : tensors_in_graph) {
if (tensor != nullptr) {
add_ragged_offsets(add_ragged_offsets, tensor->get_ragged_offset());
}
}
auto add_tensor = [&](json &refs, std::string const &port_name, json const &tensor_info) {
if (tensor_info.is_null()) {
return;
Expand Down