Keras.backend.constant()错误(无法将符号张量(Shape_1:0)转换为numpy数组)

时间:2020-02-19 03:57:27

标签: python tensorflow

我正在尝试创建具有恒定值的张量。我是这样做的

img_shape = K.shape(ground_truth)
random_val = random.uniform(0,1)
random_tensor = K.constant(random_val,shape = img_shape)

我收到一个错误

NotImplementedError: Cannot convert a symbolic Tensor (Shape_1:0) to a numpy array.

我的ground_truth是形状为tensorflow.python.framework.ops.Tensor的{​​{1}}。谢谢!

0 个答案:

没有答案