Implementations in tf.keras.backend have duplicates in pure tensorflow. For example: tf.keras.backend.ones vs tf.ones.
My question: Can I use tensorflow instead of tf.keras.backend, by just replacing it? Both are same API?
Implementations in tf.keras.backend have duplicates in pure tensorflow. For example: tf.keras.backend.ones vs tf.ones.
My question: Can I use tensorflow instead of tf.keras.backend, by just replacing it? Both are same API?
On
Most of the time, yes. To learn of the difference, do:
tf.ones? or tf.ones?? if your IDE supports it; this'll show docs + source code + file locationfrom inspect import getsource; print(getsource(tf.ones)) will show source codeI'd not replace K with tf, though; stuff gets moved around between versions, and functionality may break. Each has its own list of imports: tensorflow/__init__.py and tensorflow/python/keras/backend.py.
Yes, you can use tf but there might be minor difference in the results as both of them have different repo maintained.
For example the tf.keras.backend.binary_crossentropy and tf.keras.losses.binary_crossentropy have different code repo maintained but objective should remain the same.