gpt4 book ai didi

python - Theano中的借用参数是什么

转载 作者:太空狗 更新时间:2023-10-30 02:29:59 24 4
gpt4 key购买 nike

我看到下面这行代码:

n_train_batches = train_set_x.get_value(borrow=True).shape[0] / batch_size

在上一行中,借用参数到底是什么?在那里添加它有什么好处?仅供引用,train_set_x 基本上是使用 theano.shared 方法生成的矩阵。

最佳答案

This part of the documentation似乎相关:

By default (s_default) and when explicitly setting borrow=False, the shared variable we construct gets a deep copy of np_array. So changes we subsequently make to np_array have no effect on our shared variable.

然后可以假设将其设置为 True 进行浅拷贝,有效地让您“借用”对内存的访问。

关于python - Theano中的借用参数是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29774413/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com