Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
code specification
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaotaoChen committed Dec 12, 2018
1 parent 2ba108f commit e70998e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/operator/tensor/elemwise_unary_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <vector>
#include <utility>
#include <algorithm>
#include <climits>
#include "./cast_storage-inl.h"
#include "../mshadow_op.h"
#include "../mxnet_op.h"
Expand All @@ -37,7 +38,6 @@
#if MSHADOW_USE_MKL == 1
#include "mkl.h"
#endif
#include<climits>

namespace mxnet {
namespace op {
Expand Down Expand Up @@ -376,11 +376,12 @@ class UnaryOp : public OpBase {
auto type_flag = inputs[0].type_flag_;
const size_t MKL_INT_MAX = (sizeof(MKL_INT) == sizeof(int)) ? INT_MAX : LLONG_MAX;
size_t input_size = inputs[0].Size();
if (req[0] == kWriteTo && (type_flag == mshadow::kFloat32
|| type_flag == mshadow::kFloat64) && input_size <= MKL_INT_MAX) {
if (req[0] == kWriteTo &&
input_size <= MKL_INT_MAX &&
(type_flag == mshadow::kFloat32 || type_flag == mshadow::kFloat64)) {
MSHADOW_SGL_DBL_TYPE_SWITCH(type_flag, DType, {
MKLLog(input_size, inputs[0].dptr<DType>(), outputs[0].dptr<DType>());
})
});
} else {
Compute<xpu, OP>(attrs, ctx, inputs, req, outputs);
}
Expand Down

0 comments on commit e70998e

Please sign in to comment.