Utilities

flood_forecast.utils.numpy_to_tvar(x: Tensor) Variable[source]

Converts a numpy array into a PyTorch Tensor.

Parameters:

x (torch.Tensor) – A numpy array you want to convert to a PyTorch tensor

Returns:

A tensor variable

Return type:

torch.Variable

flood_forecast.utils.flatten_list_function(input_list: List) List[source]

A function to flatten a list.

flood_forecast.utils.make_criterion_functions(crit_list: List) List[source]

crit_list should be either dict or list.

If dict, then it should be a dictionary of the form . returns a list