aboutsummaryrefslogtreecommitdiff
path: root/layer/affine.lua
diff options
context:
space:
mode:
Diffstat (limited to 'layer/affine.lua')
-rw-r--r--layer/affine.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/layer/affine.lua b/layer/affine.lua
new file mode 100644
index 0000000..d5c50fc
--- /dev/null
+++ b/layer/affine.lua
@@ -0,0 +1,11 @@
+local LinearTransParam = nerv.class('nerv.LinearTransParam', 'nerv.Param')
+local BiasParam = nerv.class('nerv.BiasParam', 'nerv.LinearTransParam')
+local AffineLayer = nerv.class('nerv.AffineLayer', 'nerv.Layer')
+
+function LinearTransParam:read(pcdata)
+ self.trans = nerv.CuMatrixFloat.new_from_host(nerv.MMatrixFloat.load(pcdata))
+end
+
+function LinearTransParam:write(pfhandle)
+ self.trans:new_to_host():save(pfhandle)
+end