SHARE
TWEET

Untitled

a guest Jun 25th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def _encoder(self):
  2.     inputs = Input(shape=(self.x[0].shape))
  3.     #keras.layers.BatchNormalization()
  4.     encoded = Dense(self.encoding_dim, activation='relu')(inputs)
  5.     model = Model(inputs, encoded)
  6.     self.encoder = model
  7.     return model
  8.      
  9. def _decoder(self):
  10.     inputs = Input(shape=(self.encoding_dim,))
  11.     decoded = Dense(self.x[0].shape)(inputs)
  12.     model = Model(inputs, decoded)
  13.     self.decoder = model
  14.     return model
  15.      
  16. File "<ipython-input-5-c3e9cae855b1>", line 138, in <module>
  17.     ae.encoder_decoder()
  18.  
  19.   File "<ipython-input-5-c3e9cae855b1>", line 106, in encoder_decoder
  20.     dc = self._decoder()
  21.  
  22.   File "<ipython-input-5-c3e9cae855b1>", line 99, in _decoder
  23.     decoded = Dense(self.x[0].shape)(inputs)
  24.  
  25.   File "/home/nerp/miniconda3/lib/python3.6/site-packages/keras/engine/base_layer.py", line 431, in __call__
  26.     self.build(unpack_singleton(input_shapes))
  27.  
  28.   File "/home/nerp/miniconda3/lib/python3.6/site-packages/keras/layers/core.py", line 866, in build
  29.     constraint=self.kernel_constraint)
  30.  
  31.   File "/home/nerp/miniconda3/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
  32.     return func(*args, **kwargs)
  33.  
  34.   File "/home/nerp/miniconda3/lib/python3.6/site-packages/keras/engine/base_layer.py", line 249, in add_weight
  35.     weight = K.variable(initializer(shape),
  36.  
  37.   File "/home/nerp/miniconda3/lib/python3.6/site-packages/keras/initializers.py", line 209, in __call__
  38.     scale /= max(1., float(fan_in + fan_out) / 2)
  39.  
  40. TypeError: unsupported operand type(s) for +: 'int' and 'tuple'
  41.      
  42. def encoder_decoder(self):
  43.     ec = self._encoder()
  44.     dc = self._decoder()
  45.  
  46.     inputs = Input(shape=self.x[0].shape)
  47.     ec_out = ec(inputs)
  48.     dc_out = dc(ec_out)
  49.     model = Model(inputs, dc_out)
  50.  
  51.     self.model = model
  52.     return model
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top