parameters: (conv_prototxt, scale)
docstring: Examine the network output dimensions across a series of input scales.
docstring_summary: Examine the network output dimensions across a series of input scales.
docstring_tokens: Examine the network output dimensions across a series of input scales .
function: def scales(conv_prototxt, scale):
      """
      Examine the network output dimensions across a series of input scales.
      """
      logging.basicConfig(level=logging.INFO)
  
      net = caffe.Net(str(conv_prototxt), caffe.TEST)
      input_names = net.inputs
      input_shapes = {
          input_name: tuple(net.blobs[input_name].shape)
          for input_name in input_names}
  
      for scalar in scale:
          log.info("Running on scale: %s", scalar)
  
          def perturb(i, n):
              # only perturb HxW in NxCxHxW
              if i in (2, 3):
                  return int(n * scalar)
              return n
  
          inputs = {
              input_name: np.random.random(
                  size=tuple(
                      perturb(i, n)
                      for (i, n) in enumerate(shape)))
              for input_name, shape in input_shapes.iteritems()}
  
          for input_name, input in inputs.iteritems():
              log.info("Input: %s, shape: %s", input_name, input.shape)
              net.blobs[input_name].reshape(*input.shape)
          net.reshape()
          conv_outputs = net.forward(**inputs)
          for output_name, conv_output in conv_outputs.iteritems():
              log.info("%s: %s", output_name, conv_output.shape)
function_tokens: def scales ( conv_prototxt , scale ) : logging . basicConfig ( level = logging . INFO ) net = caffe . Net ( str ( conv_prototxt ) , caffe . TEST ) input_names = net . inputs input_shapes = { input_name : tuple ( net . blobs [ input_name ] . shape ) for input_name in input_names } for scalar in scale : log . info ( "Running on scale: %s" , scalar ) def perturb ( i , n ) : # only perturb HxW in NxCxHxW if i in ( 2 , 3 ) : return int ( n * scalar ) return n inputs = { input_name : np . random . random ( size = tuple ( perturb ( i , n ) for ( i , n ) in enumerate ( shape ) ) ) for input_name , shape in input_shapes . iteritems ( ) } for input_name , input in inputs . iteritems ( ) : log . info ( "Input: %s, shape: %s" , input_name , input . shape ) net . blobs [ input_name ] . reshape ( * input . shape ) net . reshape ( ) conv_outputs = net . forward ( * * inputs ) for output_name , conv_output in conv_outputs . iteritems ( ) : log . info ( "%s: %s" , output_name , conv_output . shape )