forked from mindspore-Ecosystem/mindspore
!6481 add MS_EXCEPTION_IF_NULL for some variables
Merge pull request !6481 from maning202007/checknull
This commit is contained in:
commit
709ee383e9
|
@ -598,7 +598,9 @@ void AscendSession::LoadTensor(const std::shared_ptr<KernelGraph> &kernel_graph)
|
|||
auto runtime_instance = device::KernelRuntimeManager::Instance().GetKernelRuntime(kAscendDevice, device_id_);
|
||||
MS_EXCEPTION_IF_NULL(runtime_instance);
|
||||
DebugServices *debug_services = debugger_->debug_services();
|
||||
MS_EXCEPTION_IF_NULL(debug_services);
|
||||
TensorLoader *tensor_loader = debug_services->tensor_loader();
|
||||
MS_EXCEPTION_IF_NULL(tensor_loader);
|
||||
// TensorData will be freed up here
|
||||
tensor_loader->EmptyTensor();
|
||||
uint32_t iter_num = tensor_loader->GetIterNum();
|
||||
|
|
|
@ -126,7 +126,7 @@ void Debugger::EnableDebugger() {
|
|||
MS_LOG(INFO) << "Getenv MS_DEBUGGER_PORT: " << env_port_str;
|
||||
port = std::string(env_port_str);
|
||||
} else {
|
||||
MS_LOG(ERROR) << "Environment variable MS_DEBUGGER_PORT is not valid. Custom port ranging from 0 to 65535";
|
||||
MS_LOG(ERROR) << "Environment variable MS_DEBUGGER_PORT is not valid. Custom port ranging from 1 to 65535";
|
||||
debugger_enabled_ = false;
|
||||
}
|
||||
} else {
|
||||
|
@ -180,6 +180,7 @@ void Debugger::EnableDebugger() {
|
|||
}
|
||||
}
|
||||
MS_LOG(INFO) << "last op overflow bin folder" << last_overflow_bin_;
|
||||
closedir(d);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -824,9 +825,9 @@ bool Debugger::CheckPort(const char *port) {
|
|||
int num = 0;
|
||||
if (*p == '0' && *(p + 1) != '\0') return false;
|
||||
while (*p != '\0') {
|
||||
if (*p <= '0' && *p >= '9') return false;
|
||||
if (*p < '0' || *p > '9') return false;
|
||||
num = num * 10 + (*p) - '0';
|
||||
if (num < 0 || num > 65535) return false;
|
||||
if (num < 1 || num > 65535) return false;
|
||||
p++;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -668,7 +668,9 @@ bool AscendDeviceAddress::LoadMemToHost(bool trans_flag, const std::string &tens
|
|||
size_t slot, Debugger *debugger, bool keep_prev) const {
|
||||
bool ret = false;
|
||||
DebugServices *debug_services = debugger->debug_services();
|
||||
MS_EXCEPTION_IF_NULL(debug_services);
|
||||
TensorLoader *tensor_loader = debug_services->tensor_loader();
|
||||
MS_EXCEPTION_IF_NULL(tensor_loader);
|
||||
// TensorData is freed up in AscendSession class
|
||||
auto tensor_data = std::make_shared<mindspore::TensorData>();
|
||||
tensor_data->SetName(tensor_name);
|
||||
|
|
|
@ -252,6 +252,7 @@ void LoadOutput(mindspore::session::KernelGraph *graph, Debugger *debugger) {
|
|||
auto format = kOpFormat_DEFAULT;
|
||||
string tensor_name = kernel_name + ':' + std::to_string(j);
|
||||
auto ascend_addr = dynamic_cast<const mindspore::device::ascend::AscendDeviceAddress *>(addr);
|
||||
MS_EXCEPTION_IF_NULL(ascend_addr);
|
||||
ShapeVector int_shapes;
|
||||
if (trans_flag) {
|
||||
int_shapes = trans::GetRuntimePaddingShape(node, j);
|
||||
|
@ -288,6 +289,7 @@ void LoadParameters(mindspore::session::KernelGraph *graph, Debugger *debugger)
|
|||
auto format = kOpFormat_DEFAULT;
|
||||
string tensor_name = parameter_name + ':' + "0";
|
||||
auto ascend_addr = dynamic_cast<const mindspore::device::ascend::AscendDeviceAddress *>(addr);
|
||||
MS_EXCEPTION_IF_NULL(ascend_addr);
|
||||
ShapeVector int_shapes;
|
||||
if (trans_flag) {
|
||||
int_shapes = trans::GetRuntimePaddingShape(item, PRAMATER_OUTPUT_INDEX);
|
||||
|
|
Loading…
Reference in New Issue