




import argparse

import torch

from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert
from transformers.utils import logging


logging.set_verbosity_info()



def 					UpperCAmelCase__     (   lowerCamelCase,	lowerCamelCase,	lowerCamelCase      ):
  # Initialise PyTorch model
  lowercase			:str							=  LxmertConfig.from_json_file(lowerCamelCase      )
  print(F"Building PyTorch model from configuration: {config}"      )
  lowercase			:Dict							=  LxmertForPreTraining(lowerCamelCase      )

  # Load weights from tf checkpoint
  load_tf_weights_in_lxmert(lowerCamelCase,	lowerCamelCase,	lowerCamelCase      )

  # Save pytorch-model
  print(F"Save PyTorch model to {pytorch_dump_path}"      )
  torch.save(model.state_dict(),	lowerCamelCase      )


if __name__ == "__main__":
     _UpperCAmelCase		:  Optional[Any]	=   argparse.ArgumentParser()
     # Required parameters
     parser.add_argument(
         "--tf_checkpoint_path", default=None, type=str, required=True, help="Path to the TensorFlow checkpoint path."
     )
     parser.add_argument(
         "--config_file",
         default=None,
         type=str,
         required=True,
         help="The config json file corresponding to the pre-trained model. \nThis specifies the model architecture.",
     )
     parser.add_argument(
         "--pytorch_dump_path", default=None, type=str, required=True, help="Path to the output PyTorch model."
     )
     _UpperCAmelCase		:  List[Any]	=   parser.parse_args()
     convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.config_file, args.pytorch_dump_path)









def 					UpperCAmelCase__     (   lowerCamelCase,	lowerCamelCase,	lowerCamelCase,	lowerCamelCase      ):
  # Return True if there is node that has not iterated.
  lowercase			:Union[str, Any]							=  [False] * len(lowerCamelCase      )
  lowercase			:Union[str, Any]							=  []
  queue.append(lowerCamelCase      )
  lowercase			:Optional[Any]							=  True

  while queue:
    lowercase			:Optional[Any]							=  queue.pop(0      )
    for ind in range(len(graph[u]      )      ):
      if visited[ind] is False and graph[u][ind] > 0:
        queue.append(lowerCamelCase      )
        lowercase			:Dict							=  True
        lowercase			:Dict							=  u

  return visited[t]



def 					UpperCAmelCase__     (   lowerCamelCase,	lowerCamelCase,	lowerCamelCase      ):
  # This array is filled by BFS and to store path
  lowercase			:Optional[int]							=  [-1] * (len(lowerCamelCase      ))
  lowercase			:int							=  0
  while bfs(lowerCamelCase,	lowerCamelCase,	lowerCamelCase,	lowerCamelCase      ):
    lowercase			:int							=  float("Inf"      )
    lowercase			:Any							=  sink

    while s != source:
      # Find the minimum value in select path
      lowercase			:Any							=  min(lowerCamelCase,	graph[parent[s]][s]      )
      lowercase			:Dict							=  parent[s]

    max_flow += path_flow
    lowercase			:Union[str, Any]							=  sink

    while v != source:
      lowercase			:List[Any]							=  parent[v]
      graph[u][v] -= path_flow
      graph[v][u] += path_flow
      lowercase			:Any							=  parent[v]
  return max_flow


_UpperCAmelCase		:  Optional[Any]	=   [
    [0, 16, 13, 0, 0, 0],
    [0, 0, 10, 12, 0, 0],
    [0, 4, 0, 0, 14, 0],
    [0, 0, 9, 0, 0, 20],
    [0, 0, 0, 7, 0, 4],
    [0, 0, 0, 0, 0, 0],
]

_UpperCAmelCase	,	_UpperCAmelCase		:  Any	=   0, 5







print(ford_fulkerson(graph, source, sink))



