You can simply define a dropout layer and pass the tensor to it. For example -
a = torch.rand(1, 5)
print(a) # output is tensor([[0.3119, 0.1485, 0.6420, 0.4604, 0.0724]])
dropout = torch.nn.Dropout(1)
print(dropout(a))
# output is tensor([[0., 0., 0., 0., 0.]])