简体   繁体   English

tensorflow python 2.7交互式shell:函数调用失败

[英]tensorflow python 2.7 interactive shell: function call fails

在此处输入图片说明

I am studying udacity course: deep learning. 我正在学习大胆的课程:深度学习。 Actually it teaches Google's tensorFlow. 实际上,它教了Google的tensorFlow。 In Python interactive shell, I define the function softmax, when I invoke it, it says syntaxt error. 在Python交互式外壳程序中,我定义了函数softmax,当我调用它时,它表示语法错误。 Why? 为什么? Any hint. 任何提示。

I have import numpy as np 我将numpy导入为np

>>> import numpy as np
>>> import tensorflow as tf
>>> def softmax(x):
...     return np.exp(x);
... softmax([1])
SyntaxError: invalid syntax

Are there requirment exact number of indention space? 是否有缩进空间的确切数量?

When using interactive, make sure that the ... is not there. 使用交互式时,请确保...不存在。 The compiler will include anything in ... in a function, method, while, or for block. 编译器将在函数,方法,while或for块中包含...中的所有内容。 To escape from the ... , just hit enter again and call the method from >>> . 从逃避... ,只需点击进入再次和调用方法>>>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM