Simplynotusing tf.function() can make your code significantly slower than it needs to be when e.g. the model objective gets called many times throughout the hyperparameter optimization. I think itmightmake a difference if you convert the data to tf.Tensor objects first: can you try the fol...