def _ParseInputSpec(input_spec):
 pattern = re.compile('(\\d+),(\\d+),(\\d+),(\\d+)')
 m = pattern.match(input_spec)
 if (m is None):
  raise ValueError(('Failed to parse input spec:' + input_spec))
 batch_size = int(m.group(1))
 y_size = (int(m.group(2)) if (int(m.group(2)) > 0) else None)
 x_size = (int(m.group(3)) if (int(m.group(3)) > 0) else None)
 depth = int(m.group(4))
 if (depth not in [1, 3]):
  raise ValueError('Depth must be 1 or 3, had:', depth)
 return vgsl_input.ImageShape(batch_size, y_size, x_size, depth)

def _ParseInputSpec ( input_spec ) : pattern = re . compile ( '(\\d+),(\\d+),(\\d+),(\\d+)' ) m = pattern . match ( input_spec ) if ( m is None ) : raise ValueError ( ( 'Failed to parse input spec:' + input_spec ) ) batch_size = int ( m . group ( 1 ) ) y_size = ( int ( m . group ( 2 ) ) if ( int ( m . group ( 2 ) ) > 0 ) else None ) x_size = ( int ( m . group ( 3 ) ) if ( int ( m . group ( 3 ) ) > 0 ) else None ) depth = int ( m . group ( 4 ) ) if ( depth not in [ 1 , 3 ] ) : raise ValueError ( 'Depth must be 1 or 3, had:' , depth ) return vgsl_input . ImageShape ( batch_size , y_size , x_size , depth )
parses input_spec and returns the numbers obtained therefrom .