Attend the Women in ML Symposium on December 7 Register now

tfp.experimental.distributions.marginal_fns.ps.tensorshape_util.constant_value_as_shape

Stay organized with collections Save and categorize content based on your preferences.

A version of constant_value() that returns a TensorShape.

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.

tensor The rank-0 or rank-1 Tensor to be evaluated.

A TensorShape based on the constant value of the given tensor.

ValueError If the shape is rank-0 and is not statically known to be -1.