tf.compat.v1.math.scalar_mul
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Multiplies a scalar times a Tensor or IndexedSlices object.
tf.compat.v1.math.scalar_mul(
scalar, x, name=None
)
This is a special case of tf.math.multiply, where the first value must be a
scalar. Unlike the general form of tf.math.multiply, this is operation is
guaranteed to be efficient for tf.IndexedSlices.
x = tf.reshape(tf.range(30, dtype=tf.float32), [10, 3])
with tf.GradientTape() as g:
g.watch(x)
y = tf.gather(x, [1, 2]) # IndexedSlices
z = tf.math.scalar_mul(10.0, y)
Args |
scalar
|
A 0-D scalar Tensor. Must have known shape.
|
x
|
A Tensor or IndexedSlices to be scaled.
|
name
|
A name for the operation (optional).
|
Returns |
scalar * x of the same type (Tensor or IndexedSlices) as x.
|
Raises |
ValueError
|
if scalar is not a 0-D scalar.
|
如未另行说明,则本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。如需了解详情,请参阅 Google Developers 网站政策。Java 是 Oracle 和/或其关联公司的注册商标。某些内容已根据 Numpy 许可获得了许可。
最后更新时间 (UTC):2024-04-26。
[null,null,["最后更新时间 (UTC):2024-04-26。"],[],[]]