Theano 强制张量元素为值

Theano force tensor elements to be value

我有一个theano张量W。我想强制W的一些元素为2。我该怎么做?我知道 theano TensorVariable 不支持项目分配。不可能这样做吗?我不能为它使用共享变量,因为 W 是从另一个 theano 变量派生的。

您可以在 theano.tensor 中尝试 set_subtensor。希望那里提供的示例应该足够清楚。