def vector_size_to_square_matrix_size(d, validate_args, name=None):
if isinstance(d, (float, int, np.generic, np.ndarray)):<EOL><INDENT>n = (-<NUM_LIT:1> + np.sqrt(<NUM_LIT:1> + <NUM_LIT:8> * d)) / <NUM_LIT><EOL>if float(int(n)) != n:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>return int(n)<EOL><DEDENT>else:<EOL><INDENT>with tf.name_scope(name or "<STR_LIT>") as name:<EOL><INDENT>n = (-<NUM_LIT:1.> + tf.sqrt(<NUM_LIT:1> + <NUM_LIT> * tf.cast(d, dtype=tf.float32))) / <NUM_LIT><EOL>if validate_args:<EOL><INDENT>with tf.control_dependencies([<EOL>assert_util.assert_equal(<EOL>tf.cast(tf.cast(n, dtype=tf.int32), dtype=tf.float32),<EOL>n,<EOL>message="<STR_LIT>")<EOL>]):<EOL><INDENT>n = tf.identity(n)<EOL><DEDENT><DEDENT>return tf.cast(n, d.dtype)<EOL><DEDENT><DEDENT>
Convert a vector size to a matrix size.