You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* the C library methods are defined in the torch library in torch7 repo, in two files:
121
-
* lib/TH/generic/THTensor.h
122
-
* lib/TH/generic/THStorage.h
123
-
* simply copy the appropriate declaration into [PyTorch.jinja2.pyx](src/PyTorch.jinja2.pyx), in the blocks that start `cdef extern from "THStorage.h":` or `cdef extern from "THTensor.h":`, as appropriate
124
-
* note that this is a template file. The generated Cython .pyx file is [PyTorch.pyx](src/PyTorch.pyx)
125
-
* and add an appropriate method into {{Real}}Storage class, or {{Real}}Tensor class
126
-
* that's it :-)
103
+
* The test scripts: [test](test)
104
+
* The test output: [tests_output.txt](test_outputs/tests_output.txt)
127
105
128
-
You can have a look eg at the `narrow` method as an example
106
+
# Python 2 vs Python 3?
129
107
130
-
Updates:
131
-
* the cython class is now called eg `_{{Real}}Tensor` instead of `{{Real}}Tensor`. Then we create a pure Python class called `{{Real}}Tensor` around this, by inheriting from `_{{Real}}Tensor`, and providing no additional methods or properties. The pure Python class is monkey-patchable, eg by [PyClTorch](https://github.com/hughperkins/pycltorch)
132
-
* the `cdef` properties and methods are now declared in [PyTorch.jinja2.pxd](src/PyTorch.jinja2.pxd). This means we can call these methods and properties from [PyClTorch](https://github.com/hughperkins/pycltorch)
133
-
* note that [PyTorch.jinja2.pxd](src/PyTorch.jinja2.pxd) is a template file. The generated Cython .pxd file is [PyTorch.pxd](src/PyTorch.pxd)
134
-
* the `THGenerator *` object is now available, at `globalState.generator`, and used by the various random methods, eg `_FloatTensor.bernoulli()`
108
+
- pytorch is developed and maintained on python 3
109
+
- you should be able to use it with python 2, as long as you include the following at the top of your scripts:
This has been simplified a bunch since before. We no longer try to wrap C++ classes around the lua, but just directly wrap Python classes around the Lua. The class methods and attributes are mostly generated dynamically, according to the results of querying hte lua ones. Mostly all we have to do is create classes with appropriate names, that derive from LuaClass. We might need to handle inheritance somehow in the future. At the moment, this is all handled really by PyTorchAug.py.
118
+
# Versioning
119
+
120
+
[semantic versioning](http://semver.org/)
139
121
140
122
# Related projects
141
123
@@ -144,6 +126,11 @@ This has been simplified a bunch since before. We no longer try to wrap C++ cla
144
126
145
127
# Recent news
146
128
129
+
26th February:
130
+
* modified `/` to be the div operation for float and double tensors, and `//` for int-type tensors, such as
131
+
byte, long, int
132
+
* since the div change is incompatible with 1.0.0 div operators, jumping radically from `1.0.0` to `2.0.0-SNAPSHOT` ...
* the C library methods are defined in the torch library in torch7 repo, in two files:
8
+
* lib/TH/generic/THTensor.h
9
+
* lib/TH/generic/THStorage.h
10
+
* simply copy the appropriate declaration into [PyTorch.jinja2.pyx](src/PyTorch.jinja2.pyx), in the blocks that start `cdef extern from "THStorage.h":` or `cdef extern from "THTensor.h":`, as appropriate
11
+
* note that this is a template file. The generated Cython .pyx file is [PyTorch.pyx](src/PyTorch.pyx)
12
+
* and add an appropriate method into {{Real}}Storage class, or {{Real}}Tensor class
13
+
* that's it :-)
14
+
15
+
You can have a look eg at the `narrow` method as an example
16
+
17
+
Updates:
18
+
* the cython class is now called eg `_{{Real}}Tensor` instead of `{{Real}}Tensor`. Then we create a pure Python class called `{{Real}}Tensor` around this, by inheriting from `_{{Real}}Tensor`, and providing no additional methods or properties. The pure Python class is monkey-patchable, eg by [PyClTorch](https://github.com/hughperkins/pycltorch)
19
+
* the `cdef` properties and methods are now declared in [PyTorch.jinja2.pxd](src/PyTorch.jinja2.pxd). This means we can call these methods and properties from [PyClTorch](https://github.com/hughperkins/pycltorch)
20
+
* note that [PyTorch.jinja2.pxd](src/PyTorch.jinja2.pxd) is a template file. The generated Cython .pxd file is [PyTorch.pxd](src/PyTorch.pxd)
21
+
* the `THGenerator *` object is now available, at `globalState.generator`, and used by the various random methods, eg `_FloatTensor.bernoulli()`
22
+
23
+
### pynn
24
+
25
+
This has been simplified a bunch since before. We no longer try to wrap C++ classes around the lua, but just directly wrap Python classes around the Lua. The class methods and attributes are mostly generated dynamically, according to the results of querying hte lua ones. Mostly all we have to do is create classes with appropriate names, that derive from LuaClass. We might need to handle inheritance somehow in the future. At the moment, this is all handled really by PyTorchAug.py.
0 commit comments