FADEAWAY114 2023-03-24 22:28 采纳率: 0%
浏览 10

强化学习算法运行过程中报错

当我在运行强化学习算法时,运行至1500回合左右,出现如下错误:
哪位可以帮忙看看,感谢

2023-03-24 22:01:09.380560: W tensorflow/core/framework/op_kernel.cc:1763] OP_REQUIRES failed at sparse_xent_op.cc:90 : Invalid argument: Received a label value of 3 which is outside the valid range of [0, 3).  Label values: 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Traceback (most recent call last):
  File "/home/vmware/桌面/SUMO-changing-lane-agent-master/test.py", line 10, in <module>
    agent.train(env)
  File "/home/vmware/桌面/SUMO-changing-lane-agent-master/a2c.py", line 136, in train
    losses = self.model.train_on_batch(observations, [acts_and_advs, returns])
  File "/home/vmware/anaconda3/envs/changelane2/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 1727, in train_on_batch
    logs = self.train_function(iterator)
  File "/home/vmware/anaconda3/envs/changelane2/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 828, in __call__
    result = self._call(*args, **kwds)
  File "/home/vmware/anaconda3/envs/changelane2/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 862, in _call
    results = self._stateful_fn(*args, **kwds)
  File "/home/vmware/anaconda3/envs/changelane2/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 2943, in __call__
    filtered_flat_args, captured_inputs=graph_function.captured_inputs)  # pylint: disable=protected-access
  File "/home/vmware/anaconda3/envs/changelane2/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 1919, in _call_flat
    ctx, args, cancellation_manager=cancellation_manager))
  File "/home/vmware/anaconda3/envs/changelane2/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 560, in call
    ctx=ctx)
  File "/home/vmware/anaconda3/envs/changelane2/lib/python3.7/site-packages/tensorflow/python/eager/execute.py", line 60, in quick_execute
    inputs, attrs, num_outputs)
tensorflow.python.framework.errors_impl.InvalidArgumentError:  Received a label value of 3 which is outside the valid range of [0, 3).  Label values: 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
     [[node logits_loss/sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits (defined at /桌面/SUMO-changing-lane-agent-master/a2c.py:199) ]] [Op:__inference_train_function_9631]

Function call stack:
train_function

  • 写回答

2条回答 默认 最新

  • IT_service_mesh 2023-03-24 22:41
    关注

    参考GPT和自己的思路:根据报错信息显示,这个强化学习算法在运行过程中出现了标签值超出正常范围的错误。具体而言,报错信息中显示接收到的标签值为3,而有效范围应该是[0,3)之间的值。

    这种错误通常是由于数据处理过程中的错误导致的。有可能是在数据处理的时候,标签值中出现了超出规定范围的值。建议检查数据处理过程中的代码,检查标签的数据是否有误。另外,还可以检查一下强化学习算法中softmax函数的实现,是否存在潜在的问题。如果问题仍然无法解决,可以将代码逐行调试,定位错误的位置,或者在相关的论坛或社区寻求更多的帮助。

    评论

报告相同问题?

问题事件

  • 创建了问题 3月24日

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