33d3c4ca01dd3a1219275346c230006e2c24edad,src/graph_transpiler/webdnn/frontend/onnx/defs/nn.py,,_convert_global_average_pool,#Any#Any#,109

Before Change


@ONNXConverter.register_handler("GlobalAveragePool")
def _convert_global_average_pool(converter: ONNXConverter, onnx_op: INodeProto):
    // FIXME: It"s possible to support in current version of webdnn
    raise NotImplementedError("[ONNXConverter] Operator \"GlobalAveragePooling\" is not supported yet.")


@ONNXConverter.register_handler("GlobalMaxPool")
def _convert_global_max_pool(converter: ONNXConverter, onnx_op: INodeProto):

After Change


    if x.ndim == 4:
        x.order.unify(OrderNCHW)

    reduction_size = mul(x.shape[2:])
    reduction_axis = Axis()

    x = x.reshape([x.shape[0], x.shape[1], reduction_size],
                  Order([x.order.axes[0], x.order.axes[1], reduction_axis]))
    y, = Sum(None, axis=reduction_axis)(x)
    y /= reduction_size

    converter.set_variable(onnx_op.output[0], y)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 12

Instances


Project Name: mil-tokyo/webdnn
Commit Name: 33d3c4ca01dd3a1219275346c230006e2c24edad
Time: 2017-12-12
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/frontend/onnx/defs/nn.py
Class Name:
Method Name: _convert_global_average_pool


Project Name: mil-tokyo/webdnn
Commit Name: 33d3c4ca01dd3a1219275346c230006e2c24edad
Time: 2017-12-12
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/frontend/onnx/defs/nn.py
Class Name:
Method Name: _convert_flatten


Project Name: mil-tokyo/webdnn
Commit Name: 33d3c4ca01dd3a1219275346c230006e2c24edad
Time: 2017-12-12
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/frontend/onnx/defs/nn.py
Class Name:
Method Name: _convert_global_max_pool


Project Name: mil-tokyo/webdnn
Commit Name: 33d3c4ca01dd3a1219275346c230006e2c24edad
Time: 2017-12-12
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/frontend/onnx/defs/nn.py
Class Name:
Method Name: _convert_global_average_pool