CUV  0.9.201304091348
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Namespaces | Functions
Rbm
special purpose functions
Collaboration diagram for Rbm:

Namespaces

namespace  cuv::libs::rbm
 Restricted Boltzmann Machine (RBM)

Functions

template<class __value_type , class __memory_space_type , class __memory_layout_type >
void cuv::libs::rbm::set_binary_sequence (tensor< __value_type, __memory_space_type, __memory_layout_type > &m, const int &start)
 set a matrix to consecutive binary numbers in the columns, starting with the number `start'
template<class __value_type , class __memory_space_type , class __memory_layout_type >
void cuv::libs::rbm::sigm_temperature (tensor< __value_type, __memory_space_type, __memory_layout_type > &m, const tensor< __value_type, __memory_space_type > &temp)
 apply sigmoid column-wise with the temperature specified for each column
template<class __value_type , class __memory_space_type , class __memory_layout_type >
void cuv::libs::rbm::set_local_connectivity_in_dense_matrix (tensor< __value_type, __memory_space_type, __memory_layout_type > &m, int patchsize, int vx, int vy, int hx, int hy, int maxdist_from_main_dia=1E6, bool round=false)
 simulate a local connectivity pattern.
template<class __value_type , class __memory_space_type , class __memory_layout_type >
void cuv::libs::rbm::copy_at_rowidx (tensor< __value_type, __memory_space_type, __memory_layout_type > &dst, const tensor< __value_type, __memory_space_type, __memory_layout_type > &src, const tensor< typename tensor< __value_type, __memory_space_type, __memory_layout_type >::size_type, __memory_space_type, __memory_layout_type > &rowidx, const unsigned int offset)
 copy one matrix into another but only at specified positions.
template<class __value_type , class __memory_space_type , class __memory_layout_type >
void cuv::libs::rbm::copy_redblack (tensor< __value_type, __memory_space_type, __memory_layout_type > &dst, const tensor< __value_type, __memory_space_type, __memory_layout_type > &src, const unsigned int num_maps, const unsigned int color)
template<class __value_type , class __memory_layout , class __memory_space_type >
void cuv::libs::rbm::bitflip (tensor< __value_type, __memory_layout, __memory_space_type > &matrix, typename tensor< __value_type, __memory_layout, __memory_space_type >::size_type row)
 Bit-Flip a row of a column-major matrix.

Detailed Description

Function Documentation

template<class __value_type , class __memory_layout , class __memory_space_type >
void cuv::libs::rbm::bitflip ( tensor< __value_type, __memory_layout, __memory_space_type > &  matrix,
typename tensor< __value_type, __memory_layout, __memory_space_type >::size_type  row 
)

Bit-Flip a row of a column-major matrix.

Parameters
matrixMatrix to apply functor on
rowrow to flip

changes the matrix such that its m-th row is now (1-original mth row)

template<class __value_type , class __memory_space_type , class __memory_layout_type >
void cuv::libs::rbm::copy_at_rowidx ( tensor< __value_type, __memory_space_type, __memory_layout_type > &  dst,
const tensor< __value_type, __memory_space_type, __memory_layout_type > &  src,
const tensor< typename tensor< __value_type, __memory_space_type, __memory_layout_type >::size_type, __memory_space_type, __memory_layout_type > &  rowidx,
const unsigned int  offset 
)

copy one matrix into another but only at specified positions.

Parameters
dstthe target matrix (N x M)
srcthe source matrix (N x M)
rowidxcontains row indices (M x B). The values at position b*offset+rowidx(m,b) will be copied.
offsetoffset (see rowidx)

This kernel can be used to compute serial gibbs updates of a laterally connected RBM hidden layer. Then, offset is the size of one map in the hidden layer, src is the actual result of the calculation and dst is the one where only selected values are changed.

rowidx must be set to indices which are at most as large as the mapsize (<offset, that is). note that for at least some consecutive read operations, rowidx is somewhat "transposed".

template<class __value_type , class __memory_space_type , class __memory_layout_type >
void cuv::libs::rbm::set_binary_sequence ( tensor< __value_type, __memory_space_type, __memory_layout_type > &  m,
const int &  start 
)

set a matrix to consecutive binary numbers in the columns, starting with the number `start'

Parameters
mthe target matrix
startthe value of the first column
template<class __value_type , class __memory_space_type , class __memory_layout_type >
void cuv::libs::rbm::set_local_connectivity_in_dense_matrix ( tensor< __value_type, __memory_space_type, __memory_layout_type > &  m,
int  patchsize,
int  vx,
int  vy,
int  hx,
int  hy,
int  maxdist_from_main_dia = 1E6,
bool  round = false 
)

simulate a local connectivity pattern.

This simulates the local connectivity in a dense matrix by setting values to zero which are not part of the local connectivity.

assume the lower layer image has dimension vx times vy and the upper layer has size hx times hy. The lower layer has vm maps, the upper layer has hm maps.

Parameters
mthe matrix, should have dimension vx*vy*vm times hx*hy*hm
patchsizesize of local receptive field
vxas explained above
vyas explained above
hx
hy
maxdist_from_main_diareset everything further than this many maps away from central diagonal
round
template<class __value_type , class __memory_space_type , class __memory_layout_type >
void cuv::libs::rbm::sigm_temperature ( tensor< __value_type, __memory_space_type, __memory_layout_type > &  m,
const tensor< __value_type, __memory_space_type > &  temp 
)

apply sigmoid column-wise with the temperature specified for each column

Parameters
msource and target matrix
tempthe temperature (one value per column)