d5ff7138d95488b0dce44dfe1c60a426f6a37b51,src/graph_transpiler/webdnn/backend/webgpu/kernels/flatten.py,,flatten,#Any#Any#Any#,28

Before Change



    // assert x.variable.order == y.variable.order

    meta_injector = MetaInjector()
    meta_injector.register({
        "flatten_x_offset": x.offset,
        "flatten_y_offset": y.offset,
        "flatten_N": y.variable.size,
    })

    name_injector = KernelNameInjector(op)

    source = template
    source = meta_injector.inject(source)
    source = name_injector.inject(source)

    kernel = Kernel(
        {name_injector.name: source},
        name_injector.name,
        GPUSize(8, 1, 1),
        GPUSize(1024, 1, 1),
        meta_injector.buffer
    )

    return [kernel]

After Change



    const int N = %%META_LOAD(flatten_N)%%;

    for (int gid = index; gid < N; gid += num_threads) {
        y[gid] = x[gid];
    }
}



def flatten(op: Flatten,
            memory_layout: MemoryLayout) -> List[Kernel]:
    x = memory_layout[op.inputs["x"]]
    y = memory_layout[op.outputs["y"]]

    // assert x.variable.order == y.variable.order

    meta_injector = MetaInjector()
    meta_injector.register({
        "flatten_x_offset": x.offset,
        "flatten_y_offset": y.offset,
        "flatten_N": y.variable.size,
    })

    name_injector = KernelNameInjector(op)

    source = template
    source = meta_injector.inject(source)
    source = name_injector.inject(source)

    kernel = Kernel(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 7

Non-data size: 26

Instances


Project Name: mil-tokyo/webdnn
Commit Name: d5ff7138d95488b0dce44dfe1c60a426f6a37b51
Time: 2017-06-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/backend/webgpu/kernels/flatten.py
Class Name:
Method Name: flatten


Project Name: mil-tokyo/webdnn
Commit Name: d5ff7138d95488b0dce44dfe1c60a426f6a37b51
Time: 2017-06-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/backend/webgpu/kernels/scalar_affine.py
Class Name:
Method Name: scalar_affine


Project Name: mil-tokyo/webdnn
Commit Name: d5ff7138d95488b0dce44dfe1c60a426f6a37b51
Time: 2017-06-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/backend/webgpu/kernels/flatten.py
Class Name:
Method Name: flatten


Project Name: mil-tokyo/webdnn
Commit Name: d5ff7138d95488b0dce44dfe1c60a426f6a37b51
Time: 2017-06-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/backend/webgpu/kernels/elu.py
Class Name:
Method Name: elu


Project Name: mil-tokyo/webdnn
Commit Name: d5ff7138d95488b0dce44dfe1c60a426f6a37b51
Time: 2017-06-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/backend/webgpu/kernels/col2im.py
Class Name:
Method Name: col2im


Project Name: mil-tokyo/webdnn
Commit Name: d5ff7138d95488b0dce44dfe1c60a426f6a37b51
Time: 2017-06-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/backend/webgpu/kernels/average_pooling_2d.py
Class Name:
Method Name: average_pooling_2d


Project Name: mil-tokyo/webdnn
Commit Name: d5ff7138d95488b0dce44dfe1c60a426f6a37b51
Time: 2017-06-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/backend/webgpu/kernels/max_pooling_2d.py
Class Name:
Method Name: max_pooling_2d


Project Name: mil-tokyo/webdnn
Commit Name: d5ff7138d95488b0dce44dfe1c60a426f6a37b51
Time: 2017-06-03
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/backend/webgpu/kernels/tanh.py
Class Name:
Method Name: tanh