如何理解theano tensor作为矩阵和keras.backend变量?

时间:2017-12-01 15:11:12

标签: python keras theano tensor

如果我使用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)

1 个答案:

答案 0 :(得分:0)

根据source code,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模型提供了形状和其他功能。

相关问题