[英]Return in Python on Linux Mint fails for Tensorflow Processing Code
我的python代碼給出了以下問題:-
if __name__ == "__main__":
file_name = "tensorflow/examples/label_image/data/grace_hopper.jpg"
...
with tf.Session(graph=graph) as sess:
results = sess.run(output_operation.outputs[0], {
input_operation.outputs[0]: t
})
results = np.squeeze(results)
top_k = results.argsort()[-5:][::-1]
labels = load_labels(label_file)
j=0
for i in top_k:
print(labels[i], results[i])
age[j]=labels[i]
j=j+1
if age[0] == "youngadult":
t = 0
elif age[0] == "youth":
t = 1
elif age[0] == "adult":
t = 2
elif age[0] == "seniors":
t = 3
elif age[0] == "children":
t = 4
else:
t = 5
return t
PS Python-Python 2.7.15 :: Anaconda,Inc.
Linux- Mint18.3肉桂64位
肉桂版本-3.6.7
處理器-AMD Ryzen5 1600六核處理器X 6
內存-7.8GiB
硬盤-952.7GB
圖形卡-NVIDIA Corporation Device 1c82
錯誤-語法錯誤:函數外部“返回”
請幫忙
問候
__main__
不是“函數”,因為您可以從中返回一些信息。
您想做什么以及為什么要回來?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.