The Complete SPRLIB & ANNLIB

create_sharednet

- create a shared weights neural network

SYNOPSIS

int create_sharednet (recipe, check)

ARGUMENTS

SHAREDNET_RECIPE *recipe A pointer to a SHAREDNET_RECIPE, containing the information necessary to a shared weights neural networks.
int check Should the network be checked after construction?

RETURNS

A pointer to a network if succesful, NULL otherwise.

FUNCTION

This function can be used to construct a shared weight neural network based on a recipe. This recipe can be read from a text file using the read_sharednet_recipe function. The routine initializes several local variables (see SHAREDNET-variables) to 0. The recipe is checked for erroneous values. If the recipe does not contain errors, a NET structure is allocated using malloc_net. Several fields are filled with default values: NetText using DFLT_NET_TEXT (see SHAREDNET-constants); NetId is set to 1, NetFlag to SHAREDNET (see NET-flags); NumLayers is set to the number of layer and all other Num... fields are initialized to 0. Each layer is then allocated using malloc_layer and filled and hooked up using the create_layer and connect_layers functions. Finally, various pointers (FirstUnit, LastUnit, FirstLayer, LastLayer, FirstWeight) and values (NumUnits, NumLinks, NumWeights, NumInputs, NumOutputs) are set using values gathered during the construction process. If the check variable is set to TRUE, the network will be checked after creation using the check_all_network function.

NOTE

The network checking process can be very time-consuming for reasonably large networks since, even if the number of weights in a network is low, the number of links may be quite large due to the weight sharing technique. A created network should be freed using the free_sharednet function.

SEE ALSO

free_sharednet

This document was generated using api2html on Thu Mar 5 09:00:00 MET DST 1998