msdnet.operations module

Module implementing network operations on CPU.

msdnet.operations.cfloatp

alias of msdnet.operations.LP_c_float

msdnet.operations.asfloatp(arr)[source]
msdnet.operations.cdoublep

alias of msdnet.operations.LP_c_double

msdnet.operations.asdoublep(arr)[source]
msdnet.operations.cintp

alias of msdnet.operations.LP_c_int

msdnet.operations.asintp(arr)[source]
msdnet.operations.relu(inp)[source]
msdnet.operations.leakyrelu(inp, w)[source]
msdnet.operations.sum(inp)[source]
msdnet.operations.std(inp, mn)[source]
msdnet.operations.multsum(a, b)[source]
msdnet.operations.softmax(inp)[source]
msdnet.operations.squaresum(a)[source]
msdnet.operations.relu2(inp, out)[source]
msdnet.operations.leakyrelu2(inp, out, w)[source]
msdnet.operations.combine(inp, out, w)[source]
msdnet.operations.conv2d(inp, out, f, d)[source]
msdnet.operations.filtergradient2d(inp, delta, ux, uy)[source]
msdnet.operations.indexlist(d, shp)[source]
msdnet.operations.setthreads(nthrds)[source]
class msdnet.operations.ImageData(shape, dl, nin)[source]

Bases: object

Object that represents a set of 2D images on CPU.

Parameters
  • shape – total shape of all images

  • dl – list of dilations in the network

  • nin – number of input images of network

setimages(ims)[source]

Set data to set of images.

Parameters

ims – set of images

setscalars(scl, start=0)[source]

Set each image to a scalar.

Parameters

scl – scalar values

fill(val, start=None, end=None)[source]

Set image data to single scalar value.

Parameters

val – scalar value

copy(start=None, end=None)[source]

Return copy of image data.

get(start=None, end=None)[source]

Return image data.

add(val, i)[source]

Add scalar to single image.

Parameters
  • val – scalar to add

  • i – index of image to add value to

mult(val, i)[source]

Multiply single image with value.

Parameters
  • val – value

  • i – index of image to multiply

prepare_forw_conv(f)[source]

Prepare for forward convolutions.

Parameters

f – convolution filters

forw_conv(i, outidx, dl)[source]

Perform forward convolutions

Parameters
  • i – image index to compute

  • outidx – image index to write output to

  • dl – dilation list

prepare_back_conv(f)[source]

Prepare for backward convolutions.

Parameters

f – convolution filters

back_conv(outidx, dl)[source]

Perform backward convolutions

Parameters
  • outidx – image index to write output to

  • dl – dilation list

property shape
relu(i)[source]

Apply ReLU to single image.

relu2(i, dat, j)[source]

Apply backpropagation ReLU to single image.

combine_all_all(dat, w)[source]

Compute linear combinations of images.

prepare_gradient()[source]

Prepare for gradient computation.

filtergradientfull(ims)[source]

Compute gradients for filters.

weightgradientall(delta)[source]

Compute gradients for weights.

sumall()[source]

Compute image sums.

softmax()[source]

Compute softmax.