33d3c4ca01dd3a1219275346c230006e2c24edad,src/graph_transpiler/webdnn/frontend/onnx/defs/nn.py,,_convert_global_max_pool,#Any#Any#,115

Before Change


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


@ONNXConverter.register_handler("BatchNormalization")
def _convert_batch_normalization(converter: ONNXConverter, onnx_op: INodeProto):

After Change


@ONNXConverter.register_handler("GlobalMaxPool")
def _convert_global_max_pool(converter: ONNXConverter, onnx_op: INodeProto):
    x = converter.get_variable(onnx_op.input[0])
    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, = Max(None, axis=reduction_axis)(x)

    converter.set_variable(onnx_op.output[0], y)

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

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_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


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