@@ -445,7 +445,7 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
445
445
lo = float (lo ) * freq_scale
446
446
hi = float (hi ) * freq_scale
447
447
nyquist = audio_tic_rate / 2
448
- nfreqs = x .get_shape (). as_list () [2 ]
448
+ nfreqs = x .shape [2 ]
449
449
x = Slice ([0 , 0 , round (nfreqs * lo / nyquist ), 0 ],
450
450
[- 1 , - 1 , round (nfreqs * (hi - lo ) / nyquist ), - 1 ])(x )
451
451
hidden_layers .append (x )
@@ -454,7 +454,7 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
454
454
x = MelCepstrum (window_tics , stride_tics , audio_tic_rate ,
455
455
int (filterbank_nchannels ), int (dct_ncoefficients ))(x )
456
456
hidden_layers .append (x )
457
- x_shape = x .get_shape (). as_list ()
457
+ x_shape = x .shape
458
458
459
459
receptive_field = [1 ,1 ]
460
460
sum_of_strides = [0 ,0 ]
@@ -478,8 +478,8 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
478
478
sum_of_strides [0 ] += strides [0 ] - 1
479
479
sum_of_strides [1 ] += strides [1 ] - 1
480
480
if use_residual and iconv % 2 == 0 and iconv > 1 :
481
- bypass_shape = bypass .get_shape (). as_list ()
482
- conv_shape = conv .get_shape (). as_list ()
481
+ bypass_shape = bypass .shape
482
+ conv_shape = conv .shape
483
483
if bypass_shape [3 ]== conv_shape [3 ]:
484
484
hoffset = (bypass_shape [1 ] - conv_shape [1 ]) // 2
485
485
woffset = (bypass_shape [2 ] - conv_shape [2 ]) // 2
@@ -491,7 +491,7 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
491
491
x = ReLU ()(conv )
492
492
if normalize_after :
493
493
x = BatchNormalization ()(x )
494
- x_shape = x .get_shape (). as_list ()
494
+ x_shape = x .shape
495
495
noutput_tics = math .ceil ((noutput_tics - dilated_kernel_size [0 ] + 1 ) / strides [0 ])
496
496
iconv += 1
497
497
dilation_rate = dilation (iconv + 1 , dilate_time , dilate_freq )
@@ -510,8 +510,8 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
510
510
receptive_field [0 ] += (dilated_kernel_size - 1 ) * 2 ** sum_of_strides [0 ]
511
511
sum_of_strides [0 ] += strides [0 ] - 1
512
512
if use_residual and iconv % 2 == 0 and iconv > 1 :
513
- bypass_shape = bypass .get_shape (). as_list ()
514
- conv_shape = conv .get_shape (). as_list ()
513
+ bypass_shape = bypass .shape
514
+ conv_shape = conv .shape
515
515
if bypass_shape [2 ]== conv_shape [2 ] and bypass_shape [3 ]== conv_shape [3 ]:
516
516
offset = (bypass_shape [1 ] - conv_shape [1 ]) // 2
517
517
conv = Add ()([conv , Slice ([0 ,offset ,0 ,0 ],[- 1 ,conv_shape [1 ],- 1 ,- 1 ])(bypass )])
@@ -521,7 +521,7 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
521
521
x = ReLU ()(conv )
522
522
if normalize_after :
523
523
x = BatchNormalization ()(x )
524
- x_shape = x .get_shape (). as_list ()
524
+ x_shape = x .shape
525
525
noutput_tics = math .ceil ((noutput_tics - dilated_kernel_size + 1 ) / strides [0 ])
526
526
iconv += 1
527
527
dilation_rate = dilation (iconv + 1 , dilate_time , dilate_freq )
@@ -539,7 +539,7 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
539
539
540
540
if pool_kind :
541
541
x = pool_kind (pool_size = pool_size , strides = pool_size )(x )
542
- x_shape = x .get_shape (). as_list ()
542
+ x_shape = x .shape
543
543
noutput_tics = math .floor (noutput_tics / pool_size [0 ])
544
544
545
545
# final dense layers (or actually, pan-freq pan-time 2D convs)
@@ -550,7 +550,7 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
550
550
x = Dropout (dropout )(x )
551
551
x = Conv2D (nunits , (noutput_tics if idense == 0 else 1 , x_shape [2 ]))(x )
552
552
hidden_layers .append (conv )
553
- x_shape = x .get_shape (). as_list ()
553
+ x_shape = x .shape
554
554
555
555
final = Reshape ((- 1 ,model_settings ['nlabels' ]))(x )
556
556
0 commit comments