[Tensorflow 오류] AttributeError: module 'tensorflow' has no attribute 'global_variables_initializer'

2020. 7. 15. 03:49·🖥️ 컴퓨터공학 🖥️/코드 에러 모음집
반응형

https://vispud.blogspot.com/2019/05/tensorflow200a0-attributeerror-module.html

 

Tensorflow==2.0.0a0 - AttributeError: module 'tensorflow' has no attribute 'global_variables_initializer'

Download template bootstrap for free !

vispud.blogspot.com

 

 

import tensorflow as tf
model=tf.global_variables_initializer()

 

이렇게 명령문을 작성하였더니 

 

 

이런 오류가 발생하였다.

 

해결방법은

 

import tensorflow as tf
model=tf.compat.v1.global_variables_initializer()

 

이런 식으로 작성하여 주면 된다. 

 

텐서플로우 라이브러리의 compat 라이브러리를 직접 참조를 해주면 된다.

 

728x90
반응형

'🖥️ 컴퓨터공학 🖥️ > 코드 에러 모음집' 카테고리의 다른 글

[ Colab 오류] Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info. This isn't available when running in Eager mode.  (0) 2021.09.29
[ jupyter 노트북 ] bad config encountered during initialization : no such notebook dir :  (0) 2021.02.20
[Tensorflow 오류] no module named 'tensorflow' 주피터 노트북  (0) 2020.12.17
[Tensorflow 오류] AttributeError: module 'tensorflow' has no attribute 'placeholder'  (0) 2020.07.15
[conda 오류] RemoveError: 'setuptools' is a dependency of conda and cannot be removed fromconda's operating environment.  (0) 2020.07.11
'🖥️ 컴퓨터공학 🖥️/코드 에러 모음집' 카테고리의 다른 글
  • [ jupyter 노트북 ] bad config encountered during initialization : no such notebook dir :
  • [Tensorflow 오류] no module named 'tensorflow' 주피터 노트북
  • [Tensorflow 오류] AttributeError: module 'tensorflow' has no attribute 'placeholder'
  • [conda 오류] RemoveError: 'setuptools' is a dependency of conda and cannot be removed fromconda's operating environment.
공대생 배기웅
공대생 배기웅
군노답 미필 공대생 배기웅의 대학생활을 갈아 넣은 블로그
    반응형
  • 공대생 배기웅
    글쓰는공대생의 IT블로그
    공대생 배기웅
  • 전체
    오늘
    어제
    • 분류 전체보기 (166)
      • 🖊️ 공대생 글쓰기 🖊️ (17)
        • 공대생 회고록 (4)
        • 공대생의 끄적끄적 (4)
        • 슬기로운 공대생활 (9)
        • 무한도전 대학원생 (0)
      • 📈 산업공학 📈 (14)
        • 금융, 파생상품 (13)
        • 통계 (0)
        • 선형대수 (0)
        • 보험, 리스크관리 (0)
        • 재무회계 (1)
      • 🖥️ 컴퓨터공학 🖥️ (92)
        • 머신러닝, 딥러닝 (12)
        • 텐서플로우, 케라스 (1)
        • 알고리즘 (24)
        • 웹 (5)
        • Python (3)
        • C | C++ (23)
        • Java (15)
        • 코드 에러 모음집 (9)
      • 😙 취미, 교양 😙 (2)
        • 영어공부 (1)
        • 일본어회화 공부 (1)
      • 🔍 정보 공유 🔍 (38)
        • 대학생 외부활동 정보 (2)
        • 개발자관련 정보 (3)
        • 대입 논술 입시자료 정보 (22)
        • 프로그램 세팅 (11)
  • 블로그 메뉴

    • 홈
    • 방명록
  • 링크

  • 공지사항

    • [공지] 글쓰는 공대생입니다 😃
  • 인기 글

  • 태그

    알고리즘
    Operator
    무작위 변수
    C++
    이클립스
    경제성공학
    재귀함수
    조작자
    객체지향
    데이터베이스
    자바
    프랜드함수
    백준
    equals프레임워크
    예외
    OOP
    acmicpc
    프로그래머스
    스캐너
    Java
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
공대생 배기웅
[Tensorflow 오류] AttributeError: module 'tensorflow' has no attribute 'global_variables_initializer'
상단으로

티스토리툴바