caffe2_cpp_tutorial
caffe2_cpp_tutorial copied to clipboard
the AddOptimizerOps create optimizer for blobs before stopgradient
I use AddOptimizerOps to create optimizer operators automatically. The optimizer operators are created even for blobs which are before the stopgradient operator. The stopgradient operator can surely prevent gradient calculation from being performed on blobs before it, but optimizers are still created for these blobs, so that caffe2 will complain about xxx_grad (which is not created because of stopgradient) is unknown.