Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tensorboard中存在错误:TypeError:不支持的操作数类型为-:';str';和';int';_Python_Tensorflow_Tensorboard - Fatal编程技术网

Python Tensorboard中存在错误:TypeError:不支持的操作数类型为-:';str';和';int';

Python Tensorboard中存在错误:TypeError:不支持的操作数类型为-:';str';和';int';,python,tensorflow,tensorboard,Python,Tensorflow,Tensorboard,我正在尝试使用TensorBoard在模型训练期间创建洞察。通过它,我想检查我的模型是如何训练的,哪个epoch提供了最好的结果,等等。但是,我遇到了以下错误: TypeError Traceback (most recent call last) <ipython-input-33-e7c9b8bd2922> in <module> 18 model.fit([x_train['input1'],

我正在尝试使用TensorBoard在模型训练期间创建洞察。通过它,我想检查我的模型是如何训练的,哪个epoch提供了最好的结果,等等。但是,我遇到了以下错误:

TypeError                                 Traceback (most recent call last)
<ipython-input-33-e7c9b8bd2922> in <module>
     18 model.fit([x_train['input1'], x_train['input2']], y_train, batch_size = 32, epochs = 10, verbose = 0, 
---> 19           callbacks = [tf_board])
     20 
     21 

对于迟来的回答,很抱歉,你可能已经解决了你的问题,但我在这里发布给未来和我有同样问题的人

您只需将Tensorflow、TensorBoard(和TensorBoard插件配置文件)更新为版本
=2.2.0
,如中所述。Tensorboard回调在以前的版本中可能需要不同的参数。

尝试使用此
(5,10)
,而不是此
'5,10'
from tensorflow.keras.callbacks import TensorBoard
import datetime # optional

# Important!
%load_ext tensorboard
%reload_ext tensorboard

# Pass a directory to save logs
log_dir = '/home/pedro/MyDrive/Transfer_Learning/Models/logs'

# Let's create our callback
# TensorBoard(directory, histogram_freq, update_freq, 5) 
# -> str(range(profile_batch)) or str(profile_batch)
tf_board = TensorBoard(log_dir, histogram_freq=8, update_freq='batch', profile_batch='5, 10')

# And fit our callback inside our training data
model.fit([x_train['input1'], x_train['input2']], y_train, batch_size = 32, epochs = 10, verbose = 0, 
          callbacks = [tf_board])
                    
# Use this magic function to visualize
%tensorboard --logdir '/home/pedro/MyDrive/Transfer_Learning/Models/logs'