'''simple docstring'''
from ...utils import is_torch_available, is_transformers_available


if is_transformers_available() and is_torch_available():
  from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline




'''simple docstring'''
def  _UpperCamelCase (     _a	:	int			):




    """simple docstring"""



    if bit_count < 0:
        raise ValueError('The given input must be positive'			)

    # get the generated string sequence
    __UpperCamelCase	:	Dict		    =  gray_code_sequence_string(_a			)
    #
    # convert them to integers
    for i in range(len(_a			)			):
        __UpperCamelCase	:	int		    =  int(sequence[i]				,     2			)

    return sequence







def  _UpperCamelCase (     _a	:	int			):




    """simple docstring"""



    if bit_count == 0:
        return ["0"]

    if bit_count == 1:
        return ["0", "1"]

    __UpperCamelCase	:	Dict		    =  1 << bit_count  # defines the length of the sequence
    # 1<< n is equivalent to 2^n

    # recursive answer will generate answer for n-1 bits
    __UpperCamelCase	:	Tuple		    =  gray_code_sequence_string(bit_count - 1			)

    __UpperCamelCase	:	str		    =  []

    # append 0 to first half of the smaller sequence generated
    for i in range(seq_len // 2			):
        __UpperCamelCase	:	Optional[Any]		    =  '0' + smaller_sequence[i]
        sequence.append(_a			)

    # append 1 to second half ... start from the end of the list
    for i in reversed(range(seq_len // 2			)			):
        __UpperCamelCase	:	List[Any]		    =  '1' + smaller_sequence[i]
        sequence.append(_a			)

    return sequence


if __name__ == "__main__":
  import doctest

  doctest.testmod()



