def sequences_get_mask(sequences, pad_val=0):
 mask = np.ones_like(sequences)
 for (i, seq) in enumerate(sequences):
  for i_w in reversed(range(len(seq))):
   if (seq[i_w] == pad_val):
    mask[(i, i_w)] = 0
   else:
    break
 return mask

def sequences_get_mask ( sequences , pad_val = 0 ) : mask = np . ones_like ( sequences ) for ( i , seq ) in enumerate ( sequences ) : for i_w in reversed ( range ( len ( seq ) ) ) : if ( seq [ i_w ] == pad_val ) : mask [ ( i , i_w ) ] = 0 else : break return mask
return mask for sequences .