定义了一个模型,该模型接受形状(96,96,3)的输入,并输出形状( 128 ),即对给定的输入大小的图像提供128大小的嵌入。类似于facenet
createmodel()是在构造模型后返回完整模型的函数。由于模型期望输入的形式为(batch_size,96,96,3),我传递3幅图像,即(3,96,96,3),因此模型的输出将是形状(1,3,128)。铭记这一点,请考虑以下几点:
nn4_small2=createmodel()
print(nn4_small2.outputs[0][2])
#prints Tensor("strided_slice_11:0", shape=(128,), dtype=float32)
x=nn4_small2.outputs[0][2]
print(tf.shape(x))
#prints Tensor("Shape_6:0", shape=(1,), dtype=int32)为什么输出张量的形状在分配给变量时会发生变化?
发布于 2018-04-28 06:17:17
https://stackoverflow.com/questions/50073216
复制相似问题