XCSF  1.4.7
XCSF learning classifier system
neural_layer_upsample.h File Reference

An implementation of a 2D upsampling layer. More...

#include "neural_layer.h"
Include dependency graph for neural_layer_upsample.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void neural_layer_upsample_init (struct Layer *l, const struct ArgsLayer *args)
 Initialises a 2D upsampling layer. More...
 
struct Layerneural_layer_upsample_copy (const struct Layer *src)
 Initialises and copies one upsampling layer from another. More...
 
void neural_layer_upsample_rand (struct Layer *l)
 Dummy function since upsampling layers have no weights. More...
 
void neural_layer_upsample_forward (const struct Layer *l, const struct Net *net, const double *input)
 Forward propagates an upsampling layer. More...
 
void neural_layer_upsample_backward (const struct Layer *l, const struct Net *net, const double *input, double *delta)
 Backward propagates an upsampling layer. More...
 
void neural_layer_upsample_update (const struct Layer *l)
 Dummy function since upsampling layers have no weights. More...
 
void neural_layer_upsample_print (const struct Layer *l, const bool print_weights)
 Prints an upsampling layer. More...
 
bool neural_layer_upsample_mutate (struct Layer *l)
 Dummy function since upsampling layers cannot be mutated. More...
 
void neural_layer_upsample_free (const struct Layer *l)
 Free memory used by an upsampling layer. More...
 
double * neural_layer_upsample_output (const struct Layer *l)
 Returns the output from an upsampling layer. More...
 
size_t neural_layer_upsample_save (const struct Layer *l, FILE *fp)
 Writes an upsampling layer to a file. More...
 
size_t neural_layer_upsample_load (struct Layer *l, FILE *fp)
 Reads an upsampling layer from a file. More...
 
void neural_layer_upsample_resize (struct Layer *l, const struct Layer *prev)
 Resizes an upsampling layer if the previous layer has changed size. More...
 
char * neural_layer_upsample_json_export (const struct Layer *l, const bool return_weights)
 Returns a json formatted string representation of an upsample layer. More...
 

Variables

static struct LayerVtbl const layer_upsample_vtbl
 Neural upsampling layer implemented functions. More...
 

Detailed Description

An implementation of a 2D upsampling layer.

Author
Richard Preen rpree.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om
Date
2016–2021.

Definition in file neural_layer_upsample.h.

Function Documentation

◆ neural_layer_upsample_backward()

void neural_layer_upsample_backward ( const struct Layer l,
const struct Net net,
const double *  input,
double *  delta 
)

Backward propagates an upsampling layer.

Parameters
[in]lThe layer to backward propagate.
[in]netNetwork containing the layer.
[in]inputThe input to the layer.
[out]deltaThe previous layer's error.

Definition at line 156 of file neural_layer_upsample.c.

References Layer::c, Layer::channels, Layer::delta, Layer::h, Layer::height, Layer::i, Layer::stride, and Layer::width.

◆ neural_layer_upsample_copy()

struct Layer* neural_layer_upsample_copy ( const struct Layer src)

Initialises and copies one upsampling layer from another.

Parameters
[in]srcThe source layer.
Returns
A pointer to the new layer.

Definition at line 88 of file neural_layer_upsample.c.

References Layer::channels, Layer::height, layer_defaults(), Layer::layer_vptr, malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::stride, Layer::type, UPSAMPLE, and Layer::width.

Here is the call graph for this function:

◆ neural_layer_upsample_forward()

void neural_layer_upsample_forward ( const struct Layer l,
const struct Net net,
const double *  input 
)

Forward propagates an upsampling layer.

Parameters
[in]lLayer to forward propagate.
[in]netNetwork containing the layer.
[in]inputInput to the layer.

Definition at line 129 of file neural_layer_upsample.c.

References Layer::c, Layer::channels, Layer::h, Layer::height, Layer::i, Layer::output, Layer::stride, and Layer::width.

◆ neural_layer_upsample_free()

void neural_layer_upsample_free ( const struct Layer l)

Free memory used by an upsampling layer.

Parameters
[in]lThe layer to be freed.

Definition at line 56 of file neural_layer_upsample.c.

References free_layer_arrays().

Here is the call graph for this function:

◆ neural_layer_upsample_init()

void neural_layer_upsample_init ( struct Layer l,
const struct ArgsLayer args 
)

Initialises a 2D upsampling layer.

Parameters
[in]lLayer to initialise.
[in]argsParameters to initialise the layer.

Definition at line 67 of file neural_layer_upsample.c.

References Layer::channels, ArgsLayer::channels, Layer::height, ArgsLayer::height, malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::stride, ArgsLayer::stride, Layer::width, and ArgsLayer::width.

Here is the call graph for this function:

◆ neural_layer_upsample_json_export()

char* neural_layer_upsample_json_export ( const struct Layer l,
const bool  return_weights 
)

Returns a json formatted string representation of an upsample layer.

Parameters
[in]lThe layer to return.
[in]return_weightsWhether to return the values of weights and biases.
Returns
String encoded in json format.

Definition at line 254 of file neural_layer_upsample.c.

References Layer::channels, Layer::height, Layer::n_inputs, Layer::n_outputs, Layer::stride, and Layer::width.

Referenced by neural_layer_upsample_print().

Here is the caller graph for this function:

◆ neural_layer_upsample_load()

size_t neural_layer_upsample_load ( struct Layer l,
FILE *  fp 
)

Reads an upsampling layer from a file.

Parameters
[in]lThe layer to load.
[in]fpPointer to the file to be read.
Returns
The number of elements read.

Definition at line 301 of file neural_layer_upsample.c.

References Layer::channels, Layer::height, malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::stride, and Layer::width.

Here is the call graph for this function:

◆ neural_layer_upsample_mutate()

bool neural_layer_upsample_mutate ( struct Layer l)

Dummy function since upsampling layers cannot be mutated.

Parameters
[in]lAn upsampling layer.
Returns
False.

Definition at line 195 of file neural_layer_upsample.c.

◆ neural_layer_upsample_output()

double* neural_layer_upsample_output ( const struct Layer l)

Returns the output from an upsampling layer.

Parameters
[in]lThe layer whose output to return.
Returns
The layer output.

Definition at line 228 of file neural_layer_upsample.c.

References Layer::output.

◆ neural_layer_upsample_print()

void neural_layer_upsample_print ( const struct Layer l,
const bool  print_weights 
)

Prints an upsampling layer.

Parameters
[in]lThe layer to print.
[in]print_weightsWhether to print the values of weights and biases.

Definition at line 239 of file neural_layer_upsample.c.

References neural_layer_upsample_json_export().

Here is the call graph for this function:

◆ neural_layer_upsample_rand()

void neural_layer_upsample_rand ( struct Layer l)

Dummy function since upsampling layers have no weights.

Parameters
[in]lAn average pooling layer.

Definition at line 117 of file neural_layer_upsample.c.

◆ neural_layer_upsample_resize()

void neural_layer_upsample_resize ( struct Layer l,
const struct Layer prev 
)

Resizes an upsampling layer if the previous layer has changed size.

Parameters
[in]lThe layer to resize.
[in]prevThe layer previous to the one being resized.

Definition at line 207 of file neural_layer_upsample.c.

References Layer::channels, free_layer_arrays(), Layer::height, malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::stride, and Layer::width.

Here is the call graph for this function:

◆ neural_layer_upsample_save()

size_t neural_layer_upsample_save ( const struct Layer l,
FILE *  fp 
)

Writes an upsampling layer to a file.

Parameters
[in]lThe layer to save.
[in]fpPointer to the file to be written.
Returns
The number of elements written.

Definition at line 278 of file neural_layer_upsample.c.

References Layer::channels, Layer::height, Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::stride, and Layer::width.

◆ neural_layer_upsample_update()

void neural_layer_upsample_update ( const struct Layer l)

Dummy function since upsampling layers have no weights.

Parameters
[in]lAn upsampling layer.

Definition at line 184 of file neural_layer_upsample.c.

Variable Documentation

◆ layer_upsample_vtbl

struct LayerVtbl const layer_upsample_vtbl
static
Initial value:
= {
}
void neural_layer_upsample_print(const struct Layer *l, const bool print_weights)
Prints an upsampling layer.
void neural_layer_upsample_resize(struct Layer *l, const struct Layer *prev)
Resizes an upsampling layer if the previous layer has changed size.
double * neural_layer_upsample_output(const struct Layer *l)
Returns the output from an upsampling layer.
size_t neural_layer_upsample_save(const struct Layer *l, FILE *fp)
Writes an upsampling layer to a file.
void neural_layer_upsample_backward(const struct Layer *l, const struct Net *net, const double *input, double *delta)
Backward propagates an upsampling layer.
void neural_layer_upsample_free(const struct Layer *l)
Free memory used by an upsampling layer.
void neural_layer_upsample_forward(const struct Layer *l, const struct Net *net, const double *input)
Forward propagates an upsampling layer.
void neural_layer_upsample_rand(struct Layer *l)
Dummy function since upsampling layers have no weights.
bool neural_layer_upsample_mutate(struct Layer *l)
Dummy function since upsampling layers cannot be mutated.
void neural_layer_upsample_update(const struct Layer *l)
Dummy function since upsampling layers have no weights.
void neural_layer_upsample_init(struct Layer *l, const struct ArgsLayer *args)
Initialises a 2D upsampling layer.
size_t neural_layer_upsample_load(struct Layer *l, FILE *fp)
Reads an upsampling layer from a file.
char * neural_layer_upsample_json_export(const struct Layer *l, const bool return_weights)
Returns a json formatted string representation of an upsample layer.
struct Layer * neural_layer_upsample_copy(const struct Layer *src)
Initialises and copies one upsampling layer from another.

Neural upsampling layer implemented functions.

Definition at line 70 of file neural_layer_upsample.h.

Referenced by layer_set_vptr().