TFGENZOO.flows.utils.conv module

class TFGENZOO.flows.utils.conv.Conv2D(width: int = None, width_scale: int = 1, kernel_size: Tuple[int, int] = (3, 3), stride: Tuple[int, int] = (1, 1), padding: str = 'SAME', do_actnorm: bool = True, do_weightnorm: bool = False, initializer: tensorflow.python.ops.init_ops_v2.Initializer = <tensorflow.python.ops.init_ops_v2.RandomNormal object>, bias_initializer: tensorflow.python.ops.init_ops_v2.Initializer = 'zeros')[source]

Bases: tensorflow.python.keras.engine.base_layer.Layer

Convolution layer for NHWC image

Sources:

Note

this layer applies

  • data-dependent normalization (actnorm, openai’s Glow)

  • weight normalization for stable training

this layer not implemented.

  • function add_edge_padding

ref. https://github.com/openai/glow/blob/master/tfops.py#L203-L232

build(input_shape: tensorflow.python.framework.tensor_shape.TensorShape)[source]

Creates the variables of the layer (optional, for subclass implementers).

This is a method that implementers of subclasses of Layer or Model can override if they need a state-creation step in-between layer instantiation and layer call.

This is typically used to create the weights of Layer subclasses.

Parameters

input_shape – Instance of TensorShape, or list of instances of TensorShape if the layer expects a list of inputs (one instance per input).

call(x: tensorflow.python.framework.ops.Tensor)[source]

This is where the layer’s logic lives.

Parameters
  • inputs – Input tensor, or list/tuple of input tensors.

  • **kwargs – Additional keyword arguments.

Returns

A tensor or list/tuple of tensors.

get_config()[source]

Returns the config of the layer.

A layer config is a Python dictionary (serializable) containing the configuration of a layer. The same layer can be reinstantiated later (without its trained weights) from this configuration.

The config of a layer does not include connectivity information, nor the layer class name. These are handled by Network (one layer of abstraction above).

Returns

Python dictionary.