tree_conv

paddle.fluid.contrib.layers.nn. tree_conv ( nodes_vector, edge_set, output_size, num_filters=1, max_depth=2, act='tanh', param_attr=None, bias_attr=None, name=None ) [source]

${comment}

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/fluid/contrib/layers/nn.py:docstring of paddle.fluid.contrib.layers.nn.tree_conv, line 2)

Block quote ends without a blank line; unexpected unindent.

Args : nodes_vector(nodesvectortype): { nodes_vector_comment } edge_set(edgesettype): { edge_set_comment }

System Message: ERROR/3 (/usr/local/lib/python3.8/site-packages/paddle/fluid/contrib/layers/nn.py:docstring of paddle.fluid.contrib.layers.nn.tree_conv, line 4)

Unexpected indentation.

output_size(int): output feature width num_filters(int): number of filters, Default 1 max_depth(int): max depth of filters, Default 2 act(str): activation function, Default tanh param_attr(ParamAttr): the parameter attribute for the filters, Default None bias_attr(ParamAttr): the parameter attribute for the bias of this layer, Default None name(str): a name of this layer(optional). If set None, the layer will be named automatically, Default None

Returns:
out(outtype):{

out_comment

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/fluid/contrib/layers/nn.py:docstring of paddle.fluid.contrib.layers.nn.tree_conv, line 15)

Definition list ends without a blank line; unexpected unindent.

}

Examples:
import paddle.fluid as fluid

# 10 for max_node_size of dataset, 5 for vector width
nodes_vector = fluid.layers.data(
    name='vectors', shape=[10, 5], dtype='float32')
# 10 for max_node_size of dataset, 2 for every edge has two nodes
# edges must be directional
edge_set = fluid.layers.data(name='edge_set', shape=[
                             10, 2], dtype='float32')
# the shape of output will be [10, 6, 1],
# 10 for max_node_size of dataset, 6 for output size, 1 for 1 filter
out_vector = fluid.layers.tree_conv(nodes_vector, edge_set, 6, 1, 2)

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/fluid/contrib/layers/nn.py:docstring of paddle.fluid.contrib.layers.nn.tree_conv, line 32)

Block quote ends without a blank line; unexpected unindent.

#After reshape, output tensor could be nodes_vector for next tree convolution

out_vector = fluid.layers.reshape(out_vector, shape=[-1, 10, 6]) out_vector_2 = fluid.layers.tree_conv(out_vector, edge_set, 3, 4, 2)

#also output tensor could be pooling(the pooling in paper called global pooling)

pooled = fluid.layers.reduce_max(out_vector, dim=2) # global pooling