aboutsummaryrefslogblamecommitdiff
path: root/fastnn/io/example.lua
blob: 8808791c062685af012e829aea9613acd9a564d9 (plain) (tree)





































                                                                                          
local T =  require 'libthreads'
local C =  require 'libfastnn' 

local ExamplesRepo = nerv.class("fastnn.ExamplesRepo")
local Example = nerv.class("fastnn.Example")

fastnn.CExamplesRepo = C.CExamplesRepo
fastnn.CExample = C.CExample

function ExamplesRepo:__init(shareid)
	if nil ~= shareid then
		-- print(shareid)
		self.repo = C.CExamplesRepo(shareid, true)
		-- print(self.repo:__tostring())
	end
end	
		

function Example:PrepareData(data, global_transf, trains_id)
	local example = fastnn.CExample()
	if nil ~= data then
		for id, cm in pairs(data) do
			if trains_id[id] and nil ~= global_transf then
				local tcm = nerv.speech_utils.normalize(cm, global_transf)
				example:pushback(tcm)
			else
				example:pushback(cm)
			end

		end
	end

	return example
end