gdb nnet3-compute测试命令

$ matrix-dim 'scp: head -n 1 data/test/feats.scp|'

~/kaldi/src/bin/matrix-dim 'scp: head -n 1 data/test/feats.scp|'

foo 20560 39

$ nnet3-compute --frame_subsampling-factor=3 exp/chain/tuning/tdnn_c/final.mdl 'scp:

head -n 1 data/test/feats.scp|' ark:-|matrix

-dim ark:-

foo 6854 1808

 
 

void DecodableNnetSimple::EnsureFrameIsComputed(int32 subsampled_frame)

gdb_cmd=$(mktemp XXXX.gdb)

cat <<EOF > $gdb_cmd

set pagination off

set logging redirect on

set logging overwrite on

set logging file ./nnet3-compute.log

set logging on

b kaldi::nnet3::DecodableNnetSimple::EnsureFrameIsComputed

commands

printf "subsampled_frame=%d", subsampled_frame

c

end

run

quit

EOF

gdb -x $gdb_cmd --args nnet3-compute --frame_subsampling-factor=3 exp/chain/tuning/tdnn_c/final.mdl 'scp: head -n 1 data/test/feats.scp|' ark:/dev/null

 
 

grep '^subsampled_frame' ./nnet3-compute.log

subsampled_frame=0

subsampled_frame=17

subsampled_frame=34

subsampled_frame=51

subsampled_frame=68[Thread 0x7fffe29ff700 (LWP 984) exited]

 
 

帧)的第一帧

且EnsureFrameIsComputed函数一次计算一个chunk

监视DoNnetComputation函数的参数

 
 

gdb_cmd=$(mktemp XXXX.gdb)

cat <<EOF > $gdb_cmd

set pagination off

set logging redirect on

set logging overwrite on

set logging file ./nnet3-compute.log

set logging on

b kaldi::nnet3::DecodableNnetSimple::DoNnetComputation

commands

printf "input_t_start=%d,output_t_start=%d", input_t_start, output_t_start

c

end

run

quit

EOF

gdb -x $gdb_cmd --args nnet3-compute --frame_subsampling-factor=3 exp/chain/tuning/tdnn_c/final.mdl 'scp: head -n 1 data/test/feats.scp|' ark:/dev/null

grep '^input_t_start' ./nnet3-compute.log

input_t_start=-23,output_t_start=0

input_t_start=28,output_t_start=51

input_t_start=79,output_t_start=102

input_t_start=130,output_t_start=153

...

input_t_start=20428,output_t_start=20451

input_t_start=20479,output_t_start=20502

input_t_start=20530,output_t_start=20553[Thread 0x7fffe29ff700 (LWP 7120) exited]

 
 

这说明,DoNnetComputation函数的:

  1. 参数input_t_start表示当前chunk输出第一帧所依赖的输入帧中第一帧的索引(即当前帧的索引

    左上文);
  2. 参数output_t_start表示当前chunk输出第一帧所对应的输入帧的索引;

 
 

监视kaldi::nnet3::NnetComputer::ExecuteCommand中NnetComputation::Command &c.command_type

gdb_cmd=$(mktemp XXXX.gdb)

cat <<EOF > $gdb_cmd

set pagination off

set logging redirect on

set logging overwrite on

set logging file ./nnet3-compute.log

set logging on

b kaldi::nnet3::NnetComputer::ExecuteCommand

commands

p computation_.commands[program_counter_].command_type

c

end

run

quit

EOF

gdb -x $gdb_cmd --args nnet3-compute --frame_subsampling-factor=3 exp/chain/tuning/tdnn_c/final.mdl 'scp: head -n 1 data/test/feats.scp|' ark:/dev/null

 
 

grep '^\$' ./nnet3-compute.log

 
 

command_typed的规律

$ sed -n '/^\$/s/.* //p' ./nnet3-compute.log | less

kaldi::nnet3::kNoOperationPermanent * 1

kaldi::nnet3::kAllocMatrix * 8

kaldi::nnet3::kCopyRows * 5

kaldi::nnet3::kDeallocMatrix * 8

kaldi::nnet3::kPropagate * 19

...

kaldi::nnet3::kNoOperationPermanent * 1

kaldi::nnet3::kAllocMatrix * 8

kaldi::nnet3::kCopyRows * 5

kaldi::nnet3::kDeallocMatrix * 8

kaldi::nnet3::kPropagate * 19

 
 

各个运算的次数

$ sed -n '/^\$/s/.* //p' ./nnet3-compute.log | perl -e 'my %hash;while (<>){chomp;$ha

sh{$_}+=1;}for $i (keys %hash){printf("%s %d\n", $i, $hash{$i})}'

kaldi::nnet3::kCopyRows 2020

kaldi::nnet3::kPropagate 7676

kaldi::nnet3::kDeallocMatrix 3234

kaldi::nnet3::kAllocMatrix 3234

kaldi::nnet3::kNoOperationPermanent 404

