X = TimeDistributed(Dense(1, activation = "sigmoid"))(X)
hits the following error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-78-282d764c00ab> in <module>
24
25
---> 26 modelf_test(modelf)
<ipython-input-78-282d764c00ab> in modelf_test(target)
7 Tx = 5511
8 n_freq = 101
----> 9 model = target(input_shape = (Tx, n_freq))
10 expected_model = [['InputLayer', [(None, 5511, 101)], 0],
11 ['Conv1D', (None, 1375, 196), 297136, 'valid', 'linear', (4,), (15,), 'GlorotUniform'],
<ipython-input-77-21b8425ab930> in modelf(input_shape)
47 # Step 4: Time-distributed dense layer (≈1 line)
48 # TimeDistributed with sigmoid activation
---> 49 X = TimeDistributed(Dense(1, activation = "sigmoid"))(X)
50
51 ### END CODE HERE ###
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in __call__(self, *args, **kwargs)
924 if _in_functional_construction_mode(self, inputs, args, kwargs, input_list):
925 return self._functional_construction_call(inputs, args, kwargs,
--> 926 input_list)
927
928 # Maintains info about the `Layer.call` stack.
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _functional_construction_call(self, inputs, args, kwargs, input_list)
1096 # Build layer if applicable (if the `build` method has been
1097 # overridden).
-> 1098 self._maybe_build(inputs)
1099 cast_inputs = self._maybe_cast_inputs(inputs, input_list)
1100
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _maybe_build(self, inputs)
2641 # operations.
2642 with tf_utils.maybe_init_scope(self):
-> 2643 self.build(input_shapes) # pylint:disable=not-callable
2644 # We must set also ensure that the layer is marked as built, and the build
2645 # shape is stored since user defined build functions may not be calling
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/layers/wrappers.py in build(self, input_shape)
171 raise ValueError(
172 '`TimeDistributed` Layer should be passed an `input_shape ` '
--> 173 'with at least 3 dimensions, received: ' + str(input_shape))
174 # Don't enforce the batch or time dimension.
175 self.input_spec = InputSpec(shape=[None, None] + input_shape[2:])
ValueError: `TimeDistributed` Layer should be passed an `input_shape ` with at least 3 dimensions, received: [None, 128]