nnlib
GPU-accelerated, C/C++ neural network library.
|
Source file defining methods of the Network class. More...
#include "../../include/network.h"
#include "../gpu/allocation_gpu.cuh"
#include "runtime.h"
#include <algorithm>
#include <chrono>
#include <cmath>
#include <ctime>
#include <exceptions/size_mismatch_exception.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <utils/printing.h>
#include <verify.cuh>
Classes | |
struct | EpochProgress |
Structure to contain information about the current epoch. More... | |
Functions | |
std::ostream & | operator<< (std::ostream &stream, const EpochProgress &epochProgress) |
A toString() method for EpochProgress. More... | |
std::vector< sTensor > | splitIntoBatches (const sTensor &data, size_t batchSize) |
Split the input matrix into batches. More... | |
Source file defining methods of the Network class.
std::ostream& operator<< | ( | std::ostream & | stream, |
const EpochProgress & | epochProgress | ||
) |
A toString() method for EpochProgress.
stream | The stream to append the string representation of EpochProgress to. |
epochProgress | The EpochProgress object to display. |
std::vector<sTensor> splitIntoBatches | ( | const sTensor & | data, |
size_t | batchSize | ||
) |
Split the input matrix into batches.
It is assumed that the data samples are row-aligned. Therefore, to split into batches, the input matrix is divided along the row axis, so that the data samples are not split.
For example, when splitting the following matrix using batchSize
= 2:
We get as the result a vector of the following two matrices:
If the size of data
is not divisible by batchSize
, the last batch will be smaller than the rest.
data | The matrix to split into batches. |
batchSize | The size of the batch to split on. |