cytometer/models.py
def check_model(model):
    """
    Check the layers with weights for NaNs.
    :param model: Keras model.
    :return: list with the names of layers with NaNs. If no weights contain NaNs, the list is empty.
    """

    # loop layers
    layers_with_nans = []
    for layer in model.layers:
        # get the weights in the layer
        weights_list = layer.get_weights()
        if not isinstance(weights_list, list):
            continue
        for weights in weights_list:
            if not isinstance(weights, np.ndarray):
                continue
            # print('Checking layer ' + layer.name)
            if np.any(np.isnan(weights)):
                # print('Layer ' + layer.name + ': contains NaNs')
                layers_with_nans.append(layer.name)
                continue

    return layers_with_nans

    Check the layers with weights for NaNs.
    :param model: Keras model.
    :return: list with the names of layers with NaNs. If no weights contain NaNs, the list is empty.
    
Check the layers with weights for NaNs.
Check the layers with weights for NaNs .
def check_model(model):
    layers_with_nans = []
    for layer in model.layers:
        weights_list = layer.get_weights()
        if not isinstance(weights_list, list):
            continue
        for weights in weights_list:
            if not isinstance(weights, np.ndarray):
                continue
            if np.any(np.isnan(weights)):
                layers_with_nans.append(layer.name)
                continue
    return layers_with_nans
def check_model ( model ) : layers_with_nans = [ ] for layer in model . layers : weights_list = layer . get_weights ( ) if not isinstance ( weights_list , list ) : continue for weights in weights_list : if not isinstance ( weights , np . ndarray ) : continue if np . any ( np . isnan ( weights ) ) : layers_with_nans . append ( layer . name ) continue return layers_with_nans
Check the layers with weights for NaNs.
Check the layers with weights for NaNs .
"""
    Check the layers with weights for NaNs.
    :param model: Keras model.
    :return: list with the names of layers with NaNs. If no weights contain NaNs, the list is empty.
    """ # loop layers # get the weights in the layer # print('Checking layer ' + layer.name) # print('Layer ' + layer.name + ': contains NaNs')
list with the names of layers with NaNs. If no weights contain NaNs, the list is empty.
list with the names of layers with NaNs . If no weights contain NaNs the list is empty .
model
None