42adcea31de47006d910822145e8faf9d4f8563b,src/graph_transpiler/webdnn/frontend/tensorflow/ops/gen_array_ops.py,,slice_handler,#Any#Any#,449

Before Change



@TensorFlowConverter.register_handler("Slice")
def slice_handler(converter: TensorFlowConverter, tf_op: "tf.Operation"):
    raise NotImplementedError(f"[TensorFlowConverter] {tf_op.type} is not supported yet.")


@TensorFlowConverter.register_handler("SpaceToBatch")
def space_to_batch_handler(converter: TensorFlowConverter, tf_op: "tf.Operation"):

After Change


@TensorFlowConverter.register_handler("Slice")
def slice_handler(converter: TensorFlowConverter, tf_op: "tf.Operation"):
    x = converter.get_variable(tf_op.inputs[0])
    begin = converter.get_variable(tf_op.inputs[1])
    size = converter.get_variable(tf_op.inputs[2])

    assert isinstance(begin, ConstantVariable), "[TensorFlowConverter] op "Slice" with dynamic position is not supported yet. "
    assert isinstance(size, ConstantVariable), "[TensorFlowConverter] op "Slice" with dynamic size is not supported yet. "

    begin = begin.data.flatten().astype(np.int32).tolist()
    size = size.data.flatten().astype(np.int32).tolist()
    y, = Slice(None, indices=AxisKeyDict(x.order.axes, [slice(b, b + s) for b, s in zip(begin, size)]))(x)
    converter.set_variable(tf_op.outputs[0], y)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: mil-tokyo/webdnn
Commit Name: 42adcea31de47006d910822145e8faf9d4f8563b
Time: 2017-11-30
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/frontend/tensorflow/ops/gen_array_ops.py
Class Name:
Method Name: slice_handler


Project Name: mil-tokyo/webdnn
Commit Name: 4094b4e6bf59cf713269097f56ebcd925ffe6e57
Time: 2017-12-12
Author: y.kikura@gmail.com
File Name: src/graph_transpiler/webdnn/frontend/onnx/defs/tensor.py
Class Name:
Method Name: _convert_split


Project Name: kengz/SLM-Lab
Commit Name: 60d3325b8551cc6f7592e1266878818ad07d3b3a
Time: 2018-01-13
Author: kengzwl@gmail.com
File Name: slm_lab/experiment/analysis.py
Class Name:
Method Name: analyze_experiment