tfp.experimental.distributions.marginal_fns.ps.tensorshape_util.constant_value_as_shape
A version of constant_value()
that returns a TensorShape
.
tfp.experimental.distributions.marginal_fns.ps.tensorshape_util.constant_value_as_shape(
tensor
)
This version should be used when a constant tensor value is
interpreted as a (possibly partial) shape, e.g. in the shape
function for tf.reshape()
. By explicitly requesting a
TensorShape
as the return value, it is possible to represent
unknown dimensions; by contrast, constant_value()
is
all-or-nothing.
Args |
tensor
|
The rank-0 or rank-1 Tensor to be evaluated.
|
Returns |
A TensorShape based on the constant value of the given tensor .
|
Raises |
ValueError
|
If the shape is rank-0 and is not statically known to be -1.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-11-21 UTC.
[null,null,["Last updated 2023-11-21 UTC."],[],[]]