mirror of
				https://github.com/labmlai/annotated_deep_learning_paper_implementations.git
				synced 2025-11-04 14:29:43 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			7 lines
		
	
	
		
			142 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			7 lines
		
	
	
		
			142 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import torch
 | 
						|
 | 
						|
 | 
						|
def subsequent_mask(seq_len):
 | 
						|
    mask = torch.tril(torch.ones(seq_len, seq_len)).to(torch.bool).unsqueeze(-1)
 | 
						|
    return mask
 |