I’m trying to create a custom loss that penalizes a sparse network (SparseConvNet) for incorrectly activating inactive sites in its output. The only way it’s occurred to me to do this is to simply count the number of shared active sites between the network’s output and the target output, then compute a loss that increases as this number of shared active sites decreases. Is there a way to do make this differentiable without expanding the sparse output and sparse target to their dense representations and then doing something like loss=torch.norm(output-target, p=1)?