python - _, 表示什么意思呢
PHPz
PHPz 2017-04-18 10:26:25
0
6
1190

在tensorflow一个学习代码中遇到了这样一行代码:
_, loss_value = sess.run()

想请问一下这个_,表示什么意思呢

PHPz
PHPz

学习是最好的投资!

reply all(6)
PHPzhong

Variables that can be ignored

_ Just a placeholder

大家讲道理

If you are in REPL, _ can represent the return value of the previous step
For example

>>> (lambda : 2)()
2
>>> _
2
刘奇

represents the variable name

PHPzhong

sess.run() returns two parameters, the first parameter is saved in a variable named _. If _ is printed separately, it represents the value of the latest expression

左手右手慢动作

Indicates variables that will be discarded, crying face

左手右手慢动作

means that func is supposed to return two variables, but you only want to receive the latter variable, so use _ to occupy a position to indicate that it has been received

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!