Heres’s something that might fill the need:
class HistoBin(nn.Module):
    def __init__(self, locations = np.arange(0,1,.1), radius=.2, norm = True):
        super(HistoBin, self).__init__()
        
        self.locs = locations
        self.r = radius
        self.norm = norm
    
    def forward(self, x):
        
        counts = []
        
        for loc in self.locs:
            dist = torch.abs(x - loc)
            #print dist
            ct = torch.relu(self.r - dist).sum(1) 
            counts.append(ct)
        
        out = torch.stack(counts, 1)
        
        if self.norm:
            summ = out.sum(1) + .000001
            return (out.transpose(1,0) / summ).transpose(1,0)
        return out