@@ -445,7 +445,7 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
445445 lo = float (lo ) * freq_scale
446446 hi = float (hi ) * freq_scale
447447 nyquist = audio_tic_rate / 2
448- nfreqs = x .get_shape (). as_list () [2 ]
448+ nfreqs = x .shape [2 ]
449449 x = Slice ([0 , 0 , round (nfreqs * lo / nyquist ), 0 ],
450450 [- 1 , - 1 , round (nfreqs * (hi - lo ) / nyquist ), - 1 ])(x )
451451 hidden_layers .append (x )
@@ -454,7 +454,7 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
454454 x = MelCepstrum (window_tics , stride_tics , audio_tic_rate ,
455455 int (filterbank_nchannels ), int (dct_ncoefficients ))(x )
456456 hidden_layers .append (x )
457- x_shape = x .get_shape (). as_list ()
457+ x_shape = x .shape
458458
459459 receptive_field = [1 ,1 ]
460460 sum_of_strides = [0 ,0 ]
@@ -478,8 +478,8 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
478478 sum_of_strides [0 ] += strides [0 ] - 1
479479 sum_of_strides [1 ] += strides [1 ] - 1
480480 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
483483 if bypass_shape [3 ]== conv_shape [3 ]:
484484 hoffset = (bypass_shape [1 ] - conv_shape [1 ]) // 2
485485 woffset = (bypass_shape [2 ] - conv_shape [2 ]) // 2
@@ -491,7 +491,7 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
491491 x = ReLU ()(conv )
492492 if normalize_after :
493493 x = BatchNormalization ()(x )
494- x_shape = x .get_shape (). as_list ()
494+ x_shape = x .shape
495495 noutput_tics = math .ceil ((noutput_tics - dilated_kernel_size [0 ] + 1 ) / strides [0 ])
496496 iconv += 1
497497 dilation_rate = dilation (iconv + 1 , dilate_time , dilate_freq )
@@ -510,8 +510,8 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
510510 receptive_field [0 ] += (dilated_kernel_size - 1 ) * 2 ** sum_of_strides [0 ]
511511 sum_of_strides [0 ] += strides [0 ] - 1
512512 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
515515 if bypass_shape [2 ]== conv_shape [2 ] and bypass_shape [3 ]== conv_shape [3 ]:
516516 offset = (bypass_shape [1 ] - conv_shape [1 ]) // 2
517517 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):
521521 x = ReLU ()(conv )
522522 if normalize_after :
523523 x = BatchNormalization ()(x )
524- x_shape = x .get_shape (). as_list ()
524+ x_shape = x .shape
525525 noutput_tics = math .ceil ((noutput_tics - dilated_kernel_size + 1 ) / strides [0 ])
526526 iconv += 1
527527 dilation_rate = dilation (iconv + 1 , dilate_time , dilate_freq )
@@ -539,7 +539,7 @@ def create_model(model_settings, model_parameters, io=sys.stdout):
539539
540540 if pool_kind :
541541 x = pool_kind (pool_size = pool_size , strides = pool_size )(x )
542- x_shape = x .get_shape (). as_list ()
542+ x_shape = x .shape
543543 noutput_tics = math .floor (noutput_tics / pool_size [0 ])
544544
545545 # 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):
550550 x = Dropout (dropout )(x )
551551 x = Conv2D (nunits , (noutput_tics if idense == 0 else 1 , x_shape [2 ]))(x )
552552 hidden_layers .append (conv )
553- x_shape = x .get_shape (). as_list ()
553+ x_shape = x .shape
554554
555555 final = Reshape ((- 1 ,model_settings ['nlabels' ]))(x )
556556
0 commit comments