def initial_state(layer, dimensions=None):
 if (dimensions is None):
  return (layer.initial_hidden_state if has_hidden(layer) else None)
 else:
  return (matrixify(layer.initial_hidden_state, dimensions) if has_hidden(layer) else None)

def initial_state ( layer , dimensions = None ) : if ( dimensions is None ) : return ( layer . initial_hidden_state if has_hidden ( layer ) else None ) else : return ( matrixify ( layer . initial_hidden_state , dimensions ) if has_hidden ( layer ) else None )
initalizes the recurrence relation with an initial hidden state if needed .