if index is not None:
return _get_tensor_by_name(name, index, graph)
tensor = _get_tensor_by_name(name, "0", graph)
if tensor is None:
return tensor
if _get_tensor_by_name(name, "1", graph) is not None:
raise ValueError("Ambiguous tensor for "{0}" with multiple indices found."
.format(name))
return tensor
def is_ndarray(value):
return isinstance(value, np.ndarray)