vgslify package

Subpackages

Submodules

vgslify.generator module

class vgslify.generator.VGSLModelGenerator(backend='auto')[source]

Bases: object

VGSLModelGenerator constructs a neural network model based on a VGSL (Variable-size Graph Specification Language) specification string. This class supports dynamic model generation for different backends, with current support for TensorFlow.

The generator takes a VGSL specification string that defines the architecture of the neural network, including the input layer, convolutional layers, pooling layers, RNN layers, dense layers, and more. The class parses this string, constructs the layers in sequence, and builds the final model.

construct_layer(spec, prev_layer=None)[source]

Constructs a single layer using the layer factory based on the spec string.

Parameters:
  • spec (str) – The VGSL specification string for a layer.

  • prev_layer (Any, optional) – The previous layer, required for spatial collapsing (‘Rc’).

Returns:

The constructed layer.

Return type:

Any

Raises:

ValueError – If the layer specification is unknown or if ‘Rc’ requires the previous layer’s shape.

generate_history(model_spec)[source]

Generate the history of layer specifications without building the full model.

This method parses the VGSL specification string, constructs each layer using the layer factory, and stores them in a list, but does not chain them or connect input/output layers.

Parameters:

model_spec (str) – The VGSL specification string defining the model architecture.

Returns:

A list of layers constructed from the specification string.

Return type:

list

generate_model(model_spec)[source]

Build the model based on the VGSL spec string.

This method parses the VGSL specification string, creates each layer using the layer factory, and constructs the model sequentially.

Parameters:

model_spec (str) – The VGSL specification string defining the model architecture.

Returns:

The built model using the specified backend.

Return type:

Any

vgslify.parser module

Module contents