Does not work 
I tried both setting it to False and to torch.tensor(False, dtype=torch.bool):

class PCTL_Layer(nn.Module):
    def __init__(self, calculate_running=False):
        super(PCTL_Layer, self).__init__()
        self.register_buffer('running', torch.zeros(1))
        self.calculate_running = torch.tensor(calculate_running, dtype=torch.bool)

    def forward(self, input):
        if self.calculate_running:
            pctl, _ = torch.kthvalue(input.view(-1), int(input.numel() * 0.9))
            self.running = pctl
            print(' gpu {}  calculate_running: {}'.format(torch.cuda.current_device(), self.calculate_running))
            self.calculate_running = False
            #self.calculate_running = torch.tensor(False, dtype=torch.bool)

        return self.running