title: How to reshape matrix with numpy without using explicit values for argument?
body: <p>I am trying to create a function and calculate the inner product using numpy.
  I got the function to work however I am using explicit numbers in my np.reshape function and I need to make it to use based on input.</p>
  <p>my code looks like this:</p>
  <pre><code>import numpy as np
  X = np.array([[1,2],[3,4]])
  Z = np.array([[1,4],[2,5],[3,6]])
  
  # Calculating S
  def calculate_S(X, n, m):
      assert n == X.shape[0]
      n,d1=X.shape
      m,d2=X.shape
      S = np.diag(np.inner(X,X))
      return S
  
  
  S= calculate_S(X,n,m)
  S = S.reshape(2,1)
  print(s)
  
  output:
  ---------------------------------
  [[ 5]
   [25]]
  </code></pre>
  <p>So the output is correct however instead of specifying 2,1 I need that those values to be automatically placed there based on the shape of my matrix.
  How do I do that?</p>