简体   繁体   English

python代码中的tensorflow.python.framework.errors_impl.InvalidArgumentError

[英]tensorflow.python.framework.errors_impl.InvalidArgumentError in python code

I was trying to add tensorboard to a sentdex tutorial , and got the error tensorflow.python.framework.errors_impl.InvalidArgumentError. 我试图将tensorboard添加到sentdex教程 ,并得到错误tensorflow.python.framework.errors_impl.InvalidArgumentError。 I'm rather new to tensorflow so I don't know what's wrong. 我对张力流很新,所以我不知道出了什么问题。

import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, LSTM
from tensorflow.keras.callbacks import TensorBoard
import time

NAME = f"MNIST-{time.time}"

mnist = tf.keras.datasets.mnist

tensorboard = TensorBoard(log_dir='logs/{}'.format(NAME))

(x_train, y_train), (x_test, y_test) = mnist.load_data()

x_train = x_train/255
x_test = x_test/255

model = Sequential()

model.add(LSTM(128, input_shape=(x_train.shape[1:]), activation='relu', return_sequences=True))
model.add(Dropout(0.2))

model.add(LSTM(128, activation='relu'))
model.add(Dropout(0.2))

model.add(Dense(32, activation='relu'))
model.add(Dropout(0.2))

model.add(Dense(10, activation='softmax'))

opt = tf.keras.optimizers.Adam(lr=1e-3, decay=1e-5)

model.compile(loss='sparse_categorical_crossentropy', optimizer=opt, metrics=['accuracy'])

tensorboard = TensorBoard(log_dir=f'logs/{NAME}')
model.fit(x_train, y_train, epochs=2, validation_data=(x_test, y_test), callbacks = [tensorboard])

model.save('MNIST')

问题是time.time代码没有()。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 tensorflow.python.framework.errors_impl.InvalidArgumentError:断言失败: - tensorflow.python.framework.errors_impl.InvalidArgumentError: assertion failed: tensorflow.python.framework.errors_impl.InvalidArgumentError:收到的 label 值 357436800 超出有效范围 - tensorflow.python.framework.errors_impl.InvalidArgumentError: Received a label value of 357436800 which is outside the valid range of [0, 2) 如何解决关于SelfAdjointEigV2的罕见tensorflow.python.framework.errors_impl.InvalidArgumentError - How to solve a rare tensorflow.python.framework.errors_impl.InvalidArgumentError about SelfAdjointEigV2 在tensorflow中提供占位符回溯:'tensorflow.python.framework.errors_impl.InvalidArgumentError:您必须提供占位符张量的值 - feed placeholder traceback in tensorflow: 'tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor Tensorflow.python.framework.errors_impl.NotFoundError - Tensorflow.python.framework.errors_impl.NotFoundError TensorFlow - tensorflow.python.framework.errors_impl.FailedPreconditionError - TensorFlow - tensorflow.python.framework.errors_impl.FailedPreconditionError tensorflow.python.framework.errors_impl.NotFoundError: 无法创建 NewWriteableFile: - tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a NewWriteableFile: tensorflow.python.framework.errors_impl.NotFoundError添加$符号 - tensorflow.python.framework.errors_impl.NotFoundError adds $ sign Tensorflow 错误 - tensorflow.python.framework.errors_impl.NotFoundError - 在运行命令 rasa init --no-prompt - Tensorflow error - tensorflow.python.framework.errors_impl.NotFoundError - on running command rasa init --no-prompt TensorFlow跟踪(最近一次调用是最近一次):tensorflow.python.framework.errors_impl.PermissionDeniedError:/ tmpp错误 - TensorFlow Traceback (most recent call last): tensorflow.python.framework.errors_impl.PermissionDeniedError: /tmpp error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM