tutorials.examples.train_graph_triangle ======================================= .. py:module:: tutorials.examples.train_graph_triangle .. autoapi-nested-parse:: Minimal training example for a graph-building environment with node addition. This script demonstrates training a GFlowNet on a generic graph-building task where the policy can ADD_NODE, ADD_EDGE, or EXIT. The reward here encourages forming an undirected triangle (3 nodes, 3 edges). Run: python tutorials/examples/train_graph_build_nodes.py --device cpu --plot Attributes ---------- .. autoapisummary:: tutorials.examples.train_graph_triangle.parser Classes ------- .. autoapisummary:: tutorials.examples.train_graph_triangle.TriangleReward Functions --------- .. autoapisummary:: tutorials.examples.train_graph_triangle.init_env tutorials.examples.train_graph_triangle.init_gflownet tutorials.examples.train_graph_triangle.main tutorials.examples.train_graph_triangle.render_states Module Contents --------------- .. py:class:: TriangleReward(reward_val = 100.0, eps_val = 1e-06, device = 'cpu') Reward high if the graph is an undirected triangle, else a small epsilon. - Undirected triangle: exactly 3 nodes and edges {(0,1),(1,2),(0,2)} ignoring labels. .. py:method:: __call__(states) .. py:attribute:: device .. py:attribute:: eps_val :value: 1e-06 .. py:attribute:: reward_val :value: 100.0 .. py:function:: init_env(device) .. py:function:: init_gflownet(env, embedding_dim, num_conv_layers, device) .. py:function:: main(args) .. py:data:: parser .. py:function:: render_states(states, evaluator)