tensorflow - Optimizing a subset of a tensor in Tensor Flow -
i have free varaible (tf.variable) x, , wish minimize error term respect subset of tensor x (for example minimizing error respect first row of 2d tensor).
one way compute gradients , change gradient 0 irrelevant parts of tensor , apply gradients. way?
you can use mask
, tf.stop_gradient
selectively make variable non-trainable: tf.stop_gradient(mask*x)
. value in matrix mask
1 should denote parts apply gradient , 0 otherwise.
Comments
Post a Comment