def convert_input_to_tensor_type(self, node: InternalTorchIRNode) -> None:
        """
        Convert non-tensor type input of a node into tensor type.

        This utility check if the input is a function state input, and
        convert it into a tensor type.

        For instance, given the following torchscript graph:

            %x(state, fp16), %y(tensor, fp32) -> {
                %1 = add(%x, %y)
            }

        The graph is translated into:

            %x(state, fp16), %y(tensor, fp32) -> {
                %read_x = read_state(%x)
                %read_x_cast = cast(%read_x, "fp32")
                %1 = add(%read_x_cast, %y)
            }

        ``%read_x_cast`` is cached in ``name_to_source_state``, to make sure one
        state feeds into only one ``read_state`` op.
        """

        for val in node.inputs:
            if val is None:
                continue
            if val not in self:
                continue
            in_node = self[val]
            if in_node is None or not isinstance(in_node, Var):
                continue
            if types.is_state(in_node.sym_type):
                self.name_to_source_state[val] = self[val]
                assert (
                    in_node.op is None
                ), f"A state type var must come from a placeholder. Got parent op {in_node.op.op_type} instead."
                read_state = mb.read_state(input=in_node)
                read_state_fp32 = mb.cast(x=read_state, dtype="fp32")
                self.add(read_state_fp32, torch_name=val, override=True)
        return

        Convert non-tensor type input of a node into tensor type.

        This utility check if the input is a function state input, and
        convert it into a tensor type.

        For instance, given the following torchscript graph:

            %x(state, fp16), %y(tensor, fp32) -> {
                %1 = add(%x, %y)
            }

        The graph is translated into:

            %x(state, fp16), %y(tensor, fp32) -> {
                %read_x = read_state(%x)
                %read_x_cast = cast(%read_x, "fp32")
                %1 = add(%read_x_cast, %y)
            }

        ``%read_x_cast`` is cached in ``name_to_source_state``, to make sure one
        state feeds into only one ``read_state`` op.
        
coremltools/converters/mil/frontend/torch/converter.py