[WordSeg] Clarify autodiff workaround for `Tensor.scalars`. (#518)
[WordSeg] Clarify autodiff workaround for `Tensor.scalars`. (#518)

`Tensor.scalarsADHack` exists as a workaround for TF-1008.
It is currently needed for correctness.

Reorganize code and optimize captured values in the `scalarsADHack` pullback.
No functional fixes in this commit.
tensorflow/swift-models,tensorflow/swift-models,tensorflow/swift-models,tensorflow/swift-models