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 and PyTorch.

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)[source]

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

Parameters:

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

Returns:

The constructed layer.

Return type:

Any

Raises:

ValueError – If the layer specification is unknown.

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, model_name='VGSL_Model')[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

Module contents