def _ParseOutputSpec(output_spec):
 pattern = re.compile('(O)(0|1|2)(l|s|c)(\\d+)')
 m = pattern.match(output_spec)
 if (m is None):
  raise ValueError(('Failed to parse output spec:' + output_spec))
 out_dims = int(m.group(2))
 out_func = m.group(3)
 if ((out_func == 'c') and (out_dims != 1)):
  raise ValueError('CTC can only be used with a 1-D sequence!')
 num_classes = int(m.group(4))
 return (out_dims, out_func, num_classes)

def _ParseOutputSpec ( output_spec ) : pattern = re . compile ( '(O)(0|1|2)(l|s|c)(\\d+)' ) m = pattern . match ( output_spec ) if ( m is None ) : raise ValueError ( ( 'Failed to parse output spec:' + output_spec ) ) out_dims = int ( m . group ( 2 ) ) out_func = m . group ( 3 ) if ( ( out_func == 'c' ) and ( out_dims != 1 ) ) : raise ValueError ( 'CTC can only be used with a 1-D sequence!' ) num_classes = int ( m . group ( 4 ) ) return ( out_dims , out_func , num_classes )
parses the output spec .