Skip to content

Commit 82bfa05

Browse files
committed
Get rid of NodeNotFound
1 parent 526ad23 commit 82bfa05

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/core.jl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,13 +1128,6 @@ function Operation(ptr::Ptr)
11281128
return self
11291129
end
11301130

1131-
struct NodeNameNotFound <: Exception
1132-
name::String
1133-
end
1134-
1135-
function Base.show(io::IO, err::NodeNameNotFound)
1136-
print(io, "Node $(err.name) not found in graph")
1137-
end
11381131

11391132
get_graph(n::AbstractOperation) = Operation(n).graph
11401133

@@ -1555,12 +1548,12 @@ end
15551548
15561549
Returns the tensor with name `name` (in name:port format) in the given graph.
15571550
1558-
Throws a `NodeNameNotFound` exception if there is no such tensor.
1551+
Returns `nothing` if the tensor is not found.
15591552
"""
15601553
@with_def_graph function get_tensor_by_name(graph::Graph, full_name)
15611554
name, port = parse_port_name(full_name)
15621555
maybe_node = get_node_by_name(graph, name)
1563-
isnull(maybe_node) && throw(NodeNameNotFound(full_name))
1556+
isnull(maybe_node) && return nothing
15641557
node = get(maybe_node)
15651558
return Tensor(node, port)
15661559
end

0 commit comments

Comments
 (0)