📄 cm_print_0.cc
字号:
// file: cm_print_0.cc//// isip include files//#include "create_mixtures.h"#include "create_mixtures_constants.h"// method: print_state_cc//// arguments:// FILE* fp_out_a: (input) output file pointer// State** states : (input) the new states need to be printed out// int_4 num_st : (input) the number of total states// int_4 num_feat : (input) the number of features//// return: a logical flag to indicate success//logical_1 print_state_cc(FILE* fp_out_a, Train_State** states_a, int_4 num_st_a, int_4 num_feat_a) { // output the comments // fprintf(fp_out_a, "%s\n", "# data for acoustic models --- list of all the states"); fprintf(fp_out_a, "%s\n\n", "#"); // print number of states and vector size // fprintf(fp_out_a, "feature_size = %ld\n", num_feat_a); fprintf(fp_out_a, "num_states = %ld\n", num_st_a); // output the first state // fprintf(fp_out_a, "State: 0\n"); fprintf(fp_out_a, "nummixes: 0\n\n"); int_4 num_mixture = (int_4)0; float_4* temp_weight = (float_4*)NULL; float_4* temp_scale = (float_4*)NULL; float_4** tmp_mean = (float_4**)NULL; float_4** tmp_covar = (float_4**)NULL; for (int_4 i = 1; i < num_st_a; i++) { // get the parameters // num_mixture = states_a[i]->get_num_mixtures_cc(); temp_weight = states_a[i]->get_weights_cc(); temp_scale = states_a[i]->get_scale_cc(); tmp_mean = states_a[i]->get_mean_cc(); tmp_covar = states_a[i]->get_covar_cc(); fprintf(fp_out_a, "State: %ld\n", i); fprintf(fp_out_a, "nummixes: %ld\n\n", num_mixture); for (int_4 j = 0; j < num_mixture; j++) { fprintf(fp_out_a, "%s: %ld\n", "mixture", j+1); fprintf(fp_out_a, "%s: %e\n", "mix_weight", exp(temp_weight[j])); fprintf(fp_out_a, "mean: "); for (int_4 k = 0; k < num_feat_a; k++) { fprintf(fp_out_a, "%e ", tmp_mean[j][k]); } fprintf(fp_out_a, "\n"); fprintf(fp_out_a, "covar: "); for (int_4 l = 0; l < num_feat_a; l++) { fprintf(fp_out_a, "%e ", 1.0/tmp_covar[j][l]); } fprintf(fp_out_a, "\n"); fprintf(fp_out_a, "scale: %e\n\n", temp_scale[j]); } } // free memory // temp_weight = (float_4*)NULL; temp_scale = (float_4*)NULL; tmp_mean = (float_4**)NULL; tmp_covar = (float_4**)NULL; // exit gracefully // return ISIP_TRUE;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -