F
F
fetch_girl2020-01-18 13:59:07
Python
fetch_girl, 2020-01-18 13:59:07

How to fix AttributeError: module 'tensorflow' has no attribute 'name_scope'?

I'm trying to run a program that literally 10 minutes ago worked without problems, but now it gives an error about the absence of the 'name_scope' attribute. During this time I did not install any new modules, did not change anything in them.

import csv
import numpy as np
import tensorflow as tf
from keras.models import Sequential
from keras.layers import Dense, Flatten, Activation
from keras.layers import Dropout
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from tensorflow.keras import utils

train_imgs=[]
a=[]
b=[]
with open('train.csv', 'r') as csv_file:
    csv_reader=csv.reader(csv_file)
    next(csv_reader)
    for line in csv_reader:
        for i in line[0]:
            i=int(i)
            a.append(i)        
train_labels=utils.to_categorical(a, 10)
class_names = ["Злость", "Отвращение", "Страх", "Радость", "Грусть", "Удивление", "Нейтральная эмоция" ]

An error comes out:
AttributeError: module 'tensorflow' has no attribute 'name_scope'

I did NOT use the tf module nor its given attribute. When I removed the import of modules from keras, the error disappeared, but I need them for further work, so the question is not settled.
What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Yakushenko, 2020-01-18
@fetch_girl

In any incomprehensible situation - reinstall:

spoiler
помогло?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question