You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#include "cuda.h"
#include "../layers/routeLayer.h"
void gpuCUDA::forward_layer(routeLayer *layer, cortexSTATE state){ uint32_t offset = 0; for (uint32_t i = 0; i < layer->m_nN; ++i){ uint32_t index = layer->m_pInputLayers[i]; uint32_t input_size = layer->m_pInputSizes[i]; float *input = state.net->getLayer(index)->m_pGpuOutput; for (uint32_t j = 0; j < layer->m_nBatch; ++j){ makeCopy(input_size, input + j*input_size, 1, layer->m_pGpuOutput + offset + j*layer->m_nOutput, 1); }; offset += input_size; };};
void gpuCUDA::backward_layer(routeLayer *layer, cortexSTATE state){ uint32_t offset = 0; for (uint32_t i = 0; i < layer->m_nN; ++i){ uint32_t index = layer->m_pInputLayers[i]; uint32_t input_size = layer->m_pInputSizes[i]; float *delta = state.net->getLayer(index)->m_pGpuDelta; for (uint32_t j = 0; j < layer->m_nBatch; ++j){ calcAxpy(input_size, 1, layer->m_pGpuDelta + offset + j*layer->m_nOutput, 1, delta + j*input_size, 1); }; offset += input_size; };};
|