tf.contrib.kfac.fisher_blocks.ConvDiagonalFB

Class ConvDiagonalFB

Defined in tensorflow/contrib/kfac/python/ops/fisher_blocks.py.

FisherBlock for 2-D convolutional layers using a diagonal approx.

Estimates the Fisher Information matrix's diagonal entries for a convolutional layer. Unlike NaiveDiagonalFB this uses the low-variance "sum of squares" estimator.

Let 'params' be a vector parameterizing a model and 'i' an arbitrary index into it. We are interested in Fisher(params)[i, i]. This is,

$$Fisher(params)[i, i] = E[ v(x, y, params) v(x, y, params)^T ][i, i] = E[ v(x, y, params)[i] ^ 2 ]$$

Consider a convoluational layer in this model with (unshared) filter matrix 'w'. For an example image 'x' that produces layer inputs 'a' and output preactivations 's',

$$v(x, y, w) = vec( sum_{loc} a_{loc} (d loss / d s_{loc})^T )$$

where 'loc' is a single (x, y) location in an image.

This FisherBlock tracks Fisher(params)[i, i] for all indices 'i' corresponding to the layer's parameters 'w'.

Properties

num_registered_towers

Methods

__init__

__init__(
    layer_collection,
    params,
    strides,
    padding,
    data_format=None,
    dilations=None
)

Creates a ConvDiagonalFB block.

Args:

  • layer_collection: The collection of all layers in the K-FAC approximate Fisher information matrix to which this FisherBlock belongs.
  • params: The parameters (Tensor or tuple of Tensors) of this layer. If kernel alone, a Tensor of shape [kernel_height, kernel_width, in_channels, out_channels]. If kernel and bias, a tuple of 2 elements containing the previous and a Tensor of shape [out_channels].
  • strides: The stride size in this layer (1-D Tensor of length 4).
  • padding: The padding in this layer (e.g. "SAME").
  • data_format: str or None. Format of input data.
  • dilations: List of 4 ints or None. Rate for dilation along all dimensions.

Raises:

  • ValueError: if strides is not length-4.
  • ValueError: if dilations is not length-4.
  • ValueError: if channel is not last dimension.

full_fisher_block

full_fisher_block()

instantiate_factors

instantiate_factors(
    grads_list,
    damping
)

multiply

multiply(vector)

Multiplies the vector by the (damped) block.

Args:

  • vector: The vector (a Tensor or tuple of Tensors) to be multiplied.

Returns:

The vector left-multiplied by the (damped) block.

multiply_cholesky

multiply_cholesky(
    vector,
    transpose=False
)

multiply_cholesky_inverse

multiply_cholesky_inverse(
    vector,
    transpose=False
)

multiply_inverse

multiply_inverse(vector)

Multiplies the vector by the (damped) inverse of the block.

Args:

  • vector: The vector (a Tensor or tuple of Tensors) to be multiplied.

Returns:

The vector left-multiplied by the (damped) inverse of the block.

multiply_matpower

multiply_matpower(
    vector,
    exp
)

register_additional_tower

register_additional_tower(
    inputs,
    outputs
)

register_cholesky

register_cholesky()

register_cholesky_inverse

register_cholesky_inverse()

register_inverse

register_inverse()

Registers a matrix inverse to be computed by the block.

register_matpower

register_matpower(exp)

tensors_to_compute_grads

tensors_to_compute_grads()

Tensors to compute derivative of loss with respect to.