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
8 changes: 6 additions & 2 deletions ngraph_bridge/enable_variable_ops/ngraph_rewrite_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,12 @@ class NGraphEncapsulationPass : public NGraphRewritePass {

// 4. Encapsulate clusters then, if requested, dump the graphs.
FunctionDefLibrary* fdeflib_new = new FunctionDefLibrary();
TF_RETURN_IF_ERROR(EncapsulateClusters(options.graph->get(), idx,
fdeflib_new, config_map, {0, {}}));
auto status = EncapsulateClusters(options.graph->get(), idx, fdeflib_new,
config_map, {0, {}});
if (status != Status::OK()) {
delete (fdeflib_new);
return status;
}
// TODO: not using fdeflib_new in this path. Only grappler path uses it
free(fdeflib_new);
if (DumpEncapsulatedGraphs()) {
Expand Down
10 changes: 7 additions & 3 deletions ngraph_bridge/grappler/ngraph_optimizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,13 @@ Status NgraphOptimizer::Optimize(tensorflow::grappler::Cluster* cluster,

// 4. Encapsulate clusters then, if requested, dump the graphs.
FunctionDefLibrary* fdeflib_new = new FunctionDefLibrary();
TF_RETURN_IF_ERROR(
// TODO: right now _ngraph_aot_requested is passed along in config_map.
EncapsulateClusters(&graph, idx, fdeflib_new, config_map, aot_info));
// TODO: right now _ngraph_aot_requested is passed along in config_map.
auto status =
EncapsulateClusters(&graph, idx, fdeflib_new, config_map, aot_info);
if (status != Status::OK()) {
delete (fdeflib_new);
return status;
}
if (DumpEncapsulatedGraphs()) {
DumpGraphs(graph, idx, "encapsulated", "Graph with Clusters Encapsulated");
}
Expand Down
8 changes: 6 additions & 2 deletions ngraph_bridge/ngraph_rewrite_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,12 @@ class NGraphEncapsulationPass : public NGraphRewritePass {

// 4. Encapsulate clusters then, if requested, dump the graphs.
FunctionDefLibrary* fdeflib_new = new FunctionDefLibrary();
TF_RETURN_IF_ERROR(EncapsulateClusters(options.graph->get(), idx,
fdeflib_new, config_map, {0, {}}));
auto status = EncapsulateClusters(options.graph->get(), idx, fdeflib_new,
config_map, {0, {}});
if (status != Status::OK()) {
delete (fdeflib_new);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for braces delete fdeflib_new;

return status;
}
// TODO: not using fdeflib_new in this path. Only grappler path uses it
delete (fdeflib_new);
if (DumpEncapsulatedGraphs()) {
Expand Down