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

Commit

Permalink
Remove some data type conversion warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
anko-intel committed Nov 10, 2020
1 parent 137663f commit a649634
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/operator/linalg_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ lapack_index_t linalg_getri_workspace_query<cpu, DType>(const Tensor<cpu, 2, DTy
DType lwork(0); \
MXNET_LAPACK_##func(MXNET_LAPACK_COL_MAJOR, A.size(0), A.dptr_, \
A.stride_, nullptr, &lwork, -1); \
return lwork; \
return static_cast<lapack_index_t>(lwork); \
}

LINALG_CPU_GETRI_WORKSPACE_QUERY(sgetri, float)
Expand Down
17 changes: 9 additions & 8 deletions src/operator/numpy/linalg/np_lstsq-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ linalg_gelsd_workspace_query<cpu, DType, IndexT>(const IndexT nrow, \
&temp_work, -1, &temp_iwork); \
CHECK_GE(info, 0) << "MXNET_LAPACK_" << #func << ": " \
<< "the " << -info << "-th argument had an illegal value"; \
*lwork = temp_work; \
*lwork = static_cast<IndexT>(temp_work); \
*liwork = temp_iwork; \
return; \
}
Expand Down Expand Up @@ -260,10 +260,10 @@ inline bool GetOutputShapes(const mxnet::TShape& a_shape,
}
const int a_ndim = a_shape.ndim();
const int b_ndim = b_shape.ndim();
const int a_nrow = a_shape[0];
const int a_ncol = a_shape[1];
const int b_nrow = b_shape[0];
const int b_nrhs = b_ndim == 2 ? b_shape[1] : 1;
const dim_t a_nrow = a_shape[0];
const dim_t a_ncol = a_shape[1];
const dim_t b_nrow = b_shape[0];
const dim_t b_nrhs = b_ndim == 2 ? b_shape[1] : 1;
CHECK_EQ(a_ndim, 2) << a_ndim
<< "-dimensional array given. Array must be two-dimensional";
CHECK(b_ndim == 1 || b_ndim == 2) << b_ndim
Expand All @@ -272,20 +272,21 @@ inline bool GetOutputShapes(const mxnet::TShape& a_shape,
<< "Incompatible dimensions of inputs";
// x_shape
if (b_ndim == 2) {
std::vector<int> x_shape_vec({a_ncol, b_nrhs});
std::vector<dim_t> x_shape_vec({a_ncol, b_nrhs});
SHAPE_ASSIGN_CHECK(*out_attrs, 0, mxnet::TShape(x_shape_vec.begin(), x_shape_vec.end()));
} else {
SHAPE_ASSIGN_CHECK(*out_attrs, 0, mxnet::TShape(1, a_ncol));
}
// temp_residuals_shape
SHAPE_ASSIGN_CHECK(*out_attrs, 1, mxnet::TShape(1, static_cast<dim_t>(std::max(1, b_nrhs))));
SHAPE_ASSIGN_CHECK(*out_attrs, 1, mxnet::TShape(1, std::max(dim_t(1), b_nrhs)));
// rank_shape
SHAPE_ASSIGN_CHECK(*out_attrs, 2, mxnet::TShape(0, 0));
// s_shape
if (a_nrow == 0 || a_ncol == 0) {
SHAPE_ASSIGN_CHECK(*out_attrs, 3, mxnet::TShape(1, 0));
} else {
SHAPE_ASSIGN_CHECK(*out_attrs, 3, mxnet::TShape(1, std::max(1, std::min(a_nrow, a_ncol))));
SHAPE_ASSIGN_CHECK(*out_attrs, 3, mxnet::TShape(1, std::max(dim_t(1),
std::min(a_nrow, a_ncol))));
}
return shape_is_known(*out_attrs);
}
Expand Down
2 changes: 1 addition & 1 deletion src/operator/numpy/linalg/np_solve-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ void LaOpBackwardSolve(const nnvm::NodeAttrs& attrs,
0 == b_shape[ndim - 1] || 0 == b_shape[ndim - 2]) { return; }

const Tensor<xpu, idim + 1, OType> A = a_tblob.FlatToKD<xpu, idim + 1, OType>(s);
int work_space_size = sizeof(OType) * a_shape.Size(); // for inverse(A)
size_t work_space_size = sizeof(OType) * a_shape.Size(); // for inverse(A)
work_space_size += sizeof(OType) * a_shape.Size(); // for getri work space
work_space_size += 2 * sizeof(OType) * b_shape.Size(); // for B and X
work_space_size += sizeof(IndexT) * A.size(0) * N; // for pivot work space
Expand Down

0 comments on commit a649634

Please sign in to comment.