From acfafb2f3940f05b95daeaaada7f13ecf66b4699 Mon Sep 17 00:00:00 2001 From: Jeff Donahue Date: Tue, 8 Apr 2014 14:24:48 -0700 Subject: [PATCH] have rng_stream initialize RNG if not already initialized --- include/caffe/common.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/caffe/common.hpp b/include/caffe/common.hpp index 1829026..af7dcc4 100644 --- a/include/caffe/common.hpp +++ b/include/caffe/common.hpp @@ -96,6 +96,9 @@ class Caffe { // Getters for boost rng, curand, and cublas handles inline static const RNG& rng_stream() { + if (!Get().random_generator_) { + Get().random_generator_.reset(new RNG()); + } return *(Get().random_generator_); } inline static cublasHandle_t cublas_handle() { return Get().cublas_handle_; } -- 2.7.4