| 290 | } |
| 291 | |
| 292 | void Tensor::RepeatData(const vector<size_t> &repeats, int axis, |
| 293 | int total_repeats, const Tensor &src) { |
| 294 | if (repeats.size() == 1) { |
| 295 | CHECK_EQ(Size(), src.Size() * total_repeats); |
| 296 | } else { |
| 297 | CHECK_EQ(Size(), src.Size() * total_repeats / src.shape()[axis]); |
| 298 | } |
| 299 | |
| 300 | CHECK(block_ != nullptr); |
| 301 | // Do repeat only if the src's block is already initialized. |
| 302 | if (src.block_ != nullptr) { |
| 303 | singa::RepeatDataToFrom(false, repeats, axis, this, src, Size()); |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | void Tensor::FromProto(const singa::TensorProto &proto) { |
| 308 | if (block_ != nullptr && block_->DecRefCount() == 0) |