cyberzhg / keras-gcn Goto Github PK
View Code? Open in Web Editor NEWGraph convolutional layers
Home Page: https://pypi.org/project/keras-gcn/
License: MIT License
Graph convolutional layers
Home Page: https://pypi.org/project/keras-gcn/
License: MIT License
Describe the Bug
I am getting the following error 👍 Traceback (most recent call last):
File "/home/pulkit/Desktop/GIT2/BTP/SimGNN/src/model.py", line 97, in <module>
model.train_step()
File "/home/pulkit/Desktop/GIT2/BTP/SimGNN/src/model.py", line 88, in train_step
y = self(data, training = True)
File "/home/pulkit/.local/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 985, in __call__
outputs = call_fn(inputs, *args, **kwargs)
File "/home/pulkit/Desktop/GIT2/BTP/SimGNN/src/model.py", line 46, in call
z1 = self.gcn1([features_1, edge_index_1])
File "/home/pulkit/.local/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 985, in __call__
outputs = call_fn(inputs, *args, **kwargs)
File "/home/pulkit/.local/lib/python3.8/site-packages/keras_gcn/layers.py", line 50, in call
outputs = self.activation(self._call(features, edges))
File "/home/pulkit/.local/lib/python3.8/site-packages/keras_gcn/layers.py", line 145, in _call
return K.batch_dot(K.permute_dimensions(edges, (0, 2, 1)), features) \
File "/home/pulkit/.local/lib/python3.8/site-packages/tensorflow/python/util/dispatch.py", line 201, in wrapper
return target(*args, **kwargs)
File "/home/pulkit/.local/lib/python3.8/site-packages/tensorflow/python/keras/backend.py", line 2943, in permute_dimensions
return array_ops.transpose(x, perm=pattern)
File "/home/pulkit/.local/lib/python3.8/site-packages/tensorflow/python/util/dispatch.py", line 201, in wrapper
return target(*args, **kwargs)
File "/home/pulkit/.local/lib/python3.8/site-packages/tensorflow/python/ops/array_ops.py", line 2188, in transpose
return transpose_fn(a, perm, name=name)
File "/home/pulkit/.local/lib/python3.8/site-packages/tensorflow/python/ops/gen_array_ops.py", line 11529, in transpose
return transpose_eager_fallback(
File "/home/pulkit/.local/lib/python3.8/site-packages/tensorflow/python/ops/gen_array_ops.py", line 11554, in transpose_eager_fallback
_result = _execute.execute(b"Transpose", 1, inputs=_inputs_flat,
File "/home/pulkit/.local/lib/python3.8/site-packages/tensorflow/python/eager/execute.py", line 59, in quick_execute
tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InvalidArgumentError: transpose expects a vector of size 2. But input(1) is a vector of size 3 [Op:Transpose]
The input sizes are :
Features : (19, 16)
Edges : (2, 158)
Calling the layer as : z1 = self.gcn1([features_1, edge_index_1])
@CyberZHG 感谢实现相关代码!请问你能提供关于这个代码实现的参考博客或者论文吗?
Hello,which formula does the formula in your code come from, which is different from the formula in the kipf paper?
Is the
from keras_gru import GraphConv
means
from keras_gcn import GraphConv??
is this a mistyping?
Hi,
Apparently, your codes look very efficient.
But I wonder which paper is your code based on, especially because the only function you provided is a little bit different from the original GCN (http://tkipf.github.io/graph-convolutional-networks/).
Cheers
input_1 (InputLayer) [(None, None, 256)] 0 []
input_2 (InputLayer) [(None, 256, 256)] 0 []
graph_conv (GraphConv) (None, 256, 32) 8224 ['input_1[0][0]',
'input_2[0][0]']
graph_conv_1 (GraphConv) (None, 256, 16) 528 ['graph_conv[0][0]',
'input_2[0][0]']
lstm (LSTM) (None, None, 128) 197120 ['input_1[0][0]']
flatten (Flatten) (None, 4096) 0 ['graph_conv_1[0][0]']
lstm_1 (LSTM) (None, 32) 20608 ['lstm[0][0]']
concatenate (Concatenate) (None, 4128) 0 ['flatten[0][0]',
'lstm_1[0][0]']
batch_normalization (BatchNorm (None, 4128) 16512 ['concatenate[0][0]']
alization)
dropout (Dropout) (None, 4128) 0 ['batch_normalization[0][0]']
dense (Dense) (None, 128) 528512 ['dropout[0][0]']
dense_1 (Dense) (None, 32) 4128 ['dense[0][0]']
dropout_1 (Dropout) (None, 32) 0 ['dense_1[0][0]']
dense_2 (Dense) (None, 1) 33 ['dropout_1[0][0]']
==================================================================================================
Total params: 775,665
Trainable params: 767,409
Non-trainable params: 8,256
========== TRAIN ============
/usr/local/lib/python3.7/dist-packages/nilmtk/elecmeter.py:432: UserWarning: The provided sample_period (1) is shorter than the meter's sample_period (3)
sample_period, default_sample_period
Epoch 1/10
Traceback (most recent call last):
File "/content/drive/MyDrive/Auto_Encoder/DAE/redd-test.py", line 31, in
dae.train(train_mains, train_meter, epochs=10, sample_period=1)
File "/content/drive/MyDrive/Auto_Encoder/DAE/daedisaggregator.py", line 78, in train
self.train_on_chunk(mainchunk, meterchunk, epochs, batch_size)
File "/content/drive/MyDrive/Auto_Encoder/DAE/daedisaggregator.py", line 115, in train_on_chunk
self.model.fit(X_batch, Y_batch, batch_size=batch_size, epochs=epochs, shuffle=True)
File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py", line 1147, in autograph_handler
raise e.ag_error_metadata.to_exception(e)
ValueError: in user code:
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1021, in train_function *
return step_function(self, iterator)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1010, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1000, in run_step **
outputs = model.train_step(data)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 859, in train_step
y_pred = self(x, training=True)
File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.7/dist-packages/keras/engine/input_spec.py", line 200, in assert_input_compatibility
raise ValueError(f'Layer "{layer_name}" expects {len(input_spec)} input(s),'
ValueError: Layer "model" expects 2 input(s), but it received 1 input tensors. Inputs received: [<tf.Tensor 'IteratorGetNext:0' shape=(None, 256, 1) dtype=float32>]
Hello!
I am very interested in graph convolution, especially when applied to chemical compounds.
Is there a paper, or some sort of intuitive explanation you can give of how the graph convolution layer works?
Thanks for your time
I see that there is a test module. Could you please also include an example on how to fit the model?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.