Skip to content

Commit

Permalink
Merge "solve mobilenet-SSD assertion issue"
Browse files Browse the repository at this point in the history
  • Loading branch information
ftian1 authored and Gerrit Code Review committed Nov 30, 2017
2 parents 9d0a6e0 + 0be6eac commit a124ef8
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/caffe/mkldnn_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,13 @@ void MKLDNNMemoryDescriptor<Dtype, is_diff>::create_reorder_to_prv(void* cpu_ptr
CHECK(this->_usr_memory_pd);
CHECK(this->_prv_memory_pd);
CHECK(this->_reorder_usr2prv_pd);
if (this->_cpu_ptr == NULL)
this->_cpu_ptr = cpu_ptr;
else
CHECK_EQ(this->_cpu_ptr, cpu_ptr);
if(this->_usr_memory == NULL)

if(this->_usr_memory == NULL || this->_cpu_ptr != cpu_ptr)
this->_usr_memory.reset(new memory(*this->_usr_memory_pd, cpu_ptr));
if(this->_reorder_usr2prv.aprimitive == NULL)
if(this->_reorder_usr2prv.aprimitive == NULL || this->_cpu_ptr != cpu_ptr)
this->_reorder_usr2prv.reset(new reorder(*this->_reorder_usr2prv_pd, *this->_usr_memory, *this->get_prv_memory()));

this->_cpu_ptr = cpu_ptr;
}

template <typename Dtype, bool is_diff>
Expand Down Expand Up @@ -157,16 +156,13 @@ void MKLDNNMemoryDescriptor<Dtype, is_diff>::create_reorder_from_prv(void* cpu_p
CHECK(this->_usr_memory_pd);
CHECK(this->_prv_memory_pd);
CHECK(this->_reorder_prv2usr_pd);
if (this->_cpu_ptr == NULL)
this->_cpu_ptr = cpu_ptr;
else
CHECK_EQ(this->_cpu_ptr, cpu_ptr);
if(this->_usr_memory == NULL)
if(this->_usr_memory == NULL || this->_cpu_ptr != cpu_ptr)
this->_usr_memory.reset(new memory(*this->_usr_memory_pd, cpu_ptr));
if(this->_reorder_prv2usr.aprimitive == NULL) {
if(this->_reorder_prv2usr.aprimitive == NULL || this->_cpu_ptr != cpu_ptr) {
CHECK(this->aprimitive());
this->_reorder_prv2usr.aprimitive.reset(new reorder(*this->_reorder_prv2usr_pd, *this->aprimitive(), *this->_usr_memory));
}
this->_cpu_ptr = cpu_ptr;
}

template <typename Dtype, bool is_diff>
Expand Down

0 comments on commit a124ef8

Please sign in to comment.