kaldi::nnet3::kMatrixCopy 3234

 
 

  • kaldi::nnet3::kCopyRows

    发生在以下组件结点中:

    component-node name=tdnn1.affine component=tdnn1.affine input=Append(Offset(input, -2), Offset(input, -1), input, Offset(input, 1), Offset(input, 2)) input-dim=195 output-dim=256

    行特性向量,符合"kaldi::nnet3::kCopyRows * 5"。

  • kaldi::nnet3::kPropagate

    帧。这可能与TDNN对左右上下文的依赖有关。

  • kaldi::nnet3::kDeallocMatrix

    在网络中进行每一个矩阵运算之后,都需要从内存中收回对应的矩阵空间

  • kaldi::nnet3::kAllocMatrix

    在网络中进行每一个矩阵运算(NaturalGradientAffineComponent、FixedAffineComponent等)之前,都需要从模型中将矩阵拷贝到内存中。

  • kaldi::nnet3::kNoOperationPermanent

    帧,默认chunk大小为50,由于frame_subsampling_factor=3,chunk大小变为其整数倍——51。这样,整条语句的chunk数为ceil(20560/51)=404。

    这与"kaldi::nnet3::kNoOperationPermanent"的个数相匹配,这说明,每个chunk运行一次"kaldi::nnet3::kNoOperationPermanent"。

  • kaldi::nnet3::kMatrixCopy

    在网络中进行每一个矩阵运算(NaturalGradientAffineComponent、FixedAffineComponent等)之前,从预计算组件中将上一层的输出结果拷贝至当前组件中

gdb nnet3-compute的更多相关文章

  1. gdb 调试入门,大牛写的高质量指南

    引用自:http://blog.jobbole.com/107759/ gdb 调试 ncurses 全过程: 发现网上的“gdb 示例”只有命令而没有对应的输出,我有点不满意.gdb 是 GNU 调 ...

  2. gdb 调试 ncurses 全过程:

    转载地址: http://blog.jobbole.com/107759/ gdb 调试 ncurses 全过程: 发现网上的“gdb 示例”只有命令而没有对应的输出,我有点不满意.gdb 是 GNU ...

  3. Android gdb so

    gdb debug an android application 1.gdb 要有gdbserver 一般模拟器默认装有gdbserver,如2.3.3的模拟器,看一下有没有: D:\Develope ...

  4. gdb help all 帮助信息

    Command class: aliases ni -- Step one instruction rc -- Continue program being debugged but run it i ...

  5. linux应用调试技术之GDB和GDBServer

    1.调试原理 GDB调试是应用程序在开发板上运行,然后在PC机上对开发板上得应用程序进行调试,PC机运行GDB,开发板上运行GDBServer.在应用程序调试的时候,pc机上的gdb向开发板上的GDB ...

  6. 新手如何在gdb中存活

    网络上已经有很多gdb调试的文章了,为什么我还要写这篇文章呢,因为本文是写给gdb新手的,目的就是通过一个简单的例子来让新手很快上手.一旦上手入门了,其他的问题就可以自己去搜索搞定了.右边是gdb的L ...

  7. GDB 多线程调试:只停止断点的线程,其他线程任然执行; 或只运行某些线程 其他线程中断

    多线程调试之痛 调试器(如VS2008和老版GDB)往往只支持all-stop模式,调试多线程程序时,如果某个线程断在一个断点上,你的调试器会让整个程序freeze,直到你continue这个线程,程 ...

  8. GDB调试命令

    1.查看源码: list [函数名][行数] 2.暂停程序 (1)设置断点: a.break + [源代码行号][源代码函数名][内存地址] b.break ... if condition   .. ...

  9. 关于gdb和shp的FID问题

    gdb的FID从1开始,并且FID唯一,从数字化时开始,每个图形对应唯一的FID,删除图形亦删除对应的FID.FID可能出现中断的情况. shp的FID从0开始,并且永远连续.删除图形,则编号在其下面 ...

随机推荐

  1. 用addRoutes实现动态路由

    原文转自前端路上,转载请注明出处. 之前在基于Vue实现后台系统权限控制一文中提到路由权限的实现思路,因为不喜欢在每次路由跳转的before钩子里做判断,所以在初始化Vue实例前对路由做了筛选,再用实 ...

  2. Java基础系列--02_运算符和程序的语句

    运算符: (1)算术运算符: +,-,*,/,%,++,--(加.减.乘.除.取余.自增,自减) ++和--的注意事项: a:他们的作用是自增或者自减 b:使用 1.单独使用 放在操作数据的前面和后面 ...

  3. windows最简单的局部截图工具

    大家写博客的时候应该经常要用截图吧!不知道大家用的都是什么截图工具. 1.最开始我只会键盘的printscreen截图,然后去电脑,附件,画图....总之很多步骤,贼麻烦. 2.然后用电脑玩qq的时候 ...

  4. timers模块

    timers模块 var timers = require('timers'); function A() { //将A对象注册到定时器里 timers.enroll(); //进行激活,如果不激活, ...

  5. numpy科学计算库的基础用法,完美抽象多维数组(原创)

    #起别名避免重名 import numpy as np #小技巧:print从外往内看==shape从左往右看 if __name__ == "__main__": print(' ...

  6. NodeJs之word文件生成与解析

    NodeJs之word文件生成与解析 一,介绍与需求 1.1,介绍 1,officegen模块可以为Microsoft Office 2007及更高版本生成Office Open XML文件.此模块不 ...

  7. Django(八)下:Model操作和Form操作、序列化操作

    二.Form操作 一般会创建forms.py文件,单独存放form模块. Form 专门做数据验证,而且非常强大.有以下两个插件: fields :验证(肯定会用的) widgets:生成HTML(有 ...

  8. pointer-events: none

    如果为某个元素样式设置了“pointer-events: none ”,事件.连接.悬浮样式都没有了 如果为a标签设置了“pointer-events: none ”,点击a标签,不会跳转到链接地址, ...

  9. 分别使用POI和JXL导出数据到Excel

    1.使用POI 引入jar包 <!-- poi HSSF is our port of the Microsoft Excel 97(-2007) file format (BIFF8) to ...

  10. 【LUOGU???】WD与数列 sam 启发式合并

    题目大意 给你一个字符串,求有多少对不相交且相同的子串. 位置不同算多对. \(n\leq 300000\) 题解 先把后缀树建出来. DFS 整棵树,维护当前子树的 right 集合. 合并两个集合 ...