alexwengg's picture
Promote iOS17 models to canonical latin//multilingual/ paths (replace iOS18)
59b86f6 verified
program(1.0)
[buildInfo = dict<tensor<string, []>, tensor<string, []>>({{"coremlc-component-MIL", "3520.4.1"}, {"coremlc-version", "3520.5.1"}, {"coremltools-component-torch", "2.5.1"}, {"coremltools-source-dialect", "TorchScript"}, {"coremltools-version", "8.3.0"}})]
{
func main<ios17>(tensor<fp32, [1, ?]> audio, tensor<int32, [1]> audio_length) [FlexibleShapeInformation = tuple<tuple<tensor<string, []>, dict<tensor<string, []>, tensor<int32, [?]>>>, tuple<tensor<string, []>, dict<tensor<string, []>, list<tensor<int32, [2]>, ?>>>>((("DefaultShapes", {{"audio", [1, 1]}}), ("RangeDims", {{"audio", [[1, 1], [1, 1280000]]}})))] {
tensor<int32, []> var_9 = const()[name = tensor<string, []>("op_9"), val = tensor<int32, []>(1)];
tensor<int32, []> var_10 = const()[name = tensor<string, []>("op_10"), val = tensor<int32, []>(160)];
tensor<int32, []> var_12 = const()[name = tensor<string, []>("op_12"), val = tensor<int32, []>(0)];
tensor<int32, []> var_33 = const()[name = tensor<string, []>("op_33"), val = tensor<int32, []>(512)];
tensor<int32, [1]> var_34 = add(x = audio_length, y = var_33)[name = tensor<string, []>("op_34")];
tensor<int32, []> var_35 = const()[name = tensor<string, []>("op_35"), val = tensor<int32, []>(512)];
tensor<int32, [1]> var_36 = sub(x = var_34, y = var_35)[name = tensor<string, []>("op_36")];
tensor<int32, [1]> floor_div_0 = floor_div(x = var_36, y = var_10)[name = tensor<string, []>("floor_div_0")];
tensor<bool, [1]> var_39 = equal(x = audio_length, y = var_12)[name = tensor<string, []>("op_39")];
tensor<int32, [1]> var_40 = const()[name = tensor<string, []>("op_40"), val = tensor<int32, [1]>([0])];
tensor<int32, [1]> mel_length = select(a = var_40, b = floor_div_0, cond = var_39)[name = tensor<string, []>("seq_len")];
tensor<string, []> audio_to_fp16_dtype_0 = const()[name = tensor<string, []>("audio_to_fp16_dtype_0"), val = tensor<string, []>("fp16")];
tensor<fp16, [1, ?]> audio_to_fp16 = cast(dtype = audio_to_fp16_dtype_0, x = audio)[name = tensor<string, []>("cast_14")];
tensor<int32, [2]> var_42_shape_cast_fp16 = shape(x = audio_to_fp16)[name = tensor<string, []>("op_42_shape_cast_fp16")];
tensor<int32, []> gather_0_axis_0 = const()[name = tensor<string, []>("gather_0_axis_0"), val = tensor<int32, []>(0)];
tensor<int32, []> gather_0_batch_dims_0 = const()[name = tensor<string, []>("gather_0_batch_dims_0"), val = tensor<int32, []>(0)];
tensor<bool, []> gather_0_validate_indices_0 = const()[name = tensor<string, []>("gather_0_validate_indices_0"), val = tensor<bool, []>(false)];
tensor<string, []> var_42_shape_cast_fp16_to_int16_dtype_0 = const()[name = tensor<string, []>("op_42_shape_cast_fp16_to_int16_dtype_0"), val = tensor<string, []>("int16")];
tensor<uint16, []> select_0_to_uint16 = const()[name = tensor<string, []>("select_0_to_uint16"), val = tensor<uint16, []>(1)];
tensor<int16, [2]> var_42_shape_cast_fp16_to_int16 = cast(dtype = var_42_shape_cast_fp16_to_int16_dtype_0, x = var_42_shape_cast_fp16)[name = tensor<string, []>("cast_13")];
tensor<int16, []> gather_0_cast_uint16 = gather(axis = gather_0_axis_0, batch_dims = gather_0_batch_dims_0, indices = select_0_to_uint16, validate_indices = gather_0_validate_indices_0, x = var_42_shape_cast_fp16_to_int16)[name = tensor<string, []>("gather_0_cast_uint16")];
tensor<string, []> gather_0_cast_uint16_to_int32_dtype_0 = const()[name = tensor<string, []>("gather_0_cast_uint16_to_int32_dtype_0"), val = tensor<string, []>("int32")];
tensor<int32, []> const_0 = const()[name = tensor<string, []>("const_0"), val = tensor<int32, []>(0)];
tensor<int32, []> const_1 = const()[name = tensor<string, []>("const_1"), val = tensor<int32, []>(1)];
tensor<int32, []> gather_0_cast_uint16_to_int32 = cast(dtype = gather_0_cast_uint16_to_int32_dtype_0, x = gather_0_cast_uint16)[name = tensor<string, []>("cast_12")];
tensor<int32, [?]> var_43 = range_1d(end = gather_0_cast_uint16_to_int32, start = const_0, step = const_1)[name = tensor<string, []>("op_43")];
tensor<int32, [1]> var_44_axes_0 = const()[name = tensor<string, []>("op_44_axes_0"), val = tensor<int32, [1]>([0])];
tensor<int32, [1, ?]> var_44 = expand_dims(axes = var_44_axes_0, x = var_43)[name = tensor<string, []>("op_44")];
tensor<int32, [1]> var_45_axes_0 = const()[name = tensor<string, []>("op_45_axes_0"), val = tensor<int32, [1]>([1])];
tensor<int32, [1, 1]> var_45 = expand_dims(axes = var_45_axes_0, x = audio_length)[name = tensor<string, []>("op_45")];
tensor<bool, [1, ?]> timemask = less(x = var_44, y = var_45)[name = tensor<string, []>("timemask")];
tensor<int32, [2]> var_48_begin_0 = const()[name = tensor<string, []>("op_48_begin_0"), val = tensor<int32, [2]>([0, 0])];
tensor<int32, [2]> var_48_end_0 = const()[name = tensor<string, []>("op_48_end_0"), val = tensor<int32, [2]>([1, 1])];
tensor<bool, [2]> var_48_end_mask_0 = const()[name = tensor<string, []>("op_48_end_mask_0"), val = tensor<bool, [2]>([true, false])];
tensor<bool, [2]> var_48_squeeze_mask_0 = const()[name = tensor<string, []>("op_48_squeeze_mask_0"), val = tensor<bool, [2]>([false, true])];
tensor<fp16, [1]> var_48_cast_fp16 = slice_by_index(begin = var_48_begin_0, end = var_48_end_0, end_mask = var_48_end_mask_0, squeeze_mask = var_48_squeeze_mask_0, x = audio_to_fp16)[name = tensor<string, []>("op_48_cast_fp16")];
tensor<int32, [1]> var_49_axes_0 = const()[name = tensor<string, []>("op_49_axes_0"), val = tensor<int32, [1]>([1])];
tensor<fp16, [1, 1]> var_49_cast_fp16 = expand_dims(axes = var_49_axes_0, x = var_48_cast_fp16)[name = tensor<string, []>("op_49_cast_fp16")];
tensor<int32, [2]> var_51_begin_0 = const()[name = tensor<string, []>("op_51_begin_0"), val = tensor<int32, [2]>([0, 1])];
tensor<int32, [2]> var_51_end_0 = const()[name = tensor<string, []>("op_51_end_0"), val = tensor<int32, [2]>([1, 0])];
tensor<bool, [2]> var_51_end_mask_0 = const()[name = tensor<string, []>("op_51_end_mask_0"), val = tensor<bool, [2]>([true, true])];
tensor<fp16, [1, ?]> var_51_cast_fp16 = slice_by_index(begin = var_51_begin_0, end = var_51_end_0, end_mask = var_51_end_mask_0, x = audio_to_fp16)[name = tensor<string, []>("op_51_cast_fp16")];
tensor<int32, [2]> var_53_begin_0 = const()[name = tensor<string, []>("op_53_begin_0"), val = tensor<int32, [2]>([0, 0])];
tensor<int32, [2]> var_53_end_0 = const()[name = tensor<string, []>("op_53_end_0"), val = tensor<int32, [2]>([1, -1])];
tensor<bool, [2]> var_53_end_mask_0 = const()[name = tensor<string, []>("op_53_end_mask_0"), val = tensor<bool, [2]>([true, false])];
tensor<fp16, [1, ?]> var_53_cast_fp16 = slice_by_index(begin = var_53_begin_0, end = var_53_end_0, end_mask = var_53_end_mask_0, x = audio_to_fp16)[name = tensor<string, []>("op_53_cast_fp16")];
tensor<fp16, []> var_54_to_fp16 = const()[name = tensor<string, []>("op_54_to_fp16"), val = tensor<fp16, []>(0x1.f0cp-1)];
tensor<fp16, [1, ?]> var_55_cast_fp16 = mul(x = var_53_cast_fp16, y = var_54_to_fp16)[name = tensor<string, []>("op_55_cast_fp16")];
tensor<fp16, [1, ?]> var_56_cast_fp16 = sub(x = var_51_cast_fp16, y = var_55_cast_fp16)[name = tensor<string, []>("op_56_cast_fp16")];
tensor<bool, []> x_3_interleave_0 = const()[name = tensor<string, []>("x_3_interleave_0"), val = tensor<bool, []>(false)];
tensor<fp16, [1, ?]> x_3_cast_fp16 = concat(axis = var_9, interleave = x_3_interleave_0, values = (var_49_cast_fp16, var_56_cast_fp16))[name = tensor<string, []>("x_3_cast_fp16")];
tensor<bool, [1, ?]> var_59 = logical_not(x = timemask)[name = tensor<string, []>("op_59")];
tensor<fp16, []> var_16_to_fp16 = const()[name = tensor<string, []>("op_16_to_fp16"), val = tensor<fp16, []>(0x0p+0)];
tensor<fp16, [1, ?]> input_1_cast_fp16 = select(a = var_16_to_fp16, b = x_3_cast_fp16, cond = var_59)[name = tensor<string, []>("input_1_cast_fp16")];
tensor<int32, [3]> concat_1x = const()[name = tensor<string, []>("concat_1x"), val = tensor<int32, [3]>([1, 1, -1])];
tensor<fp16, [1, 1, ?]> input_3_cast_fp16 = reshape(shape = concat_1x, x = input_1_cast_fp16)[name = tensor<string, []>("input_3_cast_fp16")];
tensor<int32, [6]> input_5_pad_0 = const()[name = tensor<string, []>("input_5_pad_0"), val = tensor<int32, [6]>([0, 0, 0, 0, 256, 256])];
tensor<string, []> input_5_mode_0 = const()[name = tensor<string, []>("input_5_mode_0"), val = tensor<string, []>("constant")];
tensor<fp16, []> const_3_to_fp16 = const()[name = tensor<string, []>("const_3_to_fp16"), val = tensor<fp16, []>(0x0p+0)];
tensor<fp16, [1, 1, ?]> input_5_cast_fp16 = pad(constant_val = const_3_to_fp16, mode = input_5_mode_0, pad = input_5_pad_0, x = input_3_cast_fp16)[name = tensor<string, []>("input_5_cast_fp16")];
tensor<int32, [2]> concat_2x = const()[name = tensor<string, []>("concat_2x"), val = tensor<int32, [2]>([1, -1])];
tensor<fp16, [1, ?]> input_cast_fp16 = reshape(shape = concat_2x, x = input_5_cast_fp16)[name = tensor<string, []>("input_cast_fp16")];
tensor<int32, [1]> expand_dims_3 = const()[name = tensor<string, []>("expand_dims_3"), val = tensor<int32, [1]>([160])];
tensor<int32, [1]> expand_dims_4_axes_0 = const()[name = tensor<string, []>("expand_dims_4_axes_0"), val = tensor<int32, [1]>([1])];
tensor<fp16, [1, 1, ?]> expand_dims_4_cast_fp16 = expand_dims(axes = expand_dims_4_axes_0, x = input_cast_fp16)[name = tensor<string, []>("expand_dims_4_cast_fp16")];
tensor<string, []> conv_0_pad_type_0 = const()[name = tensor<string, []>("conv_0_pad_type_0"), val = tensor<string, []>("valid")];
tensor<int32, [2]> conv_0_pad_0 = const()[name = tensor<string, []>("conv_0_pad_0"), val = tensor<int32, [2]>([0, 0])];
tensor<int32, [1]> conv_0_dilations_0 = const()[name = tensor<string, []>("conv_0_dilations_0"), val = tensor<int32, [1]>([1])];
tensor<int32, []> conv_0_groups_0 = const()[name = tensor<string, []>("conv_0_groups_0"), val = tensor<int32, []>(1)];
tensor<fp16, [257, 1, 512]> expand_dims_1_to_fp16 = const()[name = tensor<string, []>("expand_dims_1_to_fp16"), val = tensor<fp16, [257, 1, 512]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(64)))];
tensor<fp16, [1, 257, ?]> conv_0_cast_fp16 = conv(dilations = conv_0_dilations_0, groups = conv_0_groups_0, pad = conv_0_pad_0, pad_type = conv_0_pad_type_0, strides = expand_dims_3, weight = expand_dims_1_to_fp16, x = expand_dims_4_cast_fp16)[name = tensor<string, []>("conv_0_cast_fp16")];
tensor<string, []> conv_1_pad_type_0 = const()[name = tensor<string, []>("conv_1_pad_type_0"), val = tensor<string, []>("valid")];
tensor<int32, [2]> conv_1_pad_0 = const()[name = tensor<string, []>("conv_1_pad_0"), val = tensor<int32, [2]>([0, 0])];
tensor<int32, [1]> conv_1_dilations_0 = const()[name = tensor<string, []>("conv_1_dilations_0"), val = tensor<int32, [1]>([1])];
tensor<int32, []> conv_1_groups_0 = const()[name = tensor<string, []>("conv_1_groups_0"), val = tensor<int32, []>(1)];
tensor<fp16, [257, 1, 512]> expand_dims_2_to_fp16 = const()[name = tensor<string, []>("expand_dims_2_to_fp16"), val = tensor<fp16, [257, 1, 512]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(263296)))];
tensor<fp16, [1, 257, ?]> conv_1_cast_fp16 = conv(dilations = conv_1_dilations_0, groups = conv_1_groups_0, pad = conv_1_pad_0, pad_type = conv_1_pad_type_0, strides = expand_dims_3, weight = expand_dims_2_to_fp16, x = expand_dims_4_cast_fp16)[name = tensor<string, []>("conv_1_cast_fp16")];
tensor<int32, []> stack_0_axis_0 = const()[name = tensor<string, []>("stack_0_axis_0"), val = tensor<int32, []>(-1)];
tensor<fp16, [1, 257, ?, 2]> stack_0_cast_fp16 = stack(axis = stack_0_axis_0, values = (conv_0_cast_fp16, conv_1_cast_fp16))[name = tensor<string, []>("stack_0_cast_fp16")];
tensor<fp16, []> var_19_promoted_to_fp16 = const()[name = tensor<string, []>("op_19_promoted_to_fp16"), val = tensor<fp16, []>(0x1p+1)];
tensor<fp16, [1, 257, ?, 2]> var_74_cast_fp16 = pow(x = stack_0_cast_fp16, y = var_19_promoted_to_fp16)[name = tensor<string, []>("op_74_cast_fp16")];
tensor<int32, [1]> var_76_axes_0 = const()[name = tensor<string, []>("op_76_axes_0"), val = tensor<int32, [1]>([-1])];
tensor<bool, []> var_76_keep_dims_0 = const()[name = tensor<string, []>("op_76_keep_dims_0"), val = tensor<bool, []>(false)];
tensor<fp16, [1, 257, ?]> var_76_cast_fp16 = reduce_sum(axes = var_76_axes_0, keep_dims = var_76_keep_dims_0, x = var_74_cast_fp16)[name = tensor<string, []>("op_76_cast_fp16")];
tensor<fp16, [1, 257, ?]> x_11_cast_fp16 = identity(x = var_76_cast_fp16)[name = tensor<string, []>("x_11_cast_fp16")];
tensor<bool, []> x_13_transpose_x_0 = const()[name = tensor<string, []>("x_13_transpose_x_0"), val = tensor<bool, []>(false)];
tensor<bool, []> x_13_transpose_y_0 = const()[name = tensor<string, []>("x_13_transpose_y_0"), val = tensor<bool, []>(false)];
tensor<fp16, [1, 128, 257]> const_4_to_fp16 = const()[name = tensor<string, []>("const_4_to_fp16"), val = tensor<fp16, [1, 128, 257]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(526528)))];
tensor<fp16, [1, 128, ?]> x_13_cast_fp16 = matmul(transpose_x = x_13_transpose_x_0, transpose_y = x_13_transpose_y_0, x = const_4_to_fp16, y = x_11_cast_fp16)[name = tensor<string, []>("x_13_cast_fp16")];
tensor<fp16, []> var_83_to_fp16 = const()[name = tensor<string, []>("op_83_to_fp16"), val = tensor<fp16, []>(0x1p-24)];
tensor<fp16, [1, 128, ?]> var_84_cast_fp16 = add(x = x_13_cast_fp16, y = var_83_to_fp16)[name = tensor<string, []>("op_84_cast_fp16")];
tensor<fp32, []> x_epsilon_0 = const()[name = tensor<string, []>("x_epsilon_0"), val = tensor<fp32, []>(0x1p-149)];
tensor<fp16, [1, 128, ?]> x_cast_fp16 = log(epsilon = x_epsilon_0, x = var_84_cast_fp16)[name = tensor<string, []>("x_cast_fp16")];
tensor<int32, [3]> var_86_shape_cast_fp16 = shape(x = x_cast_fp16)[name = tensor<string, []>("op_86_shape_cast_fp16")];
tensor<int32, []> gather_5_axis_0 = const()[name = tensor<string, []>("gather_5_axis_0"), val = tensor<int32, []>(0)];
tensor<int32, []> gather_5_batch_dims_0 = const()[name = tensor<string, []>("gather_5_batch_dims_0"), val = tensor<int32, []>(0)];
tensor<bool, []> gather_5_validate_indices_0 = const()[name = tensor<string, []>("gather_5_validate_indices_0"), val = tensor<bool, []>(false)];
tensor<string, []> var_86_shape_cast_fp16_to_uint16_dtype_0 = const()[name = tensor<string, []>("op_86_shape_cast_fp16_to_uint16_dtype_0"), val = tensor<string, []>("uint16")];
tensor<uint16, []> select_5_to_uint16 = const()[name = tensor<string, []>("select_5_to_uint16"), val = tensor<uint16, []>(2)];
tensor<uint16, [3]> var_86_shape_cast_fp16_to_uint16 = cast(dtype = var_86_shape_cast_fp16_to_uint16_dtype_0, x = var_86_shape_cast_fp16)[name = tensor<string, []>("cast_11")];
tensor<uint16, []> gather_5_cast_uint16 = gather(axis = gather_5_axis_0, batch_dims = gather_5_batch_dims_0, indices = select_5_to_uint16, validate_indices = gather_5_validate_indices_0, x = var_86_shape_cast_fp16_to_uint16)[name = tensor<string, []>("gather_5_cast_uint16")];
tensor<string, []> gather_5_cast_uint16_to_int32_dtype_0 = const()[name = tensor<string, []>("gather_5_cast_uint16_to_int32_dtype_0"), val = tensor<string, []>("int32")];
tensor<int32, []> const_5 = const()[name = tensor<string, []>("const_5"), val = tensor<int32, []>(0)];
tensor<int32, []> const_6 = const()[name = tensor<string, []>("const_6"), val = tensor<int32, []>(1)];
tensor<int32, []> gather_5_cast_uint16_to_int32 = cast(dtype = gather_5_cast_uint16_to_int32_dtype_0, x = gather_5_cast_uint16)[name = tensor<string, []>("cast_10")];
tensor<int32, [?]> mask_1 = range_1d(end = gather_5_cast_uint16_to_int32, start = const_5, step = const_6)[name = tensor<string, []>("mask_1")];
tensor<int32, [1]> expand_dims_0_axes_0 = const()[name = tensor<string, []>("expand_dims_0_axes_0"), val = tensor<int32, [1]>([0])];
tensor<int32, [1, ?]> expand_dims_0 = expand_dims(axes = expand_dims_0_axes_0, x = mask_1)[name = tensor<string, []>("expand_dims_0")];
tensor<int32, [1]> var_91_axes_0 = const()[name = tensor<string, []>("op_91_axes_0"), val = tensor<int32, [1]>([1])];
tensor<int32, [1, 1]> var_91 = expand_dims(axes = var_91_axes_0, x = mel_length)[name = tensor<string, []>("op_91")];
tensor<bool, [1, ?]> mask = greater_equal(x = expand_dims_0, y = var_91)[name = tensor<string, []>("mask")];
tensor<int32, [1]> var_93_axes_0 = const()[name = tensor<string, []>("op_93_axes_0"), val = tensor<int32, [1]>([1])];
tensor<bool, [1, 1, ?]> var_93 = expand_dims(axes = var_93_axes_0, x = mask)[name = tensor<string, []>("op_93")];
tensor<fp16, [1, 128, ?]> processed_signal_cast_fp16 = select(a = var_16_to_fp16, b = x_cast_fp16, cond = var_93)[name = tensor<string, []>("processed_signal_cast_fp16")];
tensor<string, []> processed_signal_cast_fp16_to_fp32_dtype_0 = const()[name = tensor<string, []>("processed_signal_cast_fp16_to_fp32_dtype_0"), val = tensor<string, []>("fp32")];
tensor<fp32, [1, 128, ?]> mel = cast(dtype = processed_signal_cast_fp16_to_fp32_dtype_0, x = processed_signal_cast_fp16)[name = tensor<string, []>("cast_9")];
} -> (mel, mel_length);
}