Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/qttorch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..4cd88ea
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,16 @@
+require 'qt'
+require 'torch'
+require 'libqttorch'
+
+qt.QImage.fromTensor = function(tensor, scale)
+ return tensor.qttorch.QImageFromTensor(tensor, scale)
+ end
+
+qt.QImage.toTensor = function(self, tensor, scale)
+ if type(tensor) == 'userdata' then
+ return tensor.qttorch.QImageToTensor(self, tensor, scale)
+ else
+ local t = torch.getmetatable(torch.getdefaulttensortype())
+ return t.qttorch.QImageToTensor(self, tensor, scale)
+ end
+ end