code: def to_fortran_order(V):
      """Convert a tensor to Fortran order. (The last two dimensions are made Fortran order.)
      Fortran order/ array is a special case in which all elements of an array are stored in
      column-major order.
  
      Examples
      --------
      >>> import torch
      >>> from deepchem.utils.pytorch_utils import to_fortran_order
      >>> V = torch.randn(3, 2)
      >>> V.is_contiguous()
      True
      >>> V = to_fortran_order(V)
      >>> V.is_contiguous()
      False
      >>> V.shape
      torch.Size([3, 2])
      >>> V = torch.randn(3, 2).transpose(-2, -1)
      >>> V.is_contiguous()
      False
      >>> V = to_fortran_order(V)
      >>> V.is_contiguous()
      False
      >>> V.shape
      torch.Size([2, 3])
  
      Parameters
      ----------
      V: torch.Tensor
          V is a matrix to be converted. (*BV, na, nguess)
  
      Returns
      -------
      outV: torch.Tensor
          (*BV, nguess, na)
  
      """
      if V.is_contiguous():
          # return V.set_(V.storage(), V.storage_offset(), V.size(), tuple(reversed(V.stride())))
          return V.transpose(-2, -1).contiguous().transpose(-2, -1)
      elif V.transpose(-2, -1).is_contiguous():
          return V
      else:
          raise RuntimeError(
              "Only the last two dimensions can be made Fortran order."
          )
  
file_path: deepchem/deepchem/utils/pytorch_utils.py
imports: import scipy
  import torch
  from typing import Callable, Union, List, Generator, Tuple
label_desc: Use image node_id 8 for calling a global function with example usage: to_fortran_order(V) and returns: V, V