Open refraction-ray opened 1 year ago
flatten
on your structure before calling build()
?build()
, do you expect to also pass the same nested structure in stateless_apply(optimizer_variables, grads, trainable_variables)
? (as optimizer_variables
)@fchollet
The latter case is very common, when one use functional programming paradigm, as
model.variables
is a list of tensors (similar tob1
,b2
above), and there could be some other variables outside the model (similar tow
above) that the user also want to optimize together. A full pytree support inoptimizer.build
would be fantastic to use.