How to use the delve.metrics.latent_iterative_pca function in delve

To help you get started, we’ve selected a few delve examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github delve-team / delve / delve / utils.py View on Github external
def get_prop(layer: torch.nn.Module, prop: Any):
    """Low-level function for getting `prop` from `layer`."""
    training_state = get_training_state(layer)
    if prop in ('train_eig_vals', 'eval_eig_vals'):
        layer_history = get_layer_prop(layer,
                                       f'{training_state}_layer_history')
        # calculate eigenvalues

        if hasattr(layer, 'conv_method'):
            eig_vals = latent_iterative_pca(layer,
                                            layer_history,
                                            conv_method=layer.conv_method)
        else:
            eig_vals = latent_iterative_pca(layer, layer_history)
        return eig_vals
    elif prop == 'param_eig_vals':
        layer_svd = get_layer_prop(layer, 'layer_svd')
        return layer_svd
github delve-team / delve / delve / utils.py View on Github external
def get_prop(layer: torch.nn.Module, prop: Any):
    """Low-level function for getting `prop` from `layer`."""
    training_state = get_training_state(layer)
    if prop in ('train_eig_vals', 'eval_eig_vals'):
        layer_history = get_layer_prop(layer,
                                       f'{training_state}_layer_history')
        # calculate eigenvalues

        if hasattr(layer, 'conv_method'):
            eig_vals = latent_iterative_pca(layer,
                                            layer_history,
                                            conv_method=layer.conv_method)
        else:
            eig_vals = latent_iterative_pca(layer, layer_history)
        return eig_vals
    elif prop == 'param_eig_vals':
        layer_svd = get_layer_prop(layer, 'layer_svd')
        return layer_svd