| 521 | |
| 522 | template <typename Dtype> |
| 523 | void DataTransformer<Dtype>::InitRand() { |
| 524 | const bool needs_rand = param_.mirror() || |
| 525 | (phase_ == TRAIN && param_.crop_size()); |
| 526 | if (needs_rand) { |
| 527 | const unsigned int rng_seed = caffe_rng_rand(); |
| 528 | rng_.reset(new Caffe::RNG(rng_seed)); |
| 529 | } else { |
| 530 | rng_.reset(); |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | template <typename Dtype> |
| 535 | int DataTransformer<Dtype>::Rand(int n) { |