I have a TF Dataset with the following schema:
tf_features = {'searched_destination_id': tf.io.FixedLenFeature([], tf.int64, default_value=0),'booked_acc_id': tf.io.FixedLenFeature([], dtype=tf.int64, default_value=0),'user_id': tf.io.FixedLenFeature([], dtype=tf.int64, default_value=0),;}
I also have a dict like:
candidates = {'111': [123, 444, ...], '222': [555, 888, ...]...}
I'd like to perform a map operation in the following way:
ds.map(lambda x, y: {**x, 'candidates': candidates[x['searched_destination_ufi'].numpy()]})
However I always get: AttributeError: 'Tensor' object has no attribute 'numpy'
when I remove the .numpy()
I get TypeError: Tensor is unhashable. Instead, use tensor.ref() as the key.
Do you suggest any solution?