I am trying to threshold Variables using the adaptive value as below.
import torch
from torch.autograd import Variable
import torch.nn as nn

x = Variable(torch.rand(10))
maxx = torch.max(x)
m = nn.Threshold(0.6*maxx,0)
y = m(x)

As you can see, it won’t work because ‘maxx’ is variable not constant.
How can I use the adaptive threshold ?
Thanks in advance for your help.