簡體   English   中英

如何將theano張量理解為矩陣和keras.backend變量?

[英]How to understand a theano tensor as a matrix and a keras.backend variable?

如果我將Keras與theano一起使用,在這種情況下A和B有什么區別?

from keras import backend as K
import theano 

A = theano.tensor.matrix()
B =  K.zeros(shape = (d1, d2, d3, d4))

其中d1-d4是尺寸,例如(1,4,14,14)

根據源代碼 ,keras在theano中創建了此代碼

variable = theano.shared(value=np.zeros(shape),
                         name='somename',
                         strict=False)
variable._keras_shape = value.shape
variable._uses_learning_phase = False

通常最好使用keras對象。 他們具有用於keras模型的形狀和其他功能。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM