|
44 | 44 | function iter = iter(self)
|
45 | 45 | iter = caffe_('solver_get_iter', self.hSolver_self);
|
46 | 46 | end
|
| 47 | + % add new interfaces for solver |
| 48 | + function use_caffemodel(self, model_dir) |
| 49 | + for t = 1 : length(self.gpu_ids) |
| 50 | + self.nets{t}.copy_from(model_dir); |
| 51 | + end |
| 52 | + end |
| 53 | + function set_input_data(self, inputs) |
| 54 | + for t = 1 : length(self.gpu_ids) |
| 55 | + input_data = inputs{t}; |
| 56 | + self.nets{t}.set_input_data(input_data); |
| 57 | + end |
| 58 | + end |
| 59 | + function output = get_output(self) |
| 60 | + output = cell(length(self.gpu_ids), 1); |
| 61 | + for t = 1 : length(self.gpu_ids) |
| 62 | + output{t} = self.nets{t}.get_output(); |
| 63 | + end |
| 64 | + end |
| 65 | + function set_phase(self, phase) |
| 66 | + for t = 1 : length(self.gpu_ids) |
| 67 | + self.nets{t}.set_phase(phase); |
| 68 | + end |
| 69 | + end |
| 70 | + function reshape_as_input(self, inputs) |
| 71 | + for t = 1 : length(self.gpu_ids) |
| 72 | + input_data = inputs{t}; |
| 73 | + self.nets{t}.reshape_as_input(input_data); |
| 74 | + end |
| 75 | + end |
| 76 | + function forward(self, inputs) |
| 77 | + for t = 1 : length(self.gpu_ids) |
| 78 | + input_data = inputs{t}; |
| 79 | + self.nets{t}.set_input_data(input_data); |
| 80 | + end |
| 81 | + caffe_('solver_test'); |
| 82 | + end |
| 83 | + function forward_prefilled(self) |
| 84 | + caffe_('solver_test'); |
| 85 | + end |
| 86 | + function snapshot(self, path) |
| 87 | + self.nets{1}.save(path); |
| 88 | + end |
| 89 | + % add done |
| 90 | + |
47 | 91 | function max_iter = max_iter(self)
|
48 | 92 | max_iter = caffe_('solver_get_max_iter', self.hSolver_self);
|
49 | 93 | end
|
|
0 commit comments