title: How to define a custom keras layer with boolean argument in it's call method?
body: <p>I am new to TensorFlow. I am trying to use a new block in ResNet. Assume that we want to control its behavior with a flag (called 'first_round') other than 'training' flag. The call function of this block is something like this:</p>
  
  <pre><code>class my_block(tf.keras.layers.Layers):
  .
  .
  .
  def call(input_tensor1, input_tensor2, training=True, first_round=False):
  if first round:
  # Do this.
  else:
  # Do sth else.
  </code></pre>
  
  <p>Now I want to put this block in my ResNet, and I want to use a helper function that produces smaller blocks. It should take an input tensor which has the type 'tf.keras.layers.Input' and constructs a small block containing my_block and ReLU. After reading Keras tutorials, I found that I should use tf.keras.layers.Input to define inputs of a keras layer, but I do not know how to define an input for the boolean argument. The code should be something like as following:</p>
  
  <pre><code>def create_block(input_tensor):  # for example: input_tensor=tf.keras.layers.Input(shape=(32, 32, 3))
  input_tensor1 = tf.keras.layers.Input(shape=input_tensor.shape)
  input_tensor2 = tf.keras.layers.Input(shape=input_tensor.shape)
  # ?? first_round = tf.keras.layers.Input(dtype=bool)
  
  x = my_block()(input_tensor1, input_tensor2, first_round=first_round)
  x = tf.keras.layers.Activation('relu')(x)
  return keras.Model(inputs=[input_tensor1, input_tensor2, first_round], outputs=[x])
  </code></pre>
  
  <p>I could not find out how to do the commented line. Is there any specific way to define a boolean input for a keras layer?</p>