56e6adb2773497506875c7cbd7a1fe6b5c59fb4c,tests/layer/test_gcn.py,,test_GraphConvolution_dense,#,60

Before Change


    x = features[None, :, :]

    // For dense matrix, remove batch dimension
    A_mat = Lambda(lambda A: K.squeeze(A, 0))(A_t)

    out = GraphConvolution(2)([x_t, A_mat])
    model = keras.Model(inputs=[x_t, A_t], outputs=out)
    preds = model.predict([x, adj], batch_size=1)

After Change


    // batch dimension > 1 should work with a dense matrix
    x_t = Input(batch_shape=(10,) + features.shape)
    A_t = Input(batch_shape=(10, 3, 3))
    input_data = [np.broadcast_to(x, x_t.shape), np.broadcast_to(adj, A_t.shape)]

    out = GraphConvolution(2)([x_t, A_t])
    model = keras.Model(inputs=[x_t, A_t], outputs=out)

    preds = model.predict(input_data, batch_size=10)
    assert preds.shape == (10, 3, 2)
    for i in range(1, 10):
        // every batch element had the same input data, so the predictions should all be identical
        np.testing.assert_array_equal(preds[i, ...], preds[0, ...])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: stellargraph/stellargraph
Commit Name: 56e6adb2773497506875c7cbd7a1fe6b5c59fb4c
Time: 2020-04-19
Author: Huon.Wilson@data61.csiro.au
File Name: tests/layer/test_gcn.py
Class Name:
Method Name: test_GraphConvolution_dense


Project Name: fizyr/keras-retinanet
Commit Name: 37d8d41a0b738fb8a4b9519a6d358c4f7e815382
Time: 2017-11-08
Author: hansg91@gmail.com
File Name: keras_retinanet/models/retinanet.py
Class Name:
Method Name: retinanet_bbox


Project Name: mathics/Mathics
Commit Name: 3159e4b8f5d863b87efa0f750ced348182adb1db
Time: 2020-09-07
Author: rb@dustyfeet.com
File Name: mathics/builtin/numpy_utils/with_numpy.py
Class Name:
Method Name: _create_ast_lambda