r1sh1's picture
Sangam n3-slang1, Core ML, 16-bit
fb8b159 verified
Raw History Blame Contribute Delete
8.33 kB
program(1.0)
[buildInfo = dict<tensor<string, []>, tensor<string, []>>({{"coremlc-component-MIL", "3605.1.1"}, {"coremlc-version", "3600.25.1"}, {"coremltools-component-torch", "2.15.0"}, {"coremltools-source-dialect", "TorchScript"}, {"coremltools-version", "9.0"}})]
{
func main<ios17>(tensor<fp16, [1, 1, 640]> c, tensor<fp16, [1, 1, 640]> h, tensor<int32, [1, 1]> token) {
tensor<int32, []> input_3_batch_dims_0 = const()[name = tensor<string, []>("input_3_batch_dims_0"), val = tensor<int32, []>(0)];
tensor<bool, []> input_3_validate_indices_0 = const()[name = tensor<string, []>("input_3_validate_indices_0"), val = tensor<bool, []>(false)];
tensor<fp16, [641, 640]> embed_weight_to_fp16 = const()[name = tensor<string, []>("embed_weight_to_fp16"), val = tensor<fp16, [641, 640]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(64)))];
tensor<string, []> token_to_int16_dtype_0 = const()[name = tensor<string, []>("token_to_int16_dtype_0"), val = tensor<string, []>("int16")];
tensor<string, []> cast_7_dtype_0 = const()[name = tensor<string, []>("cast_7_dtype_0"), val = tensor<string, []>("int32")];
tensor<int32, []> greater_equal_0_y_0 = const()[name = tensor<string, []>("greater_equal_0_y_0"), val = tensor<int32, []>(0)];
tensor<int16, [1, 1]> token_to_int16 = cast(dtype = token_to_int16_dtype_0, x = token)[name = tensor<string, []>("cast_10")];
tensor<int32, [1, 1]> cast_7 = cast(dtype = cast_7_dtype_0, x = token_to_int16)[name = tensor<string, []>("cast_9")];
tensor<bool, [1, 1]> greater_equal_0 = greater_equal(x = cast_7, y = greater_equal_0_y_0)[name = tensor<string, []>("greater_equal_0")];
tensor<int32, []> slice_by_index_0 = const()[name = tensor<string, []>("slice_by_index_0"), val = tensor<int32, []>(641)];
tensor<int32, [1, 1]> add_1 = add(x = cast_7, y = slice_by_index_0)[name = tensor<string, []>("add_1")];
tensor<int32, [1, 1]> select_0 = select(a = cast_7, b = add_1, cond = greater_equal_0)[name = tensor<string, []>("select_0")];
tensor<int32, []> input_3_cast_fp16_cast_uint16_axis_0 = const()[name = tensor<string, []>("input_3_cast_fp16_cast_uint16_axis_0"), val = tensor<int32, []>(0)];
tensor<string, []> select_0_to_int16_dtype_0 = const()[name = tensor<string, []>("select_0_to_int16_dtype_0"), val = tensor<string, []>("int16")];
tensor<int16, [1, 1]> select_0_to_int16 = cast(dtype = select_0_to_int16_dtype_0, x = select_0)[name = tensor<string, []>("cast_8")];
tensor<fp16, [1, 1, 640]> input_3_cast_fp16_cast_uint16_cast_uint16 = gather(axis = input_3_cast_fp16_cast_uint16_axis_0, batch_dims = input_3_batch_dims_0, indices = select_0_to_int16, validate_indices = input_3_validate_indices_0, x = embed_weight_to_fp16)[name = tensor<string, []>("input_3_cast_fp16_cast_uint16_cast_uint16")];
tensor<int32, [3]> input_3_batch_first_transpose_perm_0 = const()[name = tensor<string, []>("input_3_batch_first_transpose_perm_0"), val = tensor<int32, [3]>([1, 0, 2])];
tensor<int32, [1]> g_batch_first_lstm_h0_squeeze_axes_0 = const()[name = tensor<string, []>("g_batch_first_lstm_h0_squeeze_axes_0"), val = tensor<int32, [1]>([0])];
tensor<fp16, [1, 640]> g_batch_first_lstm_h0_squeeze_cast_fp16 = squeeze(axes = g_batch_first_lstm_h0_squeeze_axes_0, x = h)[name = tensor<string, []>("g_batch_first_lstm_h0_squeeze_cast_fp16")];
tensor<int32, [1]> g_batch_first_lstm_c0_squeeze_axes_0 = const()[name = tensor<string, []>("g_batch_first_lstm_c0_squeeze_axes_0"), val = tensor<int32, [1]>([0])];
tensor<fp16, [1, 640]> g_batch_first_lstm_c0_squeeze_cast_fp16 = squeeze(axes = g_batch_first_lstm_c0_squeeze_axes_0, x = c)[name = tensor<string, []>("g_batch_first_lstm_c0_squeeze_cast_fp16")];
tensor<string, []> g_batch_first_direction_0 = const()[name = tensor<string, []>("g_batch_first_direction_0"), val = tensor<string, []>("forward")];
tensor<bool, []> g_batch_first_output_sequence_0 = const()[name = tensor<string, []>("g_batch_first_output_sequence_0"), val = tensor<bool, []>(true)];
tensor<string, []> g_batch_first_recurrent_activation_0 = const()[name = tensor<string, []>("g_batch_first_recurrent_activation_0"), val = tensor<string, []>("sigmoid")];
tensor<string, []> g_batch_first_cell_activation_0 = const()[name = tensor<string, []>("g_batch_first_cell_activation_0"), val = tensor<string, []>("tanh")];
tensor<string, []> g_batch_first_activation_0 = const()[name = tensor<string, []>("g_batch_first_activation_0"), val = tensor<string, []>("tanh")];
tensor<fp16, [2560, 640]> concat_1_to_fp16 = const()[name = tensor<string, []>("concat_1_to_fp16"), val = tensor<fp16, [2560, 640]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(820608)))];
tensor<fp16, [2560, 640]> concat_2_to_fp16 = const()[name = tensor<string, []>("concat_2_to_fp16"), val = tensor<fp16, [2560, 640]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(4097472)))];
tensor<fp16, [2560]> concat_0_to_fp16 = const()[name = tensor<string, []>("concat_0_to_fp16"), val = tensor<fp16, [2560]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(7374336)))];
tensor<fp16, [1, 1, 640]> input_3_batch_first_transpose_cast_fp16 = transpose(perm = input_3_batch_first_transpose_perm_0, x = input_3_cast_fp16_cast_uint16_cast_uint16)[name = tensor<string, []>("transpose_1")];
tensor<fp16, [1, 1, 640]> g_batch_first_cast_fp16_0, tensor<fp16, [1, 640]> g_batch_first_cast_fp16_1, tensor<fp16, [1, 640]> g_batch_first_cast_fp16_2 = lstm(activation = g_batch_first_activation_0, bias = concat_0_to_fp16, cell_activation = g_batch_first_cell_activation_0, direction = g_batch_first_direction_0, initial_c = g_batch_first_lstm_c0_squeeze_cast_fp16, initial_h = g_batch_first_lstm_h0_squeeze_cast_fp16, output_sequence = g_batch_first_output_sequence_0, recurrent_activation = g_batch_first_recurrent_activation_0, weight_hh = concat_2_to_fp16, weight_ih = concat_1_to_fp16, x = input_3_batch_first_transpose_cast_fp16)[name = tensor<string, []>("g_batch_first_cast_fp16")];
tensor<int32, [3]> g_perm_0 = const()[name = tensor<string, []>("g_perm_0"), val = tensor<int32, [3]>([1, 0, 2])];
tensor<int32, [1]> var_27_axes_0 = const()[name = tensor<string, []>("op_27_axes_0"), val = tensor<int32, [1]>([0])];
tensor<fp16, [1, 1, 640]> h_out = expand_dims(axes = var_27_axes_0, x = g_batch_first_cast_fp16_1)[name = tensor<string, []>("op_27_cast_fp16")];
tensor<int32, [1]> var_28_axes_0 = const()[name = tensor<string, []>("op_28_axes_0"), val = tensor<int32, [1]>([0])];
tensor<fp16, [1, 1, 640]> c_out = expand_dims(axes = var_28_axes_0, x = g_batch_first_cast_fp16_2)[name = tensor<string, []>("op_28_cast_fp16")];
tensor<int32, [2]> var_35 = const()[name = tensor<string, []>("op_35"), val = tensor<int32, [2]>([1, 640])];
tensor<fp16, [1, 1, 640]> g_cast_fp16 = transpose(perm = g_perm_0, x = g_batch_first_cast_fp16_0)[name = tensor<string, []>("transpose_0")];
tensor<fp16, [1, 640]> input_cast_fp16 = reshape(shape = var_35, x = g_cast_fp16)[name = tensor<string, []>("input_cast_fp16")];
tensor<fp16, [640, 640]> pred_proj_weight_to_fp16 = const()[name = tensor<string, []>("pred_proj_weight_to_fp16"), val = tensor<fp16, [640, 640]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(7379520)))];
tensor<fp16, [640]> pred_proj_bias_to_fp16 = const()[name = tensor<string, []>("pred_proj_bias_to_fp16"), val = tensor<fp16, [640]>(BLOBFILE(path = tensor<string, []>("@model_path/weights/weight.bin"), offset = tensor<uint64, []>(8198784)))];
tensor<fp16, [1, 640]> g = linear(bias = pred_proj_bias_to_fp16, weight = pred_proj_weight_to_fp16, x = input_cast_fp16)[name = tensor<string, []>("linear_0_cast_fp16")];
} -> (g, h_out, c_out);
}