-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
13 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
from __future__ import division, print_function | ||
|
||
|
||
import numpy as np | ||
from keras.engine import Input | ||
from keras.engine import Model | ||
from keras.layers import TimeDistributed | ||
from extkeras.layers.recurrent import PhasedLSTMCellMask | ||
|
||
n_samples = 3 | ||
sequence_length = 10 | ||
units = 4 | ||
n_timesteps = 10 | ||
n_units = 4 | ||
|
||
time = Input((sequence_length, 1)) | ||
time = Input((n_timesteps, 1)) | ||
|
||
cell_mask_layer = TimeDistributed(PhasedLSTMCellMask(units)) | ||
cell_mask_layer = TimeDistributed(PhasedLSTMCellMask(n_units)) | ||
cell_mask = cell_mask_layer(time) | ||
model = Model(inputs=time, outputs=cell_mask) | ||
|
||
model = Model( | ||
inputs=time, | ||
outputs=cell_mask | ||
) | ||
|
||
time_arr = np.arange(sequence_length).reshape((1, -1, 1)).repeat(n_samples, axis=0) | ||
time_arr = np.arange(n_timesteps).reshape((1, -1, 1)).repeat(n_samples, axis=0) | ||
mask = model.predict(time_arr) | ||
|
||
# TODO add plot of mask! |