tf.keras.backend.dot
| Просмотреть исходный код на GitHub |
Умножает 2 тензора (и/или переменные) и возвращает тензор.
tf.keras.backend.dot(
x, y
)
При попытке умножить nD тензор на nD тензор, он воспроизводит поведение Theano. (например, (2, 3) * (4, 3, 5) -> (2, 4, 5))
| Аргументы | |
|---|---|
x | Тензор или переменная. |
y | Тензор или переменная. |
| Возвращаемое значение | |
|---|---|
Тензор, скалярное произведение x и y. |
Примеры:
# dot product between tensors >>> x = K.placeholder(shape=(2, 3)) >>> y = K.placeholder(shape=(3, 4)) >>> xy = K.dot(x, y) >>> xy <tf.Tensor 'MatMul_9:0' shape=(2, 4) dtype=float32>
# dot product between tensors >>> x = K.placeholder(shape=(32, 28, 3)) >>> y = K.placeholder(shape=(3, 4)) >>> xy = K.dot(x, y) >>> xy <tf.Tensor 'MatMul_9:0' shape=(32, 28, 4) dtype=float32>
# Theano-like behavior example >>> x = K.random_uniform_variable(shape=(2, 3), low=0, high=1) >>> y = K.ones((4, 3, 5)) >>> xy = K.dot(x, y) >>> K.int_shape(xy) (2, 4, 5)
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/backend/dot