'Find contents inside a tensor if iteration is not allowed

I have been trying to expand a tensor of x and y coordinates in a point cloud to see it's contents, but all I can get is the shape of the tensor and its type.

(Something like this :

x_interior_1 = domain_invar['Interior1']['x']
print(x_interior_1)
y_interior_1 = domain_invar['Interior1']['y'] 
print(y_interior_1)

Result:

Tensor("x_2:0", shape=(10000, 1), dtype=float32)
Tensor("y_2:0", shape=(10000, 1), dtype=float32)

)

When I run an iterator over it, I'm greeted with iteration not allowed.

tensorflow.python.framework.errors_impl.OperatorNotAllowedInGraphError: iterating over `tf.Tensor` is not allowed in Graph execution. 
Use Eager execution or decorate this function with @tf.function.

So I do it. I put the decorator above the def. But then, I'm greeted with this:

  @tf.function
  def custom_loss(self, domain_invar, pred_domain_outvar, true_domain_outvar, step):
    # get points on interior of rec
    x_interior_1 = domain_invar['Interior1']['x']
    print([x for x in x_interior_1])
    y_interior_1 = domain_invar['Interior1']['y']
    print([y for y in y_interior_1])
    area_interior_1 = domain_invar['Interior1']['area']
    x_interior_2 = domain_invar['Interior2']['x']
    y_interior_2 = domain_invar['Interior2']['y']
    area_interior_2 = domain_invar['Interior2']['area']

Result:

    return _pywrap_tensorflow_internal.Flatten(nested, expand_composites)
    TypeError: '<' not supported between instances of 'Key' and 'Key'

What does one do to see what's inside??



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source