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.
|