---
title: "Recognition Error: tensorflow KeyError \"The name 'import/input' refers to an Operation not in the graph.\""
description: "A small error I ran into recently"
author: "kidneyweakx"
published: 2019-04-07T00:00:00.000Z
updated: 2026-06-02T17:22:05.558Z
lang: en
tags: ["程式筆記", "Tensorflow"]
canonical: https://kidneyweakx.com/blog/19log-0407-tensor-error?lang=en
alternate_zh_tw: https://kidneyweakx.com/blog/19log-0407-tensor-error.md
alternate_ja: https://kidneyweakx.com/blog/19log-0407-tensor-error.md?lang=ja
---

# Recognition Error: tensorflow KeyError "The name 'import/input' refers to an Operation not in the graph."

### **A small error I ran into recently**

```python
KeyError: "The name 'import/input' refers to an Operation not in the graph."
```

![1.00](https://raw.githubusercontent.com/kidneyweakx/img-host/image/image/tensor01.PNG)

Put simply, you typed the name wrong, so your input is, well, input wrong.

I dug through posts online and tried all kinds of things like ` "Mul" "input"`, and they were all wrong.

In the end I found this article: [link](https://developer.arm.com/technologies/machine-learning-on-arm/developer-material/how-to-guides/optimizing-neural-networks-for-mobile-and-embedded-devices-with-tensorflow/determine-the-names-of-input-and-output-nodes)

### **TL;DR**

> First use `tensorflow`'s tools to convert the `.pb` into a format you can view in `tensorboard`, then look up what the `input_layer` (mine was `placeholder`) and `output_layer` are actually named, and fix them.

Here's my command (adjust it to your own needs):

```python
python tensorflow\examples\label_image\label_image.py --graph=tmp\output_graph.pb --label=tmp\output_labels.txt --image=tmp\91076.png --input_layer=Placeholder --output_layer=final_result
```

Output
![](https://raw.githubusercontent.com/kidneyweakx/img-host/image/image/tensor02.PNG)
