这是indexloc提供的服务,不要输入任何密码
Skip to content

What is the old version of numpy and networkx so the nx.Graph() can be saved as obs #362

@yangysc

Description

@yangysc
  • I have marked all applicable categories:
    • exception-raising bug
    • RL algorithm bug
    • documentation request (i.e. "X is missing from the documentation.")
    • new feature request
  • I have visited the source website
  • I have searched through the issue tracker for duplicates
  • I have mentioned version numbers, operating system and environment, where applicable:
    import tianshou, torch, numpy, sys
    print(tianshou.__version__, torch.__version__, numpy.__version__, sys.version, sys.platform)
    0.4.1 1.8.1+cpu 1.20.2 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] win32

Hi, @Trinkle23897
From the usage here, it seems the nx.Graph() cannot be used as before. May I ask that, how canI still use this feature, since directly saving the graph object is more efficient, instead of the edge_list array.

Maybe in the future, tianshou can support the dgl.graph object. It stores the tensor internally.

Thanks!

这个例子可能现在不太能work,因为numpy升级了,以及nx.Graph重写了__getitem__,导致np.array([nx.Graph()])会出来空的> 数组……
不过正常的自定义class应该没啥问题
import networkx as nx
b = ReplayBuffer(size=3)
b.add(obs=nx.Graph(), act=0, rew=0, done=0)
print(b)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions