title: Tensorflow keras layers.Multiply() TypeError: 'NoneType' object is not subscriptable
body: <p>I'm a beginning on Keras. I'm trying to convert the following R script into Python</p>
  <pre><code>1 library ( keras )
  2 # we fit j =0 with feature matrix dat .X , claims dat$C1 and volumes dat$C0
  3 dat .Y &lt;- as . matrix ( dat$C1 / sqrt ( dat$C0 )) # observed responses
  4 dat .W &lt;- as . matrix ( sqrt ( dat$C0 )) # volumes used as offsets
  5 q &lt;- 20 # number of hidden neurons
  6 # definition of neural network
  7 features &lt;- layer_input ( shape = c( ncol ( dat .X )))
  8 net &lt;- features % &gt;%
  9 layer_dense ( units = q , activation = ’tanh ’) % &gt;%
  10 layer_dense ( units = 1, activation = k_exp )
  11 volumes &lt;- layer_input ( shape =c (1))
  12 offset &lt;- volumes % &gt;%
  13 layer_dense ( units = 1, activation = ’ linear ’ , use_bias = FALSE , trainable = FALSE ,weights = list ( array (1 , dim =c (1 ,1))))
  14 weights = list ( array (1 , dim =c (1 ,1))))
  15 merged &lt;- list ( net , offset ) % &gt;%
  16 layer_multiply ()
  </code></pre>
  <p>Below my script python:</p>
  <pre><code>input_shape = SelectedMatrix_Tr.shape[1]
  net = Sequential ([
      Dense(20, activation=&quot;tanh&quot;, input_shape=(input_shape,), name=&quot;hidden_layer_1&quot;),               
      Dense(1, activation=tf.keras.activations.exponential, name=&quot;output_layer&quot;) 
  ])
  
  offset =  Sequential([
      Dense(
      units=1,
      activation = 'linear', 
      input_shape=(None,1),
      #input_dim=1,
      use_bias = True, 
      trainable = False, 
     
      kernel_initializer=tf.constant_initializer(1.)
      
      )
          ])
  
  multiplied = tf.keras.layers.Multiply()([net,offset])
  </code></pre>
  <p>The error arrives at the last line of Multiply. Below the error message:</p>
  <blockquote>
  <p>TypeError                                 Traceback (most recent call
  last)  in 
  ----&gt; 1 multiplied = tf.keras.layers.Multiply()([model,offset])</p>
  <p>~\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\keras\engine\base_layer.py
  in <strong>call</strong>(self, *args, **kwargs)    1021       with
  ops.name_scope_v2(name_scope):    1022         if not self.built:
  -&gt; 1023           self._maybe_build(inputs)    1024     1025         if self._autocast:</p>
  <p>~\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\keras\engine\base_layer.py
  in _maybe_build(self, inputs)    2623         # operations.    2624<br />
  with tf_utils.maybe_init_scope(self):
  -&gt; 2625           self.build(input_shapes)  # pylint:disable=not-callable    2626       # We must set also ensure
  that the layer is marked as built, and the build    2627       # shape
  is stored since user defined build functions may not be calling</p>
  <p>~\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\keras\utils\tf_utils.py
  in wrapper(instance, input_shape)
  268     if input_shape is not None:
  269       input_shape = convert_shapes(input_shape, to_tuples=True)
  --&gt; 270     output_shape = fn(instance, input_shape)
  271     # Return shapes from <code>fn</code> as TensorShapes.
  272     if output_shape is not None:</p>
  <p>~\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\keras\layers\merge.py
  in build(self, input_shape)
  86   def build(self, input_shape):
  87     # Used purely for shape validation.
  ---&gt; 88     if not isinstance(input_shape[0], tuple):
  89       raise ValueError('A merge layer should be called on a list of inputs.')
  90     if len(input_shape) &lt; 2:</p>
  <p>TypeError: 'NoneType' object is not subscriptable</p>
  </blockquote>
  <p>Any suggestions ?</p>
  <p>Thanks !</p>