Main Page   Data Structures   File List   Data Fields   Globals  

nnfile.c File Reference

Network loading/saving functions. More...

#include <inttypes.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "nn.h"

Data Structures

struct  linkHandle
struct  linkRep
struct  memHandle
struct  nodeMeta

Functions

int nnSaveNetwork (nnNet *net, void *handle, int(*nnWrite)(void *handle, void *data, size_t len))
 Save a network's topology and weights.

int nnSaveNetworkFile (nnNet *net, FILE *f)
 Save a network's topology and weights to a file.

int nnSaveNetworkMem (nnNet *net, void *data, size_t len)
 Save a network's topology and weights to memory.

int nnSaveNetworkDynMem (nnNet *net, void **ptr, size_t *len)
 Save a network's topology and weights to dynamically-allocated memory.

nnNetnnLoadNetwork (void *handle, int(*nnRead)(void *handle, void *data, size_t len))
 Load a network.

nnNetnnLoadNetworkFile (FILE *f)
 Load a network from a file.

nnNetnnLoadNetworkMem (void *data, size_t len)
 Load a network from memory.

nnFileType nnGuessFileType (FILE *f)
 Determines the type of a file.


Detailed Description

Network loading/saving functions.


Define Documentation

#define _BYTESWAP  
 

Value:

((ROTR((x), 8) & 0xff00ff00L) | \
                      (ROTL((x), 8) & 0x00ff00ffL))


Function Documentation

nnFileType nnGuessFileType FILE *    f
 

Determines the type of a file.

Parameters:
f  stdio file handle.
Returns:
File type.

nnNet* nnLoadNetwork void *    handle,
int(*    nnRead)(void *handle, void *data, size_t len)
 

Load a network.

Parameters:
handle  Opaque reading handle.
nnRead  Pointer to input function.
Returns:
Loaded network or NULL upon failure.

nnNet* nnLoadNetworkFile FILE *    f
 

Load a network from a file.

Parameters:
f  stdio file handle.
Returns:
Loaded network or NULL upon failure.

nnNet* nnLoadNetworkMem void *    data,
size_t    len
 

Load a network from memory.

Parameters:
data  Pointer to memory.
len  Length of memory.
Returns:
Loaded network or NULL upon failure.

int nnSaveNetwork nnNet   net,
void *    handle,
int(*    nnWrite)(void *handle, void *data, size_t len)
 

Save a network's topology and weights.

Parameters:
net  Network to save.
handle  Opaque writing handle.
nnWrite  Pointer to output function.
Returns:
1 if successful, 0 otherwise.

int nnSaveNetworkDynMem nnNet   net,
void **    ptr,
size_t *    len
 

Save a network's topology and weights to dynamically-allocated memory.

Parameters:
net  Network to save.
Return values:
ptr  Upon success, will contain pointer to saved network in memory.
len  Upon success, will contain length of saved network.
Returns:
1 if successful, 0 otherwise.

int nnSaveNetworkFile nnNet   net,
FILE *    f
 

Save a network's topology and weights to a file.

Parameters:
net  Network to save.
f  stdio file handle.
Returns:
1 if successful, 0 otherwise.

int nnSaveNetworkMem nnNet   net,
void *    data,
size_t    len
 

Save a network's topology and weights to memory.

Parameters:
net  Network to save.
data  Memory location to store network.
len  Size of memory.
Returns:
1 if successful, 0 otherwise.


Variable Documentation

const char rcsid[] [static]
 

Initial value:

        "$Id: nnfile.c 319 2003-02-22 08:57:23Z asaddi $"


Generated on Sat Feb 22 03:39:25 2003 for nn by doxygen1.2.18