如何在python中声明常量变量?

时间:2019-07-19 11:32:07

标签: python-3.x

我试图将常数值添加到圆的区域代码中,但我不知道该怎么做

# Support code for cem.py class BinaryActionLinearPolicy(object): def __init__(self, theta): self.w = theta[:-1] self.b = theta[-1] def act(self, ob): y = ob.dot(self.w) + self.b a = int(y < 0) return a class ContinuousActionLinearPolicy(object): def __init__(self, theta, n_in, n_out): assert len(theta) == (n_in + 1) * n_out self.W = theta[0 : n_in * n_out].reshape(n_in, n_out) self.b = theta[n_in * n_out : None].reshape(1, n_out) def act(self, ob): a = ob.dot(self.W) + self.b return a 我期望pi的值应为常数3.14 但是值不是恒定的

0 个答案:

没有答案