Skip to content
Snippets Groups Projects
Commit 48f847dc authored by kotsifa2's avatar kotsifa2
Browse files

Additions to tensor runtime.

Implementation of tensor group convolution wrapper API
New wrapper API for clipped relu, and implementation

To be tested, with the other wrapper API calls.
parent 596d31f9
No related branches found
No related tags found
No related merge requests found
......@@ -1787,6 +1787,7 @@ void* wrapper_ConvLayer(const char* hpvm_node_id,
else
assert(false && "Unsupported Configuration");
return NULL;
}
......@@ -1924,7 +1925,7 @@ void* wrapper_FCLayer(const char* hpvm_node_id,
else
assert(false && "Unsupported Configuration");
return NULL;
}
......@@ -1952,6 +1953,27 @@ void* wrapper_tensorRelu(const char* hpvm_node_id, void* input_ptr){
}
void* wrapper_tensorClippedRelu(const char* hpvm_node_id,
void* input_ptr,
float out_min, float out_max){
// Only mapped to GPU - get a GPU configuration
GPUNodeConfiguration *GPUConf =
(GPUNodeConfiguration *)RC->getNodeConfiguration(hpvm_node_id);
std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP,
std::vector< std::pair<GPUNodeConfiguration::APPROX,
int> > > > &ApproxChoices =
GPUConf->getApproxChoices();
// Approximation choices must be for a relu operation
assert(ApproxChoices.size() == 1 &&
ApproxChoices[0].first == GPUNodeConfiguration::TENSOR_OP::CLIPPED_RELU &&
"Invalid configuration generated for tensor clipped relu wrapper operation");
return handleTensorClippedReluApproximationTuples(ApproxChoices[0].second,
input_ptr, out_min, out_max);
}
void* wrapper_tensorTanh(const char* hpvm_node_id, void* input_ptr){
// return tensorTanh(input_ptr);
......@@ -2062,11 +2084,30 @@ void* wrapper_tensorPooling(const char* hpvm_node_id,
}
void* wrapper_tensorGroupConvolution(const char* hpvm_node_id, void* input, void* filter,
int vertical_pad, int horizontal_pad,
int vertical_stride, int horizontal_stride,
int conv_mode, int conv_groups){
void* wrapper_tensorGroupConvolution(const char* hpvm_node_id,
void* input, void* filter,
int vertical_pad, int horizontal_pad,
int vertical_stride, int horizontal_stride,
int conv_mode, int conv_groups){
// Only mapped to GPU - get a GPU configuration
GPUNodeConfiguration *GPUConf =
(GPUNodeConfiguration *)RC->getNodeConfiguration(hpvm_node_id);
std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP,
std::vector< std::pair<GPUNodeConfiguration::APPROX,
int> > > > &ApproxChoices =
GPUConf->getApproxChoices();
// Approximation choices must be for a group_conv operation
assert(ApproxChoices.size() == 1 &&
ApproxChoices[0].first == GPUNodeConfiguration::TENSOR_OP::GROUP_CONV &&
"Invalid configuration generated for tensor group_conv wrapper operation");
return handleTensorGroupConvApproximationTuples(ApproxChoices[0].second,
input, filter,
vertical_pad, horizontal_pad,
vertical_stride, horizontal_stride,
conv_mode, conv_groups);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment