def cast_input_to_int32(self, input_name: str):
    cast_output = (input_name + '_int32')
    inputs = [input_name]
    output_name_to_node = self.model.output_name_to_node()
    if (input_name in output_name_to_node):
        parent_node = output_name_to_node[input_name]
        if (parent_node and (parent_node.op_type == 'Cast')):
            inputs = [parent_node.input[0]]
    cast_node = helper.make_node('Cast', inputs=inputs, outputs=[cast_output])
    cast_node.attribute.extend([helper.make_attribute('to', int(TensorProto.INT32))])
    self.model.add_node(cast_node)
    return (cast_output, cast_node)
def cast_input_to_int32(self, input_name: str):
    cast_output = (input_name + '_int32')
    inputs = [input_name]
    output_name_to_node = self.model.output_name_to_node()
    if (input_name in output_name_to_node):
        parent_node = output_name_to_node[input_name]
        if (parent_node and (parent_node.op_type == 'Cast')):
            inputs = [parent_node.input[0]]
    cast_node = helper.make_node('Cast', inputs=inputs, outputs=[cast_output])
    cast_node.attribute.extend([helper.make_attribute('to', int(TensorProto.INT32))])
    self.model.add_node(cast_node)
    return (cast_output, cast_node)