FullyConnectedParams

#include <popsparse/FullyConnectedParams.hpp>

Parameters used for fully-connected layers using sparse tensors.

namespace popsparse

Support for sparse matrices.

namespace dynamic

Support for dynamic sparse matrices.

Functions

std::ostream &operator<<(std::ostream &os, const FullyConnectedParams &p)
class FullyConnectedParams

Fully connected parameters

These are the parameters which define a fully connected layer.

Matrix multiplications for the different passes are as follows

  • For pass = FC_INFERENCE or FC_TRAINING_FWD

    [numGroups][outputChannelsPerGroup][inputChannelsPerGroup] * [numGroups][inputChannelsPerGroup][batchSize]

  • For pass = FC_TRAINING_GRADA

    [numGroups][inputChannelsPerGroup][outputChannelsPerGroup] * [numGroups][outputChannelsPerGroup][batchSize]

  • For pass = FC_TRAINING_GRADW

    [numGroups][outputChannelsPerGroup][batchSize] * [numGroups][batchSize][inputChannelsPerGroup]

static FullyConnectedParams createWithNzRatio(const SparsityParams &sparsityParams, double nzRatio, std::size_t batchSize, std::size_t numGroups, std::size_t inputChannels, std::size_t outputChannels)

Create parameters with the specified ratio of non-zero elements.

static FullyConnectedParams createWithNumNonZeroValues(const SparsityParams &sparsityParams, std::size_t numNonZeroElems, std::size_t batchSize, std::size_t numGroups, std::size_t inputChannels, std::size_t outputChannels)

Create parameters with the specified number of non-zero elements.

Public Functions

inline std::size_t getBatchSize() const
inline std::size_t getNumGroups() const
inline std::size_t getInputChannels() const
inline std::size_t getOutputChannels() const
inline std::size_t getInputChannelsPerGroup() const
inline std::size_t getOutputChannelsPerGroup() const
inline const SparsityParams &getSparsityParams() const
double getNzRatio() const
std::size_t getNumNonZeroValues() const

Private Members

SparsityParams sparsityParams

Sparsity parameters.

double nzRatio

Proportion of weights which are non-zero in range [0,1].

std::size_t batchSize
std::size_t numGroups
std::size_t inputChannelsPerGroup
std::size_t outputChannelsPerGroup

Friends

friend bool operator<(const FullyConnectedParams &a, const FullyConnectedParams &b)
friend bool operator==(const FullyConnectedParams &a, const FullyConnectedParams &b)
friend bool operator!=(const FullyConnectedParams &a, const FullyConnectedParams &b)