@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)