forked from mindspore-Ecosystem/mindspore
!28783 code clean
Merge pull request !28783 from chenweifeng/code-clean-220110
This commit is contained in:
commit
3e86bf224d
|
@ -40,9 +40,6 @@ class MatMulGpuKernel : public GpuKernel {
|
|||
|
||||
bool Launch(const std::vector<AddressPtr> &inputs, const std::vector<AddressPtr> &workspace,
|
||||
const std::vector<AddressPtr> &outputs, void *stream_ptr) override {
|
||||
if (is_null_input_) {
|
||||
return true;
|
||||
}
|
||||
CHECK_CUBLAS_RET_WITH_ERROR(cublasSetStream(handle_, reinterpret_cast<cudaStream_t>(stream_ptr)),
|
||||
"cublasSetStream failed");
|
||||
VARIABLE_NOT_USED(workspace);
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
#include "backend/kernel_compiler/gpu/trt/trt_kernel.h"
|
||||
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include "backend/kernel_compiler/gpu/data/dataset_utils.h"
|
||||
#include "backend/kernel_compiler/gpu/trt/trt_utils.h"
|
||||
#include "backend/kernel_compiler/common_utils.h"
|
||||
|
@ -78,9 +80,9 @@ bool TrtKernel::Launch(const std::vector<AddressPtr> &inputs, const std::vector<
|
|||
MS_EXCEPTION_IF_NULL(context_);
|
||||
std::vector<void *> device_buffer;
|
||||
std::transform(std::begin(inputs), std::end(inputs), std::back_inserter(device_buffer),
|
||||
[](const AddressPtr &input) -> void * { return input->addr; });
|
||||
[](const AddressPtr &input) { return input->addr; });
|
||||
std::transform(std::begin(outputs), std::end(outputs), std::back_inserter(device_buffer),
|
||||
[](const AddressPtr &output) -> void * { return output->addr; });
|
||||
[](const AddressPtr &output) { return output->addr; });
|
||||
return context_->enqueueV2(device_buffer.data(), reinterpret_cast<cudaStream_t>(stream), nullptr);
|
||||
}
|
||||
} // namespace kernel
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include <string>
|
||||
|
|
|
@ -360,7 +360,7 @@ MS_TRT_CONVERTER_FUNC_REG(ReLU6) {
|
|||
dim.nbDims = SizeToInt(x_shape.size());
|
||||
std::fill(dim.d, dim.d + dim.nbDims, 1);
|
||||
|
||||
auto AddConst = [&context, &dim](const float &coeff) -> nvinfer1::ITensor * {
|
||||
auto AddConst = [&context, &dim](const float &coeff) {
|
||||
std::shared_ptr<tensor::Tensor> weight = context->CreateTempWeight(kNumberTypeFloat32, {1});
|
||||
auto value = static_cast<float *>(weight->data_c());
|
||||
value[0] = coeff;
|
||||
|
@ -395,7 +395,7 @@ MS_TRT_CONVERTER_FUNC_REG(GeLU) {
|
|||
dim.nbDims = SizeToInt(x_shape.size());
|
||||
std::fill(dim.d, dim.d + dim.nbDims, 1);
|
||||
|
||||
auto AddConst = [&context, &dim](const float &coeff) -> nvinfer1::ITensor * {
|
||||
auto AddConst = [&context, &dim](const float &coeff) {
|
||||
std::shared_ptr<tensor::Tensor> weight = context->CreateTempWeight(kNumberTypeFloat32, {1});
|
||||
auto value = static_cast<float *>(weight->data_c());
|
||||
value[0] = coeff;
|
||||
|
@ -446,7 +446,7 @@ MS_TRT_CONVERTER_FUNC_REG(HSigmoid) {
|
|||
dim.nbDims = SizeToInt(x_shape.size());
|
||||
std::fill(dim.d, dim.d + dim.nbDims, 1);
|
||||
|
||||
auto AddConst = [&context, &dim](const float &coeff) -> nvinfer1::ITensor * {
|
||||
auto AddConst = [&context, &dim](const float &coeff) {
|
||||
std::shared_ptr<tensor::Tensor> weight = context->CreateTempWeight(kNumberTypeFloat32, {1});
|
||||
auto value = static_cast<float *>(weight->data_c());
|
||||
value[0] = coeff;
|
||||
|
@ -487,7 +487,7 @@ MS_TRT_CONVERTER_FUNC_REG(HSwish) {
|
|||
dim.nbDims = SizeToInt(x_shape.size());
|
||||
std::fill(dim.d, dim.d + dim.nbDims, 1);
|
||||
|
||||
auto AddConst = [&context, &dim](const float &coeff) -> nvinfer1::ITensor * {
|
||||
auto AddConst = [&context, &dim](const float &coeff) {
|
||||
std::shared_ptr<tensor::Tensor> weight = context->CreateTempWeight(kNumberTypeFloat32, {1});
|
||||
auto value = static_cast<float *>(weight->data_c());
|
||||
value[0] = coeff;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
|
||||
#include "backend/session/gpu_inference_session.h"
|
||||
#include <algorithm>
|
||||
#include "ir/tensor.h"
|
||||
#include "ir/anf.h"
|
||||
#include "ir/param_info.h"
|
||||
|
|
|
@ -119,7 +119,6 @@ void DynamicKernel::InferShapeForNopNode(AnfNodePtr *input_node) {
|
|||
std::stack<AnfNodePtr> nop_road;
|
||||
nop_road.push(*input_node);
|
||||
|
||||
/*lint -e716*/
|
||||
while (true) {
|
||||
auto input_node_with_idx = AnfAlgo::GetPrevNodeOutput(*input_node, 0);
|
||||
auto in_node = input_node_with_idx.first;
|
||||
|
@ -131,7 +130,6 @@ void DynamicKernel::InferShapeForNopNode(AnfNodePtr *input_node) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
/*lint +e716*/
|
||||
|
||||
while (!nop_road.empty()) {
|
||||
auto nop_node = nop_road.top();
|
||||
|
|
Loading…
Reference in New Issue