d38d1c85932d62fa23779c2e7f491d7a55627c14,src/graph_transpiler/webdnn/frontend/keras/layers/pooling.py,,_convert_global_average_pooling1d,#Any#Any#,159

Before Change


    x = converter.get_variable(converter.get_input_tensor(k_op)[0])

    // FIXME: More effective implementation
    y, = Reshape(None, in_order=OrderNTC, out_order=OrderNHWC, out_shape=[x.shape[0], x.shape[1], 1, x.shape[2]])
    y, = AveragePooling2D(None, ksize=(x.shape[1], 1), stride=(1, 1), padding=(0, 0))(y)

    // flatten without changing memory layout
    z, = Reshape(None, in_order=y.order, out_order=OrderNC, out_shape=[y.shape[0], mul(y.shape[1:])])(y)

After Change



@KerasConverter.register_handler("GlobalAveragePooling1D")
def _convert_global_average_pooling1d(converter: KerasConverter, k_op: keras.layers.GlobalAveragePooling1D):
    x = converter.get_variable(converter.get_input_tensor(k_op)[0])

    // FIXME: More effective implementation
    y, = Reshape(None, in_order=OrderNTC, out_order=OrderNHWC, out_shape=[x.shape[0], x.shape[1], 1, x.shape[2]])(x)
    y, = AveragePooling2D(None, ksize=(x.shape[1], 1), stride=(1, 1), padding=(0, 0))(y)

    // flatten without changing memory layout
    z, = Reshape(None, in_order=y.order, out_order=OrderNC, out_shape=[y.shape[0], mul(y.shape[1:])])(y)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 11

Instances


Project Name: mil-tokyo/webdnn
Commit Name: d38d1c85932d62fa23779c2e7f491d7a55627c14
Time: 2017-07-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/frontend/keras/layers/pooling.py
Class Name:
Method Name: _convert_global_average_pooling1d


Project Name: mil-tokyo/webdnn
Commit Name: d38d1c85932d62fa23779c2e7f491d7a55627c14
Time: 2017-07-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/frontend/keras/layers/pooling.py
Class Name:
Method Name: _convert_max_pooling1d


Project Name: mil-tokyo/webdnn
Commit Name: d38d1c85932d62fa23779c2e7f491d7a55627c14
Time: 2017-07-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/frontend/keras/layers/pooling.py
Class Name:
Method Name: _convert_global_average_pooling1d


Project Name: mil-tokyo/webdnn
Commit Name: d38d1c85932d62fa23779c2e7f491d7a55627c14
Time: 2017-07-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/frontend/keras/layers/pooling.py
Class Name:
Method Name: _convert_average_pooling1d


Project Name: mil-tokyo/webdnn
Commit Name: d38d1c85932d62fa23779c2e7f491d7a55627c14
Time: 2017-07-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/frontend/keras/layers/pooling.py
Class Name:
Method Name: _convert_global_max_pooling1d