Closed ferreirafabio closed 5 years ago
This seems not to be failing in GraphIndependent
, but in the EdgeBlock
used within a GraphNetwork
, for which some of the models are outputting 2d tensors, and some others 3d tensors.
The easiest way to have everything be 2d tensors is to wrap your 1d convnet module and use a tf.expand_dims
just before, and a tf.squeeze
just after (alternatively you could also to reshapes if you want to work with more than one channel).
Appreciate it!
In order to process my node features of shape [batch_size, feature_length] with 1D convolutions, I want to use as the
node_model_fn
in theMLPGraphIndependent
(encoder part) a functionmake_cnn_model()
, replacing the previously used functionmake_mlp_model()
from the examples. Because 1D convs typically operate over a depth channel, I added an additional channel dimension to the node features, yielding the shape [?, feature_length, 1].In the sonnet library there does exist a
ConvNet2D
class but unfortunately no implementation forConvNet1D
is available. I have tried to build my own ConvNet1D module withsnt.Sequential
and a stack of multiplesnt.python.modules.conv.Conv1D
but failed with the following error:I assume I must reduce the initially expanded dimension again but can't infer the correct procedure from neither the sonnet nor the graph_nets documentation. I believe the question is better raised here than in the sonnet repo since it seems to be an issue with the subsequent processing of the core or decoder in the
EncoderProcessDecode
implementation.