def _is_scalar_helper(self, static_shape, dynamic_shape_fn):
if tensorshape_util.rank(static_shape) is not None:<EOL><INDENT>return tensorshape_util.rank(static_shape) == <NUM_LIT:0><EOL><DEDENT>shape = dynamic_shape_fn()<EOL>if tf.compat.dimension_value(shape.shape[<NUM_LIT:0>]) is not None:<EOL><INDENT>return tensorshape_util.as_list(shape.shape) == [<NUM_LIT:0>]<EOL><DEDENT>return tf.equal(tf.shape(input=shape)[<NUM_LIT:0>], <NUM_LIT:0>)<EOL>
Implementation for `is_scalar_batch` and `is_scalar_event`.