Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TF 1.13 says: "The two structures don't have the same nested structure." #40

Open
lazydroid opened this issue Jan 29, 2019 · 0 comments

Comments

@lazydroid
Copy link

lazydroid commented Jan 29, 2019

Inference works perfectly with the pre-trained model.

However, when I try to train, I get the following error. Looks like things have changed from TF1.4 to TF 1.13 and I'd be glad if you tell how to fix this?

Traceback (most recent call last):
  File "./main.py", line 118, in <module>
    trainOp=createUpdateOp()
  File "./main.py", line 105, in createUpdateOp
    grads = optimizer.compute_gradients(totalLoss, var_list=net.getVariables())
  File "/home/lenik/tfenv/local/lib/python2.7/site-packages/tensorflow/python/training/optimizer.py", line 512, in compute_gradients
    colocate_gradients_with_ops=colocate_gradients_with_ops)
  File "/home/lenik/tfenv/local/lib/python2.7/site-packages/tensorflow/python/ops/gradients_impl.py", line 664, in gradients
    unconnected_gradients)
  File "/home/lenik/tfenv/local/lib/python2.7/site-packages/tensorflow/python/ops/gradients_impl.py", line 965, in _GradientsHelper
    lambda: grad_fn(op, *out_grads))
  File "/home/lenik/tfenv/local/lib/python2.7/site-packages/tensorflow/python/ops/gradients_impl.py", line 420, in _MaybeCompile
    return grad_fn()  # Exit early
  File "/home/lenik/tfenv/local/lib/python2.7/site-packages/tensorflow/python/ops/gradients_impl.py", line 965, in <lambda>
    lambda: grad_fn(op, *out_grads))
  File "/home/lenik/tfenv/local/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_grad.py", line 84, in _SwitchGrad
    return merge(grad, name="cond_grad")[0], None
  File "/home/lenik/tfenv/local/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 406, in merge
    nest.assert_same_structure(inputs[0], v, expand_composites=True)
  File "/home/lenik/tfenv/local/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 249, in assert_same_structure
    % (str(e), str1, str2))
ValueError: The two structures don't have the same nested structure.

First structure: type=IndexedSlices str=IndexedSlices(indices=Tensor("optimizer/gradients/RPNloss/cond/calcRPNLoss/calcAllRPNLosses/cond_1/getNegativeLosses/GatherNd/Switch_grad/cond_grad/range:0", shape=(?,), dtype=int32), values=Tensor("optimizer/gradients/zeros_5:0", shape=(?,), dtype=float32), dense_shape=Tensor("optimizer/gradients/RPNloss/cond/calcRPNLoss/calcAllRPNLosses/cond_1/getNegativeLosses/GatherNd/Switch_grad/cond_grad/Shape:0", shape=(1,), dtype=int32))

Second structure: type=IndexedSlices str=IndexedSlices(indices=Tensor("optimizer/gradients/RPNloss/cond/calcRPNLoss/calcAllRPNLosses/cond_1/getNegativeLosses/GatherNd_grad/Squeeze:0", shape=(?,), dtype=int32), values=IndexedSlices(indices=Tensor("optimizer/gradients/RPNloss/cond/calcRPNLoss/calcAllRPNLosses/cond_1/Merge_grad/cond_grad/Switch_1:1", shape=(?,), dtype=int32), values=Tensor("optimizer/gradients/RPNloss/cond/calcRPNLoss/calcAllRPNLosses/cond_1/Merge_grad/tuple/control_dependency_1:0", shape=(?,), dtype=float32), dense_shape=Tensor("optimizer/gradients/RPNloss/cond/calcRPNLoss/calcAllRPNLosses/cond_1/Merge_grad/cond_grad/Switch_2:1", shape=(1,), dtype=int32)), dense_shape=Tensor("optimizer/gradients/RPNloss/cond/calcRPNLoss/calcAllRPNLosses/cond_1/getNegativeLosses/GatherNd_grad/Shape:0", shape=(1,), dtype=int32))

@lazydroid lazydroid changed the title TF 1.13, 1.14 says: "The two structures don't have the same nested structure." TF 1.13 says: "The two structures don't have the same nested structure." Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant