tensorflow deep reinforcement learning ddpg program error solving

dq89163756 注册会员
2023-02-26 17:05

the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > in your code, the error message indicates that used the attribute named monitor, but it does not exist in the CartPoleEnv object.

This usually means that you refer to a non-existent property name in your code. In this case, you need to check the definition of the CartPoleEnv class used in your code and make sure it includes an attribute named monitor.

If you're not sure how to handle this, search for all monitor references in your code and check that these references are correct. If you have multiple modules, try modifying one of them first.

cxandcf 注册会员
2023-02-26 17:05

Part of the answer refers to GPT, GPT_Pro better addresses the problem
AttributeError 'CartPoleEnv' object has no attribute monitor, which is due to an error caused by not defining the monitor attribute in the CartPoleEnv class.

Solution: 1. Confirm whether the monitor attribute is defined in the code. If not, you need to define the monitor attribute and assign a value.
2. It is also possible that some variable or function names in the code are incorrectly named and duplicate the attribute names in CartPoleEnv. In this case, you can change the variable or function names.

class CartPoleEnv:
    # 其他代码

    def __init__(self):
        # 其他代码
        self.monitor = False # 定义monitor属性并赋值

If the answer is helpful, please accept it.