def METHOD_NAME():
    def _impl(inputs, attr, params, prelude):
        dtype_str = attr.get("element_dtype").name
        input_ta = inputs[0]
        input_ta_shape = get_tensor_array_shape(input_ta, dtype_str, prelude)
        input_t_shape = _infer_type_with_prelude(inputs[2], prelude).shape
        input_rank = len(input_t_shape)
        if input_ta_shape is None:
            tensor_name = f"tensor{input_rank}"
            tensor_func = prelude.get_tensor_ctor(tensor_name, dtype_str)
            v = tensor_func(inputs[2])
            write_func = prelude.get_global_var("tensor_array_write", dtype_str)
            out = write_func(input_ta, inputs[1], v)
        else:
            static_tensor_array_ops = StaticTensorArrayOps(prelude, dtype_str, input_ta_shape)
            static_tensor_array_ops.register()
            tensor_func = static_tensor_array_ops.get_ctor("tensor_constructor")
            v = tensor_func(inputs[2])
            # Write tensor with more static shape
            # convert shape with -1 to any()
            input_ta_shape_a = []
            for dim in input_ta_shape:
                if isinstance(dim, (int, tvm.tir.expr.IntImm)):
                    if dim < 0:
                        input_ta_shape_a.append(Any())
                    else:
                        input_ta_shape_a.append(dim)
                else:
                    input_ta_shape_a.append(dim)
            actual_shape = _get_more_static_shape_rank(input_t_shape, input_ta_shape_a)
            if actual_shape != input_ta_shape_a:
                new_shape = []
                num_any_dim = 0
                for dim in actual_shape:
                    if not isinstance(dim, int):
                        num_any_dim += 1
                    new_shape.append(dim if isinstance(dim, int) else -1)
                if num_any_dim <= 1:
                    v = tensor_func(_op.reshape(inputs[2], new_shape))
            write_func = prelude.get_global_var_static(
                "tensor_array_write", dtype_str, input_ta_shape_a
            )
            out = write_func(input_ta, inputs[1], v)
        return out
    return _impl