(i_hds, l_hpu, l_hs, hS, num_hidden_layers, all_encoder_layer, num_out_layers_h)
return wemb_h
As if
    [ [table-1-col-1-tok1, t1-c1-t2, ...],
       [t1-c2-t1, t1-c2-t2, ...].
       ...
       [t2-c1-t1, ...,]
    ]
As if
    [ [table-1-col-1-tok1, t1-c1-t2, ...],
       [t1-c2-t1, t1-c2-t2, ...].
       ...
       [t2-c1-t1, ...,]
    ]
As if [ [ table - 1 - col - 1 - tok1 t1 - c1 - t2 ... ] [ t1 - c2 - t1 t1 - c2 - t2 ... ] . ... [ t2 - c1 - t1 ... ] ]
def get_wemb_h(i_hds, l_hpu, l_hs, hS, num_hidden_layers, all_encoder_layer, num_out_layers_h):
    """
    As if
    [ [table-1-col-1-tok1, t1-c1-t2, ...],
       [t1-c2-t1, t1-c2-t2, ...].
       ...
       [t2-c1-t1, ...,]
    ]
    """
    bS = len(l_hs)
    l_hpu_max = max(l_hpu)
    num_of_all_hds = sum(l_hs)
    wemb_h = torch.zeros([num_of_all_hds, l_hpu_max, hS * num_out_layers_h]).to(device)
    b_pu = -1
    for b, i_hds1 in enumerate(i_hds):
        for b1, i_hds11 in enumerate(i_hds1):
            b_pu += 1
            for i_nolh in range(num_out_layers_h):
                i_layer = num_hidden_layers - 1 - i_nolh
                st = i_nolh * hS
                ed = (i_nolh + 1) * hS
                wemb_h[b_pu, 0:(i_hds11[1] - i_hds11[0]), st:ed] \
                    = all_encoder_layer[i_layer][b, i_hds11[0]:i_hds11[1],:]


    return wemb_h
def get_wemb_h ( i_hds , l_hpu , l_hs , hS , num_hidden_layers , all_encoder_layer , num_out_layers_h ) : bS = len ( l_hs ) l_hpu_max = max ( l_hpu ) num_of_all_hds = sum ( l_hs ) wemb_h = torch . zeros ( [ num_of_all_hds , l_hpu_max , hS * num_out_layers_h ] ) . to ( device ) b_pu = - 1 for b , i_hds1 in enumerate ( i_hds ) : for b1 , i_hds11 in enumerate ( i_hds1 ) : b_pu += 1 for i_nolh in range ( num_out_layers_h ) : i_layer = num_hidden_layers - 1 - i_nolh st = i_nolh * hS ed = ( i_nolh + 1 ) * hS wemb_h [ b_pu , 0 : ( i_hds11 [ 1 ] - i_hds11 [ 0 ] ) , st : ed ] = all_encoder_layer [ i_layer ] [ b , i_hds11 [ 0 ] : i_hds11 [ 1 ] , : ] return wemb_h