TFGENZOO.flows.utils.conv_zeros module

class TFGENZOO.flows.utils.conv_zeros.Conv1DZeros(width: int = None, width_scale: int = 2, kernel_size: int = 3, stride: int = 1, padding: str = 'SAME', logscale_factor: float = 3.0, initializer: tensorflow.python.ops.init_ops_v2.Initializer = 'zeros')[source]

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

Convolution layer for NTC text/audio with zero initialization

Sources:

Examples

>>> import tensorflow as tf
>>> from TFGENZOO.flows.utils.conv_zeros import Conv1DZeros
>>> c1z = Conv1DZeros(width_scale = 2)
>>> x = tf.keras.layers.Input([None, 32]) # [B, T, C] where T is time-step and C is hidden-depth
>>> y = clz(y) # [B, T, C * 2]
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.

class TFGENZOO.flows.utils.conv_zeros.Conv2DZeros(width: int = None, width_scale: int = 1, kernel_size: Tuple[int, int] = 3, 3, stride: Tuple[int, int] = 1, 1, padding: str = 'SAME', logscale_factor: float = 3.0, initializer: tensorflow.python.ops.init_ops_v2.Initializer = 'zeros')[source]

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

Convolution layer for NHWC image with zero initialization Sources:

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.