Git Product home page Git Product logo

Comments (6)

vbapst avatar vbapst commented on May 22, 2024

Hi Farshid,

can you provide a more complete stack trace ? Thanks.

from graph_nets.

FarshidShekari avatar FarshidShekari commented on May 22, 2024

Hi @vbapst
This is my stack trace:
Traceback (most recent call last):

  File "C:/Users/Farshid/PycharmProjects/clique/Main2.py", line 112, in <module>
    output_ops_tr = model(input_ph, num_processing_steps_tr)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 389, in __call__
    outputs, subgraph_name_scope = self._template(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 360, in __call__
    return self._call_func(args, kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 311, in _call_func
    result = self._func(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 246, in _build_wrapper
    output = self._build(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\demos\models.py", line 122, in _build
    latent = self._encoder(input_op)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 389, in __call__
    outputs, subgraph_name_scope = self._template(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 360, in __call__
    return self._call_func(args, kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 311, in _call_func
    result = self._func(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 246, in _build_wrapper
    output = self._build(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\demos\models.py", line 56, in _build
    return self._network(inputs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 389, in __call__
    outputs, subgraph_name_scope = self._template(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 360, in __call__
    return self._call_func(args, kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 311, in _call_func
    result = self._func(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 246, in _build_wrapper
    output = self._build(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\modules.py", line 366, in _build
    edges=self._edge_model(graph.edges),
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 389, in __call__
    outputs, subgraph_name_scope = self._template(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 360, in __call__
    return self._call_func(args, kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 311, in _call_func
    result = self._func(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 246, in _build_wrapper
    output = self._build(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 715, in _build
    return self._build_function(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\modules.py", line 342, in <lambda>
    lambda x: edge_model_fn()(x), name="edge_model")  # pylint: disable=unnecessary-lambda
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 389, in __call__
    outputs, subgraph_name_scope = self._template(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 360, in __call__
    return self._call_func(args, kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 311, in _call_func
    result = self._func(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 246, in _build_wrapper
    output = self._build(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\sequential.py", line 103, in _build
    net = layer(*net)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 389, in __call__
    outputs, subgraph_name_scope = self._template(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 360, in __call__
    return self._call_func(args, kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 311, in _call_func
    result = self._func(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 246, in _build_wrapper
    output = self._build(*args, **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\nets\mlp.py", line 143, in _build
    self._input_shape = tuple(inputs.get_shape().as_list())
AttributeError: 'NoneType' object has no attribute 'get_shape'

originally defined at:
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\demos\models.py", line 39, in make_mlp_model
    snt.nets.MLP([LATENT_SIZE] * NUM_LAYERS, activate_final=True),
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\nets\mlp.py", line 81, in __init__
    super(MLP, self).__init__(custom_getter=custom_getter, name=name)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 215, in __init__
    custom_getter_=self._custom_getter)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 154, in make_template
    **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 224, in make_template_internal
    create_graph_function=create_graph_function_)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 281, in __init__
    self._stacktrace = traceback.format_stack()[:-2]


originally defined at:
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\demos\models.py", line 40, in make_mlp_model
    snt.LayerNorm()
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\sequential.py", line 65, in __init__
    super(Sequential, self).__init__(name=name)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 215, in __init__
    custom_getter_=self._custom_getter)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 154, in make_template
    **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 224, in make_template_internal
    create_graph_function=create_graph_function_)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 281, in __init__
    self._stacktrace = traceback.format_stack()[:-2]


originally defined at:
  File "C:/Users/Farshid/PycharmProjects/clique/Main2.py", line 110, in <module>
    model = models.EncodeProcessDecode(edge_output_size=2, node_output_size=2)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\demos\models.py", line 101, in __init__
    self._encoder = MLPGraphIndependent()
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\demos\models.py", line 53, in __init__
    global_model_fn=make_mlp_model)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\modules.py", line 342, in __init__
    lambda x: edge_model_fn()(x), name="edge_model")  # pylint: disable=unnecessary-lambda
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 710, in __init__
    super(Module, self).__init__(custom_getter=custom_getter, name=name)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 215, in __init__
    custom_getter_=self._custom_getter)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 154, in make_template
    **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 224, in make_template_internal
    create_graph_function=create_graph_function_)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 281, in __init__
    self._stacktrace = traceback.format_stack()[:-2]


originally defined at:
  File "C:/Users/Farshid/PycharmProjects/clique/Main2.py", line 110, in <module>
    model = models.EncodeProcessDecode(edge_output_size=2, node_output_size=2)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\demos\models.py", line 101, in __init__
    self._encoder = MLPGraphIndependent()
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\demos\models.py", line 53, in __init__
    global_model_fn=make_mlp_model)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\modules.py", line 332, in __init__
    super(GraphIndependent, self).__init__(name=name)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 215, in __init__
    custom_getter_=self._custom_getter)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 154, in make_template
    **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 224, in make_template_internal
    create_graph_function=create_graph_function_)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 281, in __init__
    self._stacktrace = traceback.format_stack()[:-2]


originally defined at:
  File "C:/Users/Farshid/PycharmProjects/clique/Main2.py", line 110, in <module>
    model = models.EncodeProcessDecode(edge_output_size=2, node_output_size=2)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\demos\models.py", line 101, in __init__
    self._encoder = MLPGraphIndependent()
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\demos\models.py", line 48, in __init__
    super(MLPGraphIndependent, self).__init__(name=name)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 215, in __init__
    custom_getter_=self._custom_getter)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 154, in make_template
    **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 224, in make_template_internal
    create_graph_function=create_graph_function_)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 281, in __init__
    self._stacktrace = traceback.format_stack()[:-2]


originally defined at:
  File "C:/Users/Farshid/PycharmProjects/clique/Main2.py", line 110, in <module>
    model = models.EncodeProcessDecode(edge_output_size=2, node_output_size=2)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\demos\models.py", line 100, in __init__
    super(EncodeProcessDecode, self).__init__(name=name)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\sonnet\python\modules\base.py", line 215, in __init__
    custom_getter_=self._custom_getter)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 154, in make_template
    **kwargs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 224, in make_template_internal
    create_graph_function=create_graph_function_)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\template.py", line 281, in __init__
    self._stacktrace = traceback.format_stack()[:-2]

from graph_nets.

vbapst avatar vbapst commented on May 22, 2024

Hi Farshid,

you cannot use a GraphIndependent module if your input graph has not node states. Either provide dummy features, or do the initial encoding of your graph yourself.

from graph_nets.

FarshidShekari avatar FarshidShekari commented on May 22, 2024

thank you.

from graph_nets.

alvarosg avatar alvarosg commented on May 22, 2024

Alternatively it should be possible to just specify node_model_fn=None, and then the None nodes will be passed directly to the output the GraphIndependent as None.

You will then find a similar problem when you feed the output of GraphIndependent to as input to the next GraphNetwork, and you would have to set to False, the corresponding use_*_nodes parameters via edge_block_opt, node_block_opt, global_block_opt.

In practice, it is much more convenient to just put dummy zero node features in your input GraphsTuple. You can do is as easily as:
graph_with_dummy_nodes = utils_tf.set_zero_node_features(input_graph, node_size=1)

from graph_nets.

FarshidShekari avatar FarshidShekari commented on May 22, 2024

@vbapst I used dummy features but I get below error. In my problem, the input graph has no feature (edges and nodes) but the output graph nodes and edges have one feature:

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\pydevd.py", line 1664, in <module>
    main()
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\pydevd.py", line 1658, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\pydevd.py", line 1068, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/Farshid/PycharmProjects/clique/Main2.py", line 171, in <module>
    theta, input_ph, target_ph)
  File "C:\Users\Farshid\PycharmProjects\clique\Helper2.py", line 302, in create_feed_dict
    input_graphs = utils_np.networkxs_to_graphs_tuple(inputs)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\utils_np.py", line 343, in networkxs_to_graphs_tuple
    return data_dicts_to_graphs_tuple(data_dicts)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\utils_np.py", line 381, in data_dicts_to_graphs_tuple
    _check_valid_sets_of_keys(data_dicts)
  File "C:\Users\Farshid\AppData\Local\Programs\Python\Python35\lib\site-packages\graph_nets\utils_np.py", line 85, in _check_valid_sets_of_keys
    "({} vs {})".format(prev_keys, current_keys))
ValueError: Different set of keys found when iterating over data dictionaries ({'edges', 'nodes', 'n_edge', 'receivers', 'globals', 'n_node', 'senders'} vs {'nodes', 'n_edge', 'receivers', 'globals', 'n_node', 'senders'})

from graph_nets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.