Skip to content

INN.Conv1d

Zhang Yanbo edited this page Oct 27, 2022 · 1 revision

CLASS INN.Conv1d(channels, kernel_size, method='NICE', **args)

A nonlinear 1d-convolutional INN layer.

Common parameters

  • channels: number of channels
  • kernel_size: kernel size
  • method: This can be 'NICE', 'RealNVP' and 'ResFlow'
  • activation_fn: Activation function for the coupling function. If the function is given, this argument will be ignored

RealNVP and NICE method

  • mask: Mask for splitting input vectors

NICE

  • m: Addition function, it should be a neural network maps vector with dimension channels // 2 to channels - channels // 2. If m=None, it will be generated automatically by INN.utils.default_net(dim, k, activation_fn);

RealNVP

  • s: Multiplication function. It has the same dimension requirements as m;
  • t: Addition function. It has the same dimension requirements as m;
  • clip_n: (default: clip_n=1) Clipping the output of s to avoid extreme numbers between [-clip_n, clip_n]. The clipping is using tanh to keep the gradient;
  • clip: Clipping the output of s if clip=True

ResFlow

  • hidden: Dimension of hidden layers
  • lipschitz_constrain: Lipschitz constrain number, it should be lower than 1. Low value may decrease the computation power of the neural network;
  • mem_efficient: Using memory-efficient back-propagation if it is True;
  • est_steps: Number of iterations for estimating gradients and Jacobians

Methods

forward(x, log_p0=0, log_det_J=0)

Compute the forward pass. The output will be the transformed x. If compute_p=True, logp and logdet will also returned.

inverse(y, **args)

Compute the inverse of y. The **args is a placeholder for consistent format.

Clone this wiki locally