如何以及何时使用 ray.method(num_return_values)?

How and when is ray.method(num_return_values) used?

ray 教程解释说,对于一个对象有一个方法,returns 多个 object_ids 可以使用 @ray.method() 装饰器 see here. But in the example 'Learning to play Pong' the method compute gradient actually has two return values, which are called as object_ids later, but it is not coded as ray.method with the respective decoratorsee here。我想了解 ray.method 现在的用途。

获取对象时会return一个元组

Python 中的等效范式是:

def test():
    return 1, 2

a = test()
assert a == (1, 2)