import tensorflow as tf

            # shape = ()
            group_size = tf.minimum(
                x=group_size, y=cur_batch_size, name="group_size"
            )
            print_obj("grouped_minibatch_stddev", "group_size", group_size)

            # Split minibatch into M groups of size group_size, rank 5 tensor.
            # shape = (
            #     group_size,
            #     cur_batch_size / group_size,
            #     image_size,
            #     image_size,
            #     num_channels
            # )
            grouped_image = tf.reshape(
                tensor=X,
                shape=[group_size, -1] + static_image_shape,
                name="grouped_image"
            )
            print_obj(
                "grouped_minibatch_stddev",
                "grouped_image",
                grouped_image
            )

            # Find the mean of each group.
            # shape = (
            #     1,
