Comments (1)
Found the issue, so I'll just leave it here in case any poor soul has to deal with same issue:
dynet stores it's weights [HIDDEN,INPUT]
and keras stores it [INPUT,HIDDEN]
and the order of weights are different dynet is i, f, o, c
and keras is i, f, c, o
so the code to fix it is:
W_i = W[:units, :]
W_f = W[units: units * 2, :]
W_o = W[units * 2: units * 3, :]
W_c = W[units * 3:, :]
U_i = U[:units, :]
U_f = U[units: units * 2, :]
U_o = U[units * 2: units * 3, :]
U_c = U[units * 3:, :]
b_i = b[:units]
b_f = b[units: units * 2]
b_o = b[units * 2: units * 3]
b_c = b[units * 3:]
def into_keras(i, f, c, o):
d = [i, f, c, o]
return np.transpose(np.concatenate(d,axis=0))
fworbw.append({
'W': into_keras(W_i, W_f, W_c, W_o),
'U': into_keras(U_i, U_f, U_c, U_o),
'b': into_keras(b_i, b_f, b_c, b_o),
})
from dynet.
Related Issues (20)
- Mistaken - please delete
- Eigen for dynet v1.1 HOT 1
- Published Documentation is Outdated
- When using mini-batch, there is a potential risk of future information leakage
- error: Could not download Eigen from 'https://bitbucket.org/eigen/eigen/get/2355b229ea4c.zip' HOT 2
- How does it run on an M1 Mac? HOT 1
- Variable sized inputs
- Add support to release Linux aarch64 wheels
- Compatible versions of Eigen and Dynet for Cuda 11.1 HOT 6
- Cannot pip install dynet. Help!
- does DyNet help in rewiring analysis?
- Unable to build wheel for dynet installation (python 3.9)
- Unable to build wheel for dynet on Windows (pip install dynet) HOT 3
- Dynet GPU installation failure on Amazon Linux instances
- make: *** No targets specified and no makefile found.
- while releasing: ValueError: underlying buffer has been detached
- error: [Errno 2] No such file or directory: 'LICENSE.txt' HOT 4
- Inconsistencies between hand-calculated gradients and machine-calculated
- Is dynet supported anymore? Should users move to an alternative? HOT 1
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 dynet.