Extracts the state spec from a layer.

layer The layer to extract from; can be a Network.

The state spec.

TypeError If layer is a subclass of tf.keras.layers.RNN (it must be wrapped by an RNNWrapper object).
ValueError If layer is a Keras layer and create_variables has not been called on it.