sidechainnet/structure/StructureBuilder.py
def _convert_seq_to_str(seq):
    """Assuming seq is an int list or int tensor, returns its str representation."""
    seq_as_str = ""
    if isinstance(seq, torch.Tensor):
        seq = seq.numpy()
    seq = seq.flatten()
    if len(seq.shape) == 1:
        # The seq is represented as an integer sequence
        if len(seq.shape) == 1:
            seq_as_str = VOCAB.ints2str(seq)
        elif len(seq.shape) == 2:
            if seq.shape[0] != 1:
                raise ValueError(f"Seq shape {seq.shape} is not supported.")
            else:
                seq_as_str = VOCAB.ints2str(seq[0])
    else:
        raise UnsupportedOperation(f"Seq shape {seq.shape} is not supported.")

    return seq_as_str
Assuming seq is an int list or int tensor, returns its str representation.
Assuming seq is an int list or int tensor, returns its str representation.
Assuming seq is an int list or int tensor returns its str representation .
def _convert_seq_to_str(seq):
    seq_as_str = ""
    if isinstance(seq, torch.Tensor):
        seq = seq.numpy()
    seq = seq.flatten()
    if len(seq.shape) == 1:
        if len(seq.shape) == 1:
            seq_as_str = VOCAB.ints2str(seq)
        elif len(seq.shape) == 2:
            if seq.shape[0] != 1:
                raise ValueError(f"Seq shape {seq.shape} is not supported.")
            else:
                seq_as_str = VOCAB.ints2str(seq[0])
    else:
        raise UnsupportedOperation(f"Seq shape {seq.shape} is not supported.")
    return seq_as_str
def _convert_seq_to_str ( seq ) : seq_as_str = "" if isinstance ( seq , torch . Tensor ) : seq = seq . numpy ( ) seq = seq . flatten ( ) if len ( seq . shape ) == 1 : if len ( seq . shape ) == 1 : seq_as_str = VOCAB . ints2str ( seq ) elif len ( seq . shape ) == 2 : if seq . shape [ 0 ] != 1 : raise ValueError ( f"Seq shape {seq.shape} is not supported." ) else : seq_as_str = VOCAB . ints2str ( seq [ 0 ] ) else : raise UnsupportedOperation ( f"Seq shape {seq.shape} is not supported." ) return seq_as_str
Assuming seq is an int list or int tensor, returns its str representation.
Assuming seq is an int list or int tensor returns its str representation .
"""Assuming seq is an int list or int tensor, returns its str representation.""" # The seq is represented as an integer sequence
seq