forked from mindspore-Ecosystem/mindspore
!29577 solve code format issue
Merge pull request !29577 from zhujingxuan/code_format
This commit is contained in:
commit
39fee2393d
|
@ -18,7 +18,6 @@
|
|||
#include <Eigen/Dense>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
namespace mindspore {
|
||||
namespace kernel {
|
||||
using Eigen::ColMajor;
|
||||
|
@ -105,7 +104,7 @@ inline void solve(const MatrixBase<Derived_A> &A, const MatrixBase<Derived_b> &b
|
|||
|
||||
template <typename T>
|
||||
bool SolveTriangularCpuKernelMod<T>::Launch(const std::vector<AddressPtr> &inputs,
|
||||
const std::vector<AddressPtr> &workspace,
|
||||
const std::vector<AddressPtr> & /* workspace */,
|
||||
const std::vector<AddressPtr> &outputs) {
|
||||
CHECK_KERNEL_INPUTS_NUM(inputs.size(), kSolveTriangularInputsNum, kernel_name_);
|
||||
CHECK_KERNEL_OUTPUTS_NUM(outputs.size(), kSolveTriangularOutputsNum, kernel_name_);
|
||||
|
|
|
@ -84,7 +84,7 @@ template <typename T>
|
|||
void RankCpuKernelMod<T>::SetFunc() {
|
||||
switch (method_) {
|
||||
case Method::Max: {
|
||||
func_ = [](size_t i, size_t duplicate_count, int culmutive_rank, const AxisIterator &axisIterator,
|
||||
func_ = [](size_t i, size_t duplicate_count, int /* culmutive_rank */, const AxisIterator &axisIterator,
|
||||
const size_t *const sort_idx, float *const output_addr) {
|
||||
for (size_t j = i - duplicate_count + 1; j < i + 1; ++j) {
|
||||
output_addr[axisIterator.GetPos(sort_idx[j])] = i + 1;
|
||||
|
@ -92,7 +92,7 @@ void RankCpuKernelMod<T>::SetFunc() {
|
|||
};
|
||||
} break;
|
||||
case Method::Min: {
|
||||
func_ = [](size_t i, size_t duplicate_count, int culmutive_rank, const AxisIterator &axisIterator,
|
||||
func_ = [](size_t i, size_t duplicate_count, int /* culmutive_rank */, const AxisIterator &axisIterator,
|
||||
const size_t *const sort_idx, float *const output_addr) {
|
||||
for (size_t j = i - duplicate_count + 1; j < i + 1; ++j) {
|
||||
output_addr[axisIterator.GetPos(sort_idx[j])] = i - duplicate_count + 2;
|
||||
|
@ -105,7 +105,7 @@ void RankCpuKernelMod<T>::SetFunc() {
|
|||
// = duplicate_count * (2 * i - duplicate_count + 1) / 2
|
||||
// rank_sum = sum + duplicate_count = duplicate_count * (2 * i - duplicate_count + 3) / 2
|
||||
// avg = rank_sum / duplicate_count = (2 * i - duplicate_count + 3) / 2
|
||||
func_ = [](size_t i, size_t duplicate_count, int culmutive_rank, const AxisIterator &axisIterator,
|
||||
func_ = [](size_t i, size_t duplicate_count, int /* culmutive_rank */, const AxisIterator &axisIterator,
|
||||
const size_t *const sort_idx, float *const output_addr) {
|
||||
float avg = (2 * i - duplicate_count + 3) / 2.0;
|
||||
for (size_t j = i - duplicate_count + 1; j < i + 1; ++j) {
|
||||
|
@ -114,7 +114,7 @@ void RankCpuKernelMod<T>::SetFunc() {
|
|||
};
|
||||
} break;
|
||||
case Method::First: {
|
||||
func_ = [](size_t i, size_t duplicate_count, int culmutive_rank, const AxisIterator &axisIterator,
|
||||
func_ = [](size_t i, size_t duplicate_count, int /* culmutive_rank */, const AxisIterator &axisIterator,
|
||||
const size_t *const sort_idx, float *const output_addr) {
|
||||
for (size_t j = i - duplicate_count + 1; j < i + 1; ++j) {
|
||||
output_addr[axisIterator.GetPos(sort_idx[j])] = j + 1;
|
||||
|
@ -201,7 +201,7 @@ void RankCpuKernelMod<T>::Launch1D(const T *input_addr, size_t *sort_idx, T *val
|
|||
|
||||
int culmutive_rank = 1;
|
||||
size_t duplicate_count = 0;
|
||||
int nans_count = 0;
|
||||
size_t nans_count = 0;
|
||||
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
duplicate_count++;
|
||||
|
@ -226,7 +226,7 @@ void RankCpuKernelMod<T>::Launch1D(const T *input_addr, size_t *sort_idx, T *val
|
|||
|
||||
template <typename T>
|
||||
void RankCpuKernelMod<T>::PctConvert(float *output_addr, const AxisIterator &iter, int culmutive_rank,
|
||||
int nans_count) const {
|
||||
size_t nans_count) const {
|
||||
const size_t n = iter.AxisSize();
|
||||
if (pct_) {
|
||||
// pct calculation
|
||||
|
|
|
@ -79,7 +79,7 @@ class RankCpuKernelMod : public NativeCpuKernelMod {
|
|||
return std::numeric_limits<T>::min();
|
||||
}
|
||||
}
|
||||
void PctConvert(float *output_addr, const AxisIterator &iter, int culmutive_rank, int nans_count) const;
|
||||
void PctConvert(float *output_addr, const AxisIterator &iter, int culmutive_rank, size_t nans_count) const;
|
||||
void PctConvert(float *output_addr, const AxisIterator &iter, int culmutive_rank) const;
|
||||
// shape info
|
||||
AxisIterator axisIterator_{};
|
||||
|
|
Loading…
Reference in New Issue