-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.py
40 lines (33 loc) · 1.09 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 10 15:29:18 2019
@author: quinn
"""
import keras.backend as K
from keras.models import Sequential
from keras.layers import Conv1D, MaxPool1D, AvgPool1D, UpSampling1D
#from numpy.random import normal
from main import convert_model
def gen_test_model_1d(input_shape=(None,5)):
m = Sequential()
m.add(Conv1D(4, 8, padding='same', input_shape=input_shape, activation='relu'))
m.add(MaxPool1D(2, padding='same'))
m.add(Conv1D(4, 8, padding='same', activation='tanh'))
m.add(UpSampling1D(2))
m.add(Conv1D(4, 8, padding='same', activation='sigmoid'))
m.compile('SGD','mse')
return m
if __name__=='__main__':
import tempfile
shape = (100,4)
batch_shape = (100,)+shape
m = gen_test_model_1d(shape)
# a, b = normal(0, 1, batch_shape), normal(0, 1, batch_shape)
# path = tempfile.gettempdir()
path = './tmp/'
m.save(path+'/__test_1d.h5')
convert_model(path+'/__test_1d.h5',
name='__test_1d_model',
path=path,
verbose=False)