Softmax Regression from Scratch

http://d2l.ai/chapter_linear-networks/softmax-regression-scratch.html

I have a question related to coding with tensorflow…
in the function train_epoch_ch3, the object updater has method “apply_gradients”
however, i found that this method is not defined in the Updater class…how can it be?
thank you…

I think that’s only the case when the updater is tf.keras.optimizers.Optimizer . In this chapter, we use a custom updater.

In train_epoch_ch3, what is net.trainable_variables referring to? The net function defined earlier in 3.6.3 does not have a trainable_variables field in it.

net.trainable_variables is for the case you use Keras network and would be used in section 3.7 . I agree that it is a bit confusing to write train_epoch_ch3 in a way to work with both sections 3.6 and 3.7

1 Like

Hi,

Are we to assume that, all the variables declared by (tf.Variables) are implicitly treated as trainable variables?

I posit this due to the inconsistency while declaring weights and biases variables between linear and softmax implementations?

The linear neural network implementation weights and biases are declared as such where as softmax ones aren’t