Commit 3f542861 authored by Davis King's avatar Davis King

merged

parents 95182765 6afc9233
......@@ -34,6 +34,10 @@ namespace dlib
training data and it will output a new network instance that has hopefully
learned something useful from your training data.
If you are compiling with CUDA then this object will use the GPU that is
currently selected (i.e. the one indicated by cudaGetDevice()) when
dnn_trainer is constructed. It will continue to use that device even if
you later change it by a call to cudaSetDevice().
!*/
public:
......
......@@ -1114,14 +1114,42 @@ namespace dlib
#ifdef DLIB_HAS_RVALUE_REFERENCES
matrix(matrix&& item)
{
#ifdef MATLAB_MEX_FILE
// You can't move memory around when compiled in a matlab mex file and the
// different locations have different persistence settings.
if (data._private_is_persistent() == item.data._private_is_persistent())
{
swap(item);
}
else
{
data.set_size(item.nr(),item.nc());
matrix_assign(*this, item);
}
#else
swap(item);
#endif
}
matrix& operator= (
matrix&& rhs
)
{
#ifdef MATLAB_MEX_FILE
// You can't move memory around when compiled in a matlab mex file and the
// different locations have different persistence settings.
if (data._private_is_persistent() == rhs.data._private_is_persistent())
{
swap(rhs);
}
else
{
data.set_size(rhs.nr(),rhs.nc());
matrix_assign(*this, rhs);
}
#else
swap(rhs);
#endif
return *this;
}
#endif
......
......@@ -188,6 +188,7 @@ namespace dlib
void _private_set_mxArray ( mxArray* ) { DLIB_CASSERT(false, "This function should never be called."); }
mxArray* _private_release_mxArray(){DLIB_CASSERT(false, "This function should never be called."); }
void _private_mark_non_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
bool _private_is_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
#endif
private:
......@@ -257,6 +258,7 @@ namespace dlib
void _private_set_mxArray ( mxArray* ) { DLIB_CASSERT(false, "This function should never be called."); }
mxArray* _private_release_mxArray(){DLIB_CASSERT(false, "This function should never be called."); }
void _private_mark_non_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
bool _private_is_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
#endif
private:
......@@ -338,6 +340,7 @@ namespace dlib
void _private_set_mxArray ( mxArray* ) { DLIB_CASSERT(false, "This function should never be called."); }
mxArray* _private_release_mxArray(){DLIB_CASSERT(false, "This function should never be called."); }
void _private_mark_non_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
bool _private_is_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
#endif
private:
......@@ -422,6 +425,7 @@ namespace dlib
void _private_set_mxArray ( mxArray* ) { DLIB_CASSERT(false, "This function should never be called."); }
mxArray* _private_release_mxArray(){DLIB_CASSERT(false, "This function should never be called."); }
void _private_mark_non_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
bool _private_is_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
#endif
private:
......@@ -508,6 +512,7 @@ namespace dlib
void _private_set_mxArray ( mxArray* ) { DLIB_CASSERT(false, "This function should never be called."); }
mxArray* _private_release_mxArray(){DLIB_CASSERT(false, "This function should never be called."); }
void _private_mark_non_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
bool _private_is_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
#endif
private:
T* data;
......@@ -630,6 +635,7 @@ namespace dlib
void _private_set_mxArray ( mxArray* ) { DLIB_CASSERT(false, "This function should never be called."); }
mxArray* _private_release_mxArray(){DLIB_CASSERT(false, "This function should never be called."); }
void _private_mark_non_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
bool _private_is_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
#endif
private:
......@@ -699,6 +705,7 @@ namespace dlib
void _private_set_mxArray ( mxArray* ) { DLIB_CASSERT(false, "This function should never be called."); }
mxArray* _private_release_mxArray(){DLIB_CASSERT(false, "This function should never be called."); }
void _private_mark_non_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
bool _private_is_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
#endif
private:
......@@ -780,6 +787,7 @@ namespace dlib
void _private_set_mxArray ( mxArray* ) { DLIB_CASSERT(false, "This function should never be called."); }
mxArray* _private_release_mxArray(){DLIB_CASSERT(false, "This function should never be called."); }
void _private_mark_non_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
bool _private_is_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
#endif
private:
......@@ -864,6 +872,7 @@ namespace dlib
void _private_set_mxArray ( mxArray* ) { DLIB_CASSERT(false, "This function should never be called."); }
mxArray* _private_release_mxArray(){DLIB_CASSERT(false, "This function should never be called."); }
void _private_mark_non_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
bool _private_is_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
#endif
private:
......@@ -930,6 +939,7 @@ namespace dlib
void _private_set_mxArray ( mxArray* ) { DLIB_CASSERT(false, "This function should never be called."); }
mxArray* _private_release_mxArray(){DLIB_CASSERT(false, "This function should never be called."); }
void _private_mark_non_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
bool _private_is_persistent() {DLIB_CASSERT(false, "This function should never be called."); }
#endif
long nr (
......@@ -1031,6 +1041,10 @@ namespace dlib
DLIB_CASSERT(mem == 0,"You can't convert a persistent matlab array to non-persistent.");
make_persistent = false;
}
bool _private_is_persistent()
{
return make_persistent;
}
void swap(
layout& item
......@@ -1153,6 +1167,10 @@ namespace dlib
DLIB_CASSERT(mem == 0,"You can't convert a persistent matlab array to non-persistent.");
make_persistent = false;
}
bool _private_is_persistent()
{
return make_persistent;
}
void swap(
layout& item
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment