python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
How to minimize the number of values that are not 0?
If my output is a tensor of values:
torch.tensor([0.0, 1.2, 0.1, 0.01, 2.3, 99.2, -21.2])
I'm trying to create a differentiable loss function that will minimize the number of values that are not 0. T...

Penguin
Votes: 0
Answers: 0
How to I create a tensor of euclidean distances from the maxval in an image array using TensorFlow?
I'm trying to write a custom loss function that inputs a batch of multichannel images and outputs a loss based on how well-clustered the pixel values are around the max value of each image on average....
CptKakashki
Votes: 0
Answers: 0
How to apply regularization only to one layer in pytorch?
Let's image a network with 2 layers (X1, X2). I want to use L1 Norm on X1 and then do (loss + L1).backward() on X1. X2 is still trained but without the regularization. My goal is to make X1 become spa...
enbo
Votes: 0
Answers: 1
Why does a penalty not change the predictions of a Keras model?
I recently came across this when trying to implement a custom loss function. The following two loss functions produce exactly the same results even though in the second one a large random value is add...
Tim
Votes: 0
Answers: 1