(inputs, batch_size)
Computes the inception features and logits for a given NumPy array.

  The inputs are first preprocessed to match the input shape required for
  Inception.

  Args:
    inputs: NumPy array of shape [-1, H, W, 3].
    batch_size: Batch size.

  Returns:
    A tuple of NumPy arrays with Inception features and logits for each input.
Computes the inception features and logits for a given NumPy array.
Computes the inception features and logits for a given NumPy array .
def inception_transform_np(inputs, batch_size):
  """Computes the inception features and logits for a given NumPy array.

  The inputs are first preprocessed to match the input shape required for
  Inception.

  Args:
    inputs: NumPy array of shape [-1, H, W, 3].
    batch_size: Batch size.

  Returns:
    A tuple of NumPy arrays with Inception features and logits for each input.
  """
  with tf.Session(graph=tf.Graph()) as sess:
    inputs_placeholder = tf.placeholder(
        dtype=tf.float32, shape=[None] + list(inputs[0].shape))
    features_and_logits = inception_transform(inputs_placeholder)
    num_batches = int(np.ceil(inputs.shape[0] / batch_size))
    for i in range(num_batches):
      input_batch = inputs[i * batch_size: (i + 1) * batch_size]
      x = sess.run(
          features_and_logits, feed_dict={inputs_placeholder: input_batch})
      if i == 0:
        features = np.zeros([inputs.shape[0], *x[0].shape[1:]], dtype=x[0].dtype)
        logits = np.zeros([inputs.shape[0], *x[1].shape[1:]], dtype=x[1].dtype)
      features[i * batch_size: (i + 1) * batch_size] = x[0]
      logits[i * batch_size: (i + 1) * batch_size] = x[1]
    return features, logits
def inception_transform_np ( inputs , batch_size ) : with tf . Session ( graph = tf . Graph ( ) ) as sess : inputs_placeholder = tf . placeholder ( dtype = tf . float32 , shape = [ None ] + list ( inputs [ 0 ] . shape ) ) features_and_logits = inception_transform ( inputs_placeholder ) num_batches = int ( np . ceil ( inputs . shape [ 0 ] / batch_size ) ) for i in range ( num_batches ) : input_batch = inputs [ i * batch_size : ( i + 1 ) * batch_size ] x = sess . run ( features_and_logits , feed_dict = { inputs_placeholder : input_batch } ) if i == 0 : features = np . zeros ( [ inputs . shape [ 0 ] , * x [ 0 ] . shape [ 1 : ] ] , dtype = x [ 0 ] . dtype ) logits = np . zeros ( [ inputs . shape [ 0 ] , * x [ 1 ] . shape [ 1 : ] ] , dtype = x [ 1 ] . dtype ) features [ i * batch_size : ( i + 1 ) * batch_size ] = x [ 0 ] logits [ i * batch_size : ( i + 1 ) * batch_size ] = x [ 1 ] return features , logits