Skip to content

NeuralDeepWorks/deepworks

Repository files navigation

deepworks

Build Status License

deepworks is a C++ framework for deep learning. We integrate acceleration libraries such as Eigen to maximize performance.

Table of contents

Features

Layers

Loss functions

  • CrossEntropyLoss - criterion combines Log and NLLLoss. The input is expected to contain normalized scores (after SoftMax) for each class.

Metrics

  • accuracy - compute the frequency with which predictions matches labels.
  • accuracyOneHot - compute the frequency with which predictions matches one-hot labels.

Initializers

  • zeros - fills the tensor with zeros.
  • constant - fills the tensor with value.
  • xavierUniform - fills the input Tensor with values according to the method described in Understanding the difficulty of training deep feedforward neural networks - Glorot, X. & Bengio, Y. (2010), using a uniform distribution.
  • uniform - fills the tensor with values drawn from the uniform distribution U(lower, upper).

Optimization algorithms

Serialization

save_state - save model weights in .bin file. load_state - load model weights from .bin file to model.

save_cfg - save model architecture to .bin file. load_cfg - load model architecture from .bin file.

save - save model weights and config to .bin files. load - load model weights and config from .bin files.

save_dot - dump model architecture to .dot file for vizualization.

Supported data formats

  • PNG/JPEG images
  • CSV

Documentation

Dependencies

Install dependencies for image reader

On Linux

sudo apt install libpng-dev
sudo apt install libjpeg-dev

On MacOS

brew install libpng
brew install jpeg

Build from source

git clone https://github.com/NeuralDeepWorks/deepworks.git
cd deepworks
git submodule init
git submodule update --recursive
git lfs pull
mkdir build
cd build
cmake ..
make -j8

Some cmake options are available:

options description default additional requirements to use
BUILD_TESTS Build unit tests ON1 -
WITH_EIGEN Build prolect with Eigen ON2 -
BUILD_SAMPLES Build samples ON -
BUILD_BENCHMARKS Build benchmarks ON -
DOWNLOAD_DATA Download datasets for samples/benchmarks ON -

1 deepworks uses Google Test as default framework to run unit tests. No pre-installation required, it's automatically downloaded during CMake configuration.

2 deepworks uses Eigen to CPU backend. No pre-installation required, it's automatically downloaded during CMake configuration.

Examples

Construct simple neural network

dw::Placeholder in(dw::Shape{64, 100});

auto out = dw::Linear(50, "linear_0")(in);
out = dw::ReLU("relu_1")(out);
out = dw::Linear(10, "linear_2")(out);
out = dw::Softmax("probs")(out);

dw::Model model(in, out);

dw::Tensor input(in.shape());
dw::initializer::uniform(input);

model.compile();

dw::Tensor output(model.outputs()[0].shape());
model.forward(input, output);

Samples

Comparison with other libraries

License

GNU General Public License v3.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published