YouTip LogoYouTip

Pytorch Torch Clip

# Clip values to [2, 4] range y = torch.clip(x,2,4) print(y)

Output result:

tensor([2., 2., 3., 4., 4.])

Image 4: Pytorch torch Reference Manual Pytorch torch Reference Manual

← Pytorch Torch Column_StackPytorch Torch Chunk β†’