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

tensorflow.python.framework.errors_impl.InvalidArgumentError #497

Open
Pari-singh opened this issue Jun 27, 2019 · 1 comment
Open

tensorflow.python.framework.errors_impl.InvalidArgumentError #497

Pari-singh opened this issue Jun 27, 2019 · 1 comment

Comments

@Pari-singh
Copy link

Replicating the code, getting error:

tensorflow.python.framework.errors_impl.InvalidArgumentError: TensorArray replica_0/model_3/yolo_loss/TensorArray_3: Could not read from TensorArray index 0. Furthermore, the element shape is not fully defined: [?,?,3]. It is possible you are working with a resizeable TensorArray and stop_gradients is not allowing the gradients to be written. If you set the full element_shape property on the forward TensorArray, the proper all-zeros tensor will be returned instead of incurring this error.
[[{{node replica_0/model_3/yolo_loss/TensorArrayStack/TensorArrayGatherV3}}]]
[[{{node replica_1/model_3/yolo_loss/add_17}}]]

Could someone provide an insight, how could I treat this bug? I tried almost everything available on net. Any help is welcomed

@Pari-singh
Copy link
Author

Pari-singh commented Jun 28, 2019

@qqwweee @dleam

Could someone tell/verify the element_shape value in yolo_loss function code:

    ignore_mask = tf.TensorArray(K.dtype(y_true[0]), size=1, dynamic_size=True, infer_shape=False, clear_after_read=False, **element_shape=[batch_size, input_shape]**)
    object_mask_bool = K.cast(object_mask, 'bool')
    def loop_body(b, ignore_mask):
        true_box = tf.boolean_mask(y_true[l][b,...,0:4], object_mask_bool[b,...,0])
        iou = box_iou(pred_box[b], true_box)
        best_iou = K.max(iou, axis=-1)
        ignore_mask = ignore_mask.write(b, K.cast(best_iou<ignore_thresh, K.dtype(true_box)))
        return b+1, ignore_mask
    _, ignore_mask = K.control_flow_ops.while_loop(lambda b,*args: b<m, loop_body, [0, ignore_mask])
    ignore_mask = ignore_mask.stack()
    ignore_mask = K.expand_dims(ignore_mask, -1)

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