Skip to content

Commit

Permalink
more fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen committed Sep 18, 2015
1 parent 4a8c3a3 commit 3c42e9f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mshadow-ps/ps_local-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,9 @@ class LocalModel : public ISharedModel<xpu, DType> {
PushEntry &e = push_map.GetRef(tsk.key);
CHECK_EQ(e.data[0][0].shape_, tsk.data.shape_)
<< "Tensor with same key must share same shape "
<< e.data[0][0].shape_.ToString()
<< e.data[0][0].shape_
<< " vs "
<< tsk.data.shape_.ToString();
<< tsk.data.shape_;
CHECK_EQ(!e.copied[wid], true) << "data inconsistency";
// start copy
SetDevice<xpu>(tsk.devid);
Expand Down
17 changes: 15 additions & 2 deletions mshadow/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifndef MSHADOW_TENSOR_H_
#define MSHADOW_TENSOR_H_
#include <string>
#include <iostream>
#include "./base.h"
#include "./expression.h"

Expand All @@ -30,6 +31,18 @@ struct gpu {
/*! \brief device flag number, identifies this device */
static const int kDevMask = 1 << 1;
};
template<int ndim>
struct Shape;

/*!
* \brief allow string printing of the shape
* \param os the output stream
* \param shape the shape
* \return the ostream
*/
template<int ndim>
inline std::ostream &operator<<(std::ostream &os, const Shape<ndim> &shape); // NOLINT(*)

/*!
* \brief shape of a tensor
* IMPORTANT NOTE: this shape is different from numpy.shape
Expand Down Expand Up @@ -153,8 +166,8 @@ v * \return subshape
}
return s;
}
// print function
friend std::ostream &operator<<(std::ostream &os, const Shape<dimension> &shape); // NOLINT(*)
template<int dim>
friend std::ostream &operator<<(std::ostream &os, const Shape<dim> &shape); // NOLINT(*)
}; // Shape
//------------------------------------------------
// useful construction functions to generate shape
Expand Down

0 comments on commit 3c42e9f

Please sign in to comment.