[MSLITE] fp32 check code

This commit is contained in:
ling 2021-09-27 20:07:05 +08:00
parent e0c8e1bc73
commit 0c7027dda6
14 changed files with 8 additions and 37 deletions

View File

@ -22,7 +22,6 @@
// brief provide an asynchronous programming framework as Actor model
namespace mindspore {
struct MindrtAddress {
std::string scheme;
std::string ip;
@ -71,6 +70,5 @@ int GetHttpKmsgFlag();
// brief set flag of http message format
void SetHttpKmsgFlag(int flag);
} // namespace mindspore
#endif

View File

@ -85,7 +85,6 @@ void ActorBase::Run() {
if (msg == nullptr) {
continue;
}
// std::cout << "dequeue message]actor=" << id.Name() << ",msg=" << msg->Name() << std::endl;
AddMsgRecord(msg->Name());
switch (msg->GetType()) {
case MessageBase::Type::KMSG:

View File

@ -24,7 +24,6 @@
#include "actor/iomgr.h"
namespace mindspore {
ActorMgr ActorMgr::actorMgr;
std::map<std::string, std::shared_ptr<IOMgr>> ActorMgr::ioMgrs;
@ -232,9 +231,7 @@ AID ActorMgr::Spawn(const ActorReference &actor, bool shareThread, bool start) {
MS_LOG(ERROR) << "The actor's name conflicts,name:" << actor->GetAID().Name().c_str();
MINDRT_EXIT("Actor name conflicts.");
}
MS_LOG(DEBUG) << "ACTOR was spawned,a=" << actor->GetAID().Name().c_str();
std::unique_ptr<ActorPolicy> threadPolicy;
if (shareThread) {
@ -285,5 +282,4 @@ void ActorMgr::Wait(const AID &id) {
actor->Await();
}
}
}; // end of namespace mindspore

View File

@ -19,7 +19,6 @@
#include "actor/actorpolicy.h"
namespace mindspore {
void ActorPolicy::SetRunningStatus(bool startRun) {
std::lock_guard<std::mutex> lock(mailboxLock);
this->start = startRun;
@ -44,12 +43,10 @@ int SingleThread::EnqueMessage(std::unique_ptr<MessageBase> &&msg) {
enqueMailbox->push_back(std::move(msg));
result = ++msgCount;
}
// Notify when the count of message is from empty to one.
if (start && result == 1) {
conditionVar.notify_one();
}
return result;
}
void SingleThread::Notify() {
@ -66,7 +63,6 @@ std::list<std::unique_ptr<MessageBase>> *SingleThread::GetMsgs() {
// REF_PRIVATE_MEMBER
result = dequeMailbox;
return result;
}
@ -119,10 +115,7 @@ std::list<std::unique_ptr<MessageBase>> *ShardedThread::GetMsgs() {
SwapMailbox();
result = dequeMailbox;
}
mailboxLock.unlock();
return result;
}
}; // end of namespace mindspore

View File

@ -17,7 +17,6 @@
#include "actor/aid.h"
namespace mindspore {
constexpr int PORTMINNUMBER = 0;
constexpr int PORTMAXNUMBER = 65535;
constexpr int PROCOLLEN = 3; // strlen("://");
@ -83,10 +82,8 @@ void AID::SetProtocol(const std::string &protocol) {
} else {
url = protocol + url.substr(index);
}
} else {
if (protocol == MINDRT_TCP) {
// url = url;
} else {
url = protocol + "://" + url;
}
@ -125,5 +122,4 @@ uint16_t AID::GetPort() const {
}
return (uint16_t)std::stoul(url.substr(index + 1));
}
}; // end of namespace mindspore

View File

@ -18,11 +18,9 @@
namespace mindspore {
namespace internal {
void Waitf(const AID &aid) {
mindspore::Terminate(aid);
MS_LOG(WARNING) << "WaitFor is timeout.";
}
} // namespace internal
} // namespace mindspore

View File

@ -21,7 +21,6 @@
namespace mindspore {
namespace uuids {
constexpr int DASH_POS0 = 4;
constexpr int DASH_POS1 = 6;
constexpr int DASH_POS2 = 8;
@ -45,7 +44,6 @@ Option<uuid> uuid::FromBytes(const std::string &s) {
}
uuid u;
memcpy(&u.uuidData, s.data(), s.size());
return Option<uuid>(u);
}
@ -116,7 +114,6 @@ bool uuid::IsNilUUID() const {
return false;
}
}
return true;
}
@ -142,7 +139,6 @@ uuid RandomBasedGenerator::GenerateRandomUuid() {
// We use uniform distribution
std::uniform_int_distribution<uint64_t> distribution((std::numeric_limits<uint64_t>::min)(),
(std::numeric_limits<uint64_t>::max)());
uint64_t randomValue = distribution(gen);
unsigned int i = 0;
@ -151,7 +147,6 @@ uuid RandomBasedGenerator::GenerateRandomUuid() {
randomValue = distribution(gen);
i = 0;
}
*it = static_cast<uint8_t>((randomValue >> (i * RIGHT_SHIFT_BITS)) & 0xFF);
}
@ -171,6 +166,5 @@ uuid RandomBasedGenerator::GenerateRandomUuid() {
return tmpUUID;
}
} // namespace uuids
} // namespace mindspore

View File

@ -19,7 +19,6 @@
#include <climits>
namespace mindspore {
namespace uuid_generator {
UUID UUID::GetRandomUUID() { return UUID(mindspore::uuids::RandomBasedGenerator::GenerateRandomUuid()); }
@ -55,7 +54,5 @@ int GenHttpServerConnId() {
return httpServerConnId++;
}
#endif
} // namespace localid_generator
} // namespace mindspore

View File

@ -48,7 +48,7 @@ int CumsumLaunch(void *cdata, int task_id, float lhs_scale, float rhs_scale) {
} // namespace
int CumSumCPUKernel::Init() {
CHECK_LESS_RETURN(in_tensors_.size(), 2);
CHECK_LESS_RETURN(in_tensors_.size(), kInputSize1);
CHECK_LESS_RETURN(out_tensors_.size(), 1);
CHECK_NULL_RETURN(param_);
if (!InferShapeDone()) {

View File

@ -29,7 +29,7 @@ using mindspore::schema::PrimitiveType_Fill;
namespace mindspore::kernel {
int FillCPUKernel::Init() {
CHECK_LESS_RETURN(in_tensors_.size(), 2);
CHECK_LESS_RETURN(in_tensors_.size(), kInputSize1);
CHECK_LESS_RETURN(out_tensors_.size(), 1);
if (!InferShapeDone()) {
return RET_OK;

View File

@ -30,7 +30,7 @@ namespace {
constexpr int kSecondInput = 2;
}
int GatherCPUKernel::Init() {
CHECK_LESS_RETURN(in_tensors_.size(), 3);
CHECK_LESS_RETURN(in_tensors_.size(), kInputSize2);
CHECK_LESS_RETURN(out_tensors_.size(), 1);
CHECK_NULL_RETURN(in_tensors_.at(kSecondInput)->data());
axis_ = *(reinterpret_cast<int *>(in_tensors_.at(kSecondInput)->data()));

View File

@ -27,7 +27,7 @@ using mindspore::schema::PrimitiveType_LayerNormFusion;
namespace mindspore::kernel {
int LayerNormCPUKernel::Init() {
CHECK_LESS_RETURN(in_tensors_.size(), 3);
CHECK_LESS_RETURN(in_tensors_.size(), kInputSize2);
CHECK_LESS_RETURN(out_tensors_.size(), 1);
CHECK_NULL_RETURN(param_);
if (!InferShapeDone()) {

View File

@ -42,7 +42,7 @@ int LocalResponseNormCPUKernel::DoLocalResponseNorm(int task_id) {
auto output_ptr = reinterpret_cast<float *>(out_tensor->MutableData());
auto in_shape = input_tensor->shape();
MS_CHECK_TRUE_RET(in_shape.size() == 4, RET_ERROR);
MS_CHECK_TRUE_RET(in_shape.size() == C4NUM, RET_ERROR);
int batch = in_shape.at(0);
int height = in_shape.at(1);

View File

@ -214,11 +214,11 @@ int LstmCPUKernel::InitParam() {
}
int LstmCPUKernel::Init() {
CHECK_LESS_RETURN(in_tensors_.size(), 6);
CHECK_LESS_RETURN(in_tensors_.size(), DIMENSION_6D);
for (size_t i = 0; i < in_tensors_.size(); i++) {
CHECK_NULL_RETURN(in_tensors_.at(i));
}
CHECK_LESS_RETURN(out_tensors_.size(), 3);
CHECK_LESS_RETURN(out_tensors_.size(), DIMENSION_3D);
for (size_t i = 0; i < out_tensors_.size(); i++) {
CHECK_NULL_RETURN(out_tensors_.at(i));
}
@ -254,7 +254,7 @@ int LstmCPUKernel::ReSize() {
}
int LstmCPUKernel::MallocRunBuffer() {
for (int i = 0; i < 7; i++) {
for (int i = 0; i < DIMENSION_7D; i++) {
buffer_[i] = nullptr;
}
buffer_[packed_input_index] = reinterpret_cast<float *>(