parameters: (gt_ker)
return_statement: return model
docstring: gt_ker is the grappa calibration kernel of A*ker = B
  
      Dout is the number of output elements. It is 2*B.shape(1), due to complex numbers
docstring_summary: gt_ker is the grappa calibration kernel of A*ker = B
docstring_tokens: gt_ker is the grappa calibration kernel of A * ker = B
function: def create_grappa_ai_model(gt_ker):
      '''gt_ker is the grappa calibration kernel of A*ker = B
  
      Dout is the number of output elements. It is 2*B.shape(1), due to complex numbers
      '''
  
      model = None
  
      try:
          print("Grappa ai", file=sys.stderr)
          print("----------------------------------------", file=sys.stderr)
  
          try:
              kRO, kNE1, srcCHA, dstCHA, oE1 = gt_ker.shape
              gt_ker_2D = np.reshape(gt_ker, (kRO*kNE1*srcCHA, dstCHA*oE1), order='F')
          except:
              gt_ker_2D = gt_ker
  
          gt_ker_2D_r = np.real(gt_ker_2D)
          gt_ker_2D_i = np.imag(gt_ker_2D)
  
          Din = 2*kRO*kNE1*srcCHA
          Dout = 2*dstCHA*oE1
  
          params = dict()
  
          params['verbose'] = True
          params['grappa_weights_r'] = torch.from_numpy(np.transpose(gt_ker_2D_r, (1,0))).to(torch.float32)
          params['grappa_weights_i'] = torch.from_numpy(np.transpose(gt_ker_2D_i, (1,0))).to(torch.float32)
  
          model = GrappaAI(Din, Dout, params)
          print(model)
          print("----------------------------------------", file=sys.stderr)
  
          sys.stderr.flush()
  
      except Exception as e:
          print("Error happened in create_grappa_ai_model", file=sys.stderr)
          print(e)
  
      return model
function_tokens: def create_grappa_ai_model ( gt_ker ) : model = None try : print ( "Grappa ai" , file = sys . stderr ) print ( "----------------------------------------" , file = sys . stderr ) try : kRO , kNE1 , srcCHA , dstCHA , oE1 = gt_ker . shape gt_ker_2D = np . reshape ( gt_ker , ( kRO * kNE1 * srcCHA , dstCHA * oE1 ) , order = 'F' ) except : gt_ker_2D = gt_ker gt_ker_2D_r = np . real ( gt_ker_2D ) gt_ker_2D_i = np . imag ( gt_ker_2D ) Din = 2 * kRO * kNE1 * srcCHA Dout = 2 * dstCHA * oE1 params = dict ( ) params [ 'verbose' ] = True params [ 'grappa_weights_r' ] = torch . from_numpy ( np . transpose ( gt_ker_2D_r , ( 1 , 0 ) ) ) . to ( torch . float32 ) params [ 'grappa_weights_i' ] = torch . from_numpy ( np . transpose ( gt_ker_2D_i , ( 1 , 0 ) ) ) . to ( torch . float32 ) model = GrappaAI ( Din , Dout , params ) print ( model ) print ( "----------------------------------------" , file = sys . stderr ) sys . stderr . flush ( ) except Exception as e : print ( "Error happened in create_grappa_ai_model" , file = sys . stderr ) print ( e ) return model