0

System Info :

  • keras 2.3.1
  • pip 20.2.2
  • python 3.6.10
  • tensorflow 2.3.0

I am working on a siamese algorithm on keras tensorflow backend. I have imported keras backend as follow and it shows above attribute error. What could be the reason for that and how to avoid this issue?

import tensorflow.python.keras.backend as K

AttributeError: module 'tensorflow' has no attribute 'python'

Lakwin Chandula
  • 159
  • 1
  • 3
  • 15
  • Does this answer your question? [AttributeError: module 'tensorflow' has no attribute 'python'](https://stackoverflow.com/questions/47304999/attributeerror-module-tensorflow-has-no-attribute-python) – Qiu Aug 19 '20 at 06:51
  • from tensorflow.keras import backend as k . can you try it with this – Gautamrk Aug 19 '20 at 06:55
  • yes i have already tried from tensorflow.keras import backend as k. but it did not worked @gautamrk – Lakwin Chandula Aug 19 '20 at 07:47

1 Answers1

3

It means that within the module 'tensorflow', no attribute named 'python' exists. You don't really need to import python as a module I believe. Try this:

import tensorflow.keras.backend as K
Pieter-Jan
  • 492
  • 4
  • 15