Difference between model(x) and model.predict(x) in tensorflow
Keras with tensorflow backend was using underlying tensorflow objects, but mostly was providing high level outputs which could be understood outside the tensorflow environment (as an example it could output numpy arrays or python lists).
Today given a model in tensorflow 2.0 (built using the keras library),
out_np = model.predict(x)
provides a numpy array which can, as an example, be printed with
On the other hand,
out_tf = model(x)
results into a tensorflow object, wich can be converted to a numpy array with
The two results are equivalent, as an example, we have that the following is True,
out_np.max() == out_tf.numpy().max()
The format may be different, but the meaning of
model.predict(x) is the same:
given an input x, it is the value of the output nodes of a network characterized by its structure, weights and biases.