original_docstring: 
      Create a 2D tensor from a dataframe using specific metrics and the sequence
      pad y adds padding up to the length of the largest sequence using pytorch pad_sequence
      Pad xy adds an xy padding like Prottrans first.
      
docstring: Create a 2D tensor from a dataframe using specific metrics and the sequence
  pad y adds padding up to the length of the largest sequence using pytorch pad_sequence
  Pad xy adds an xy padding like Prottrans first.
docstring_tokens: Create a 2D tensor from a dataframe using specific metrics and the sequence pad y adds padding up to the length of the largest sequence using pytorch pad_sequence Pad xy adds an xy padding like Prottrans first .
code: def create_2D_tensor_from_score_data(df: pandas.DataFrame, metrics: List, seq_column="sequence_1D", pady = True, padxy = True, scale = False, standardize=False) -> torch.Tensor:
      """
      Create a 2D tensor from a dataframe using specific metrics and the sequence
      pad y adds padding up to the length of the largest sequence using pytorch pad_sequence
      Pad xy adds an xy padding like Prottrans first.
      """
  
      decoy_tensors =  []
      #print(metrics)
  
      #We make the metrics sorted so that when we serve the models eventually, they are in the same order for predictions
      sorted_metrics = sorted(metrics)
      for index, row in df.iterrows():
  
          s = row[seq_column]
          features = []
          for metric in sorted_metrics:
              #print("Loading ", metric)
              #print(row[metric])
              energies = {int(x.split(':')[0]) : float(x.split(':')[1]) for x in row[metric].split(',')}
  
              #Make sure all values are present. Not all metrics output zeros.
              data_2d = []
              if padxy:
                  data_2d.append(0.0)
              for i in range(1, len(s)+1):
                  if not i in energies:
                      data_2d.append(0.0)
                  else:
                      t = energies[i]
                      data_2d.append(t)
  
              if padxy:
                  data_2d.append(0.0)
  
              features.append(data_2d)
  
          dt = torch.tensor(features, dtype=torch.float32)
  
          #Permute causes everything to be super slow if its not contiguous.
          dt = dt.permute(1, 0).contiguous()
          #print(dt.shape)
          decoy_tensors.append(dt)
  
      #Batch first makes it so you don't have to permute - but you remove the padxy column.
      dt = pad_sequence(decoy_tensors)
      #print(dt.shape)
      dtp = dt.permute(1,2,0).contiguous()
  
      if scale:
          if standardize:
              means = dtp.mean(dim=[0,2], keepdim=True)
              stds = dtp.std(dim=[0,2], keepdim=True)
              dtp = (dtp - means) / stds
          else:
              dtp=F.normalize(dtp,p=2, dim=1)
      return dtp
code_tokens: def create_2D_tensor_from_score_data ( df : pandas . DataFrame , metrics : List , seq_column = "sequence_1D" , pady = True , padxy = True , scale = False , standardize = False ) -> torch . Tensor : decoy_tensors = [ ] sorted_metrics = sorted ( metrics ) for index , row in df . iterrows ( ) : s = row [ seq_column ] features = [ ] for metric in sorted_metrics : energies = { int ( x . split ( ':' ) [ 0 ] ) : float ( x . split ( ':' ) [ 1 ] ) for x in row [ metric ] . split ( ',' ) } data_2d = [ ] if padxy : data_2d . append ( 0.0 ) for i in range ( 1 , len ( s ) + 1 ) : if not i in energies : data_2d . append ( 0.0 ) else : t = energies [ i ] data_2d . append ( t ) if padxy : data_2d . append ( 0.0 ) features . append ( data_2d ) dt = torch . tensor ( features , dtype = torch . float32 ) dt = dt . permute ( 1 , 0 ) . contiguous ( ) decoy_tensors . append ( dt ) dt = pad_sequence ( decoy_tensors ) dtp = dt . permute ( 1 , 2 , 0 ) . contiguous ( ) if scale : if standardize : means = dtp . mean ( dim = [ 0 , 2 ] , keepdim = True ) stds = dtp . std ( dim = [ 0 , 2 ] , keepdim = True ) dtp = ( dtp - means ) / stds else : dtp = F . normalize ( dtp , p = 2 , dim = 1 ) return dtp
short_docstring: Create a 2D tensor from a dataframe using specific metrics and the sequence
  pad y adds padding up to the length of the largest sequence using pytorch pad_sequence
  Pad xy adds an xy padding like Prottrans first.
short_docstring_tokens: Create a 2D tensor from a dataframe using specific metrics and the sequence pad y adds padding up to the length of the largest sequence using pytorch pad_sequence Pad xy adds an xy padding like Prottrans first .
comment: """
      Create a 2D tensor from a dataframe using specific metrics and the sequence
      pad y adds padding up to the length of the largest sequence using pytorch pad_sequence
      Pad xy adds an xy padding like Prottrans first.
      """$SEP$#print(metrics)$SEP$#We make the metrics sorted so that when we serve the models eventually, they are in the same order for predictions$SEP$#print("Loading ", metric)$SEP$#print(row[metric])$SEP$#Make sure all values are present. Not all metrics output zeros.$SEP$#Permute causes everything to be super slow if its not contiguous.$SEP$#print(dt.shape)$SEP$#Batch first makes it so you don't have to permute - but you remove the padxy column.$SEP$#print(dt.shape)