홈>
Tensorflow로 CNN 방법을 훈련하려고 할 때 다음 오류가 발생했습니다.
Traceback (most recent call last):
File "./train.py", line 87, in
l2_reg_lambda=FLAGS.l2_reg_lambda)
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
어떻게 고칠 수 있습니까?
이것은 내 코드입니다 :
with tf.Graph().as_default():
session_conf = tf.ConfigProto(
allow_soft_placement=FLAGS.allow_soft_placement,
log_device_placement=FLAGS.log_device_placement)
sess = tf.Session(config=session_conf)
with sess.as_default():
cnn = TextCNN(
sequence_length=x_train.shape[1],
num_classes=2,
vocab_size=len(vocab_processor.vocabulary_),
embedding_size=FLAGS.embedding_dim,
filter_sizes=list(map(int, FLAGS.filter_sizes.split(","))),
num_filters=FLAGS.num_filters,
l2_reg_lambda=FLAGS.l2_reg_lambda) (line 87)
- 답변 # 1
관련 자료
- python - ipfs에 파일을 업로드하는 동안 오류가 발생했습니다 (typeerror - 예상 문자열 또는 바이트 유사 객체)
- python - jinja2exceptionstemplatesyntaxerror - 예상 토큰 ',', '문자열'및 typeerror : '함수'개체가 첨자 할 수 없음
- django - 보기의 typeerror - 필드에 숫자가 필요하지만 simplelazyobject가 있습니다
- python - typeerror - 'id'필드에 숫자가 필요하지만
- python - 'typeerror - 정수 인수가 필요합니다 float가 있습니다'
- python - 이 오류가 발생했습니다 "typeerror - int64가 필요합니다 대신 'float'유형의 1e-07을 가져 왔습니다" 어떻게해야합니까?
- python - tensorflow object detection api typeerror - 예상 바이너리 또는 유니 코드 문자열이 없습니다
- python - typeerror - processextract를 호출 할 때 ( '예상 문자열 또는 바이트와 유사한 객체', '인덱스 0에서 발생 함')
- python - typeerror - range () 정수 끝 인수가 필요합니다 int가 있습니다
- python 3.x - typeerror - 인수 'x'에 잘못된 유형이 있습니다 (예상 cupycorecorendarray, numpyndarray가 있음)
- python 2.7 - boto3 upload_file - typeerror : 예상되는 문자열 또는 버퍼
- javascript - typeerror - 예상되는 throat 크기는 숫자이지만 정의되지 않았습니다
- c# - 왜 'int32 배열 인덱스 예상'이라고 표시됩니까?
- python - typeerror - 순서 항목 0 : 예상 str 인스턴스, 목록을 인쇄하려고 할 때 int found가 발생했습니다
- python - typeerror - 예상되는 str, bytes 또는 ospathlike 객체, 설정되지 않음 :scrapy 오류
- python - xgbregressorfit ()에서 typeerror - 예상되는 시퀀스 또는 배열과 유사한
관련 질문
- python : tar: flower_photos.tgz의 압축을 풀려고 할 때 인식할 수 없는 아카이브 형식 오류, OSX의 TF 자습서
- python : 경고:tensorflow:입력에 데이터가 부족합니다. 훈련 방해
- python : 다중 입력 및 출력이 있는 Tensorflow lite 모델에 대한 추론을 수행하는 방법은 무엇입니까?
- python : BiLSTM forwad() -RuntimeError: '[-1, 38]' 모양이 크기 1의 입력에 유효하지 않습니다.
- python : TensorFlow/Keras로 임의의 기능을 최적화하는 방법은 무엇입니까?
- python : tensorflow, keras 및 순환 가져오기 오류
- python : cdist 또는 tensorflow를 사용하여 가장 가까운 점 비교 속도를 높이려면 어떻게 해야 합니까?
- python : Tensorflow: 알 수 없는 크기의 텐서를 주어진 크기의 청크로 분할
- python : ValueError: "sequential" 레이어의 입력 0이 레이어와 호환되지 않습니다: 예상된 모양=(없음, 128, 128, 3), 발견된 모양=(32, 128, 3)
- python : dict와 같은 목록에서 이미지 추출
x_train.shape[1]
Tensor
를 반환sess.run()
까지는 값이 계산되지 않습니다. 이므로 shape [1] 대신 int32 값을 전달해야합니다.