forked from mindspore-Ecosystem/mindspore
!7676 [MD] fix arm compile error
Merge pull request !7676 from liyong126/fix_arm_env
This commit is contained in:
commit
c5867d2d7e
|
@ -707,11 +707,37 @@ Status TensorVectorToBatchTensor(const std::vector<std::shared_ptr<Tensor>> &inp
|
|||
return Status::OK();
|
||||
}
|
||||
|
||||
#ifndef ENABLE_ANDROID
|
||||
template <typename T>
|
||||
struct UniqueOpHashMap {
|
||||
using map_type = std::unordered_map<T, int32_t>;
|
||||
};
|
||||
#ifndef ENABLE_ANDROID
|
||||
template <>
|
||||
struct UniqueOpHashMap<float16> {
|
||||
using map_type = std::unordered_map<float16, int32_t>;
|
||||
};
|
||||
|
||||
#else
|
||||
struct gn_hash {
|
||||
size_t operator()(const float16 &f) const { return static_cast<std::size_t>(f); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct UniqueOpHashMap<float16> {
|
||||
using map_type = std::unordered_map<float16, int32_t, gn_hash>;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template <>
|
||||
struct UniqueOpHashMap<float> {
|
||||
using map_type = std::unordered_map<float, int32_t>;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct UniqueOpHashMap<double> {
|
||||
using map_type = std::unordered_map<double, int32_t>;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
Status UniqueHelper(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output,
|
||||
|
@ -780,7 +806,6 @@ Status Unique(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *out
|
|||
}
|
||||
return Status::OK();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace dataset
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#ifndef ENABLE_ANDROID
|
||||
#include <unordered_map>
|
||||
#endif
|
||||
#include "minddata/dataset/core/constants.h"
|
||||
#include "minddata/dataset/core/cv_tensor.h"
|
||||
#include "minddata/dataset/core/data_type.h"
|
||||
|
@ -179,7 +177,6 @@ Status BatchTensorToTensorVector(const std::shared_ptr<Tensor> &input, std::vect
|
|||
/// \return Status ok/error
|
||||
Status TensorVectorToBatchTensor(const std::vector<std::shared_ptr<Tensor>> &input, std::shared_ptr<Tensor> *output);
|
||||
|
||||
#ifndef ENABLE_ANDROID
|
||||
/// Helper method that uniques the input tensor
|
||||
/// @tparam T type of the tensor
|
||||
/// \param input[in] input 1d tensor
|
||||
|
@ -200,7 +197,6 @@ Status UniqueHelper(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor
|
|||
/// \return Status ok/error
|
||||
Status Unique(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output,
|
||||
std::shared_ptr<Tensor> *output_idx, std::shared_ptr<Tensor> *output_cnt);
|
||||
#endif
|
||||
} // namespace dataset
|
||||
} // namespace mindspore
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ namespace mindspore {
|
|||
namespace dataset {
|
||||
|
||||
Status UniqueOp::Compute(const TensorRow &input, TensorRow *output) {
|
||||
#ifndef ENABLE_ANDROID
|
||||
IO_CHECK_VECTOR(input, output);
|
||||
CHECK_FAIL_RETURN_UNEXPECTED(input.size() == 1, "Input should be one tensor");
|
||||
|
||||
|
@ -47,7 +46,6 @@ Status UniqueOp::Compute(const TensorRow &input, TensorRow *output) {
|
|||
output->push_back(out);
|
||||
output->push_back(out_idx);
|
||||
output->push_back(out_cnt);
|
||||
#endif
|
||||
return Status::OK();
|
||||
}
|
||||
} // namespace dataset
|
||||
|
|
|
@ -31,8 +31,7 @@ def compare(array, res, idx, cnt):
|
|||
np.testing.assert_array_equal(idx, d["y"])
|
||||
np.testing.assert_array_equal(cnt, d["z"])
|
||||
|
||||
# the test function name code will be start with 'test' later
|
||||
def duplicate_basics():
|
||||
def test_duplicate_basics():
|
||||
compare([0, 1, 2, 1, 2, 3], np.array([0, 1, 2, 3]),
|
||||
np.array([0, 1, 2, 1, 2, 3]), np.array([1, 2, 2, 1]))
|
||||
compare([0.0, 1.0, 2.0, 1.0, 2.0, 3.0], np.array([0.0, 1.0, 2.0, 3.0]),
|
||||
|
|
Loading…
Reference in New Issue