Comments (3)
Right, this functionality currently isn't implemented.
It'll certainly be possible to implement a Scan-like Op (in fact, I've implemented something similar before).
But I think it'll take some thought to figure out what's the right way to do it here.
Theano's scan
doesn't have the friendliest syntax, and the Scan
code is very intricate, suggesting that it might not be exactly the right abstraction.
Unfortunately, the switch
method you suggested won't currently work--if you write a Switch
Op
, both of its operands will be evaluated.
I think the right solution to this problem is to have some mechanism for branching/looping that gets built into the "execution graph" -- the final data structure used to perform the computation.
The other temporary solution, which would work, is to make careful use of "masks", which zero out some components of the data or recurrent state and allow you train on variable-length inputs in batch form.
AFAIK most high-performance RNN code uses this sort of scheme.
Edit: using switch would work (though there's overhead), you'd just have to clip the index so you don't get an out of bounds error. The folowing hacky solution almost works (one just needs to implement maximum
output = (X.shape[0]<=t) * make_step(X[cgt.maximum(t, X.shape[0]-1)], output) + (X.shape[0]>t) * output
from cgt.
Thanks. is it possible to implement a lazy IfElse
op in cgt
?
from cgt.
Not yet, because of how the graph execution works. I'm going to open up an issue for further discussion on this topic -- @hojonathanho and I have discussed it a bit.
from cgt.
Related Issues (20)
- Product of diagonal elements may be `nan` HOT 1
- cgt.stack only supports stacking scalars HOT 1
- Error on tutorial
- Bug in graph simplification HOT 2
- OSX: Build fails with OpenBLAS dependency HOT 1
- Questions about Installation : cmake and windows HOT 1
- Memory consumption of native backend on Linux
- Random number generation and graph simplification HOT 2
- Negative reshaping check not enforced sometimes HOT 1
- Parameter indexing leads to an assertion error in module definition HOT 1
- Issues with shared scalar HOT 2
- Random number generation and modules (and simplification again)
- CIFAR Demo Error when using GPU
- Installation with anaconda
- Support for square root operation on Node HOT 2
- Simple operation breaks CGT
- Berkely BidMach and CGT
- How to build with python 3?
- Any reference to read? HOT 1
- Links in read-me are dead
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cgt.