xianggkl / 2023hitsz_cv

7 stars 1 forks source link

softmax issue #1

Open HenryZ5734 opened 1 year ago

HenryZ5734 commented 1 year ago

My implementation of softmax.backward is below: def backward(self, label): self.delta = self.softmax.copy()

start your code

    self.delta -= label
    ## end your code
    return self.delta / self.input_batch
xianggkl commented 1 year ago

Thank you for pointing out my problem. In order to treat a batch of data as one, the cross-entropy function needs to take the average of the batches of data, so it also needs to divide by batchsize when back-propagating.