Theano中的allow_input_downcast是什么?

2024-04-26 15:03:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在查看可用的代码here

在第71&73行我看到allow_input_downcast. 例如在第71行

train = theano.function(inputs=[X, Y], outputs=cost, updates=updates, allow_input_downcast=True)`

你能帮我理解这个属性的用途吗?在

提前谢谢


Tags: 代码trueinput属性herefunctiontraintheano
1条回答
网友
1楼 · 发布于 2024-04-26 15:03:28

从Theano文档:

allow_input_downcast (Boolean or None) – True means that the values passed as inputs when calling the function can be silently downcasted to fit the dtype of the corresponding Variable, which may lose precision. False means that it will only be cast to a more general, or precise, type. None (default) is almost like False, but allows downcasting of Python float scalars to floatX.

例如(也许不是最具说明性的),这似乎表明如果您的输入是dtypenp.浮动64并且您的变量被实例化为具有dtypenp.浮动32,输入将转换为np.浮动32当标志设置为真时。在

相关问题 更多 >