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

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

https://better-coding.com/solved-attributeerror-module-tensorflow-has-no-attribute-placeholder/

 

[SOLVED] - AttributeError: module 'tensorflow' has no attribute 'placeholder'

The cause of the mentioned problem is incompatibile code with installed tensorflow library. In this case you have code compatible with tensorflow 1.0 version but installed tensorflow 2.0 or higher. Let's see what you can do to solve the problem.

better-coding.com

 

import tensorflow.compat.v1 as tf
x = tf.placeholder(shape=[None, 2], dtype=tf.float32)

 

tensorflow의 placeholder함수를 사용하다보면 아래와 같은 오류가 발생한다. 

 

 

이 문구를 추가해주면 해결이 된다. 

 

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
x = tf.placeholder(shape=[None, 2], dtype=tf.float32)
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 'global_variables_initializer'  (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 'global_variables_initializer'
  • [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)
  • 블로그 메뉴

    • 홈
    • 방명록
  • 링크

  • 공지사항

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

  • 태그

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

  • 최근 글

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

티스토리툴바