
"""simple docstring"""






def  __lowerCamelCase					(					lowerCAmelCase__       ,lowerCAmelCase__       ,lowerCAmelCase__       ,lowerCAmelCase__				):
				A__ ,			A__							 =       len(__a				), len(grid[0]				)
				if (
				    min(__a       ,__a				) < 0
				    or row == row_length
				    or col == col_length
				    or (row, col) in visit
				    or grid[row][col] == 1
				):
								return 0
				if row == row_length - 1 and col == col_length - 1:
								return 1

				visit.add((row, col)				)

				A__							 =       0
				count += depth_first_search(__a       ,row + 1       ,__a       ,__a				)
				count += depth_first_search(__a       ,row - 1       ,__a       ,__a				)
				count += depth_first_search(__a       ,__a       ,col + 1       ,__a				)
				count += depth_first_search(__a       ,__a       ,col - 1       ,__a				)

				visit.remove((row, col)				)
				return count


if __name__ == "__main__":
					import doctest

					doctest.testmod()










"""simple docstring"""






from typing import Union

import fire
import torch
from tqdm import tqdm



def  __lowerCamelCase					(					lowerCAmelCase__       ,lowerCAmelCase__ = "cpu"       ,lowerCAmelCase__ = None				):
				A__							 =       torch.load(lowerCAmelCase__       ,map_location=lowerCAmelCase__				)
				for k, v in tqdm(state_dict.items()				):
								if not isinstance(lowerCAmelCase__       ,torch.Tensor				):
												raise TypeError('FP16 conversion only works on paths that are saved state dicts, like pytorch_model.bin'				)
								A__							 =       v.half()
				if save_path is None:  # overwrite src_path
								A__							 =       src_path
				torch.save(lowerCAmelCase__       ,lowerCAmelCase__				)


if __name__ == "__main__":
					fire.Fire(convert)


