summaryrefslogtreecommitdiff
path: root/examples/tnet_preprocessing_example2.lua
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-06-03 09:42:05 +0800
committerDeterminant <[email protected]>2015-06-03 09:42:05 +0800
commit38962683e518dcbebc0cfa6c0c9c9616b25d5bd1 (patch)
treef62b9c670960004f00d0cfd860b925f487edcf9f /examples/tnet_preprocessing_example2.lua
parent0c6ca6a17f06821cd5d612f489ca6cb68c2c4d5b (diff)
add TNetReader
Diffstat (limited to 'examples/tnet_preprocessing_example2.lua')
-rw-r--r--examples/tnet_preprocessing_example2.lua68
1 files changed, 68 insertions, 0 deletions
diff --git a/examples/tnet_preprocessing_example2.lua b/examples/tnet_preprocessing_example2.lua
new file mode 100644
index 0000000..ae8d86b
--- /dev/null
+++ b/examples/tnet_preprocessing_example2.lua
@@ -0,0 +1,68 @@
+require 'speech.init'
+gconf = {mat_type = nerv.CuMatrixFloat,
+ batch_size = 158}
+param_repo = nerv.ParamRepo({"global_transf.nerv"})
+
+sublayer_repo = nerv.LayerRepo(
+ {
+ ["nerv.BiasLayer"] =
+ {
+ blayer1 = {{bias = "bias1"}, {dim_in = {429}, dim_out = {429}}},
+ blayer2 = {{bias = "bias2"}, {dim_in = {429}, dim_out = {429}}}
+ },
+ ["nerv.WindowLayer"] =
+ {
+ wlayer1 = {{window = "window1"}, {dim_in = {429}, dim_out = {429}}},
+ wlayer2 = {{window = "window2"}, {dim_in = {429}, dim_out = {429}}}
+ }
+ }, param_repo, gconf)
+
+layer_repo = nerv.LayerRepo(
+ {
+ ["nerv.DAGLayer"] =
+ {
+ main = {{}, {
+ dim_in = {429}, dim_out = {429},
+ sub_layers = sublayer_repo,
+ connections = {
+ ["<input>[1]"] = "blayer1[1]",
+ ["blayer1[1]"] = "wlayer1[1]",
+ ["wlayer1[1]"] = "blayer2[1]",
+ ["blayer2[1]"] = "wlayer2[1]",
+ ["wlayer2[1]"] = "<output>[1]"
+ }
+ }}
+ }
+ }, param_repo, gconf)
+
+reader = nerv.TNetReader({},
+ {
+ id = "main_scp",
+ scp_file = "/slfs1/users/mfy43/swb_ivec/train_bp.scp",
+ conf_file = "/slfs1/users/mfy43/swb_ivec/plp_0_d_a.conf",
+ frm_ext = 5,
+ mlfs = {
+ ref = {
+ file = "/slfs1/users/mfy43/swb_ivec/ref.mlf",
+ format = "map",
+ format_arg = "/slfs1/users/mfy43/swb_ivec/dict",
+ dir = "*/",
+ ext = "lab"
+ }
+ },
+ global_transf = layer_repo:get_layer("main")
+ })
+
+utter = reader:get_data()
+-- print(utter.main_scp)
+print(utter.ref)
+-- cf2 = nerv.ChunkFile("feat_256", "r")
+-- input = cf2:read_chunk("input", gconf)
+
+-- for i = 0, 157 - 10 do
+-- row_diff = input.trans[i] - utter.main_scp[i]
+-- for j = 0, row_diff:ncol() - 1 do
+-- nerv.utils.printf("%.8f ", row_diff[j])
+-- end
+-- nerv.utils.printf("\n")
+-- end