
[英]Flask - How do I use the value of an HTML button in a Python function?
[英]How do I use this function to change the value of t in Python?
我正在学习如何在 Python 中从头开始创建一个基本的神经网络。 我想创建一个接收参数的 function,然后将参数的值更改为使用数学 function 的 output。 当我显示代码时,这可能会更有意义。
def squash(t):
t = 1 / (1 + math.pow(math.e, t * -1))
return
我希望我输入的任何参数都将其值更改为 function 的t
,但是当我在我的代码中调用 function 时,没有更改参数。 任何帮助,将不胜感激。
阅读 python 中的可变/不可变类型。 还有变量的范围。
寻求解决方案,您可能想要
def squash(t):
t = 1 / (1 + math.pow(math.e, t * -1))
return t
my_var = squash(my_var)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.