[5., 6.]], dtype=float32)>
>>> t[..., 1, tf.newaxis]
Tensor: id=15, shape=(2, 1), dtype=float32,...36.]], dtype=float32)>
>>> t @ tf.transpose(t)
Tensor: id=24, shape=(2, 2), dtype=float32, numpy=...0, 1, 0, 1], [1, 1, 0, 1, 0, 1, 0, 1])
Tensor: id=581729, shape=(), dtype=float32, numpy=0.8>
>>>...precision([0, 1, 0, 0, 1, 0, 1, 1], [1, 0, 1, 1, 0, 0, 0, 0])
Tensor: id=581780, shape=(), dtype...在这个例子中,输出和输入的形状相同,除了最后一维被替换成了层的神经元数。在tf.keras中,形状是tf.TensorShape类的实例,可以用as_list()转换为Python列表。