Skip to content

Commit

Permalink
added tensorflow.keras layers
Browse files Browse the repository at this point in the history
  • Loading branch information
beasteers committed Sep 25, 2019
1 parent 18d3d84 commit ff649ff
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pumpp/feature/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ def layers(self, api='keras'):
field keys.
'''

if api == 'keras':
if api in ('k', 'keras'):
return self.layers_keras()
elif api in ('tf.keras', 'tensorflow.keras', 'tfk'):
return self.layers_tfkeras()
elif api in ('tf', 'tensorflow'):
return self.layers_tensorflow()
else:
Expand All @@ -144,6 +146,17 @@ def layers_keras(self):

return L

def layers_tfkeras(self):
from tensorflow.keras.layers import Input

L = dict()
for key in self.fields:
L[key] = Input(name=key,
shape=self.fields[key].shape,
dtype=np.dtype(self.fields[key].dtype).name)

return L

def n_frames(self, duration):
'''Get the number of frames for a given duration
Expand Down

0 comments on commit ff649ff

Please sign in to comment.