File: Layer.m

package info (click to toggle)
caffe 1.0.0%2Bgit20180821.99bd997-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 16,288 kB
  • sloc: cpp: 61,586; python: 5,783; makefile: 599; sh: 559
file content (32 lines) | stat: -rw-r--r-- 841 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
classdef Layer < handle
  % Wrapper class of caffe::Layer in matlab
  
  properties (Access = private)
    hLayer_self
    attributes
    % attributes fields:
    %     hBlob_blobs
  end
  properties (SetAccess = private)
    params
  end
  
  methods
    function self = Layer(hLayer_layer)
      CHECK(is_valid_handle(hLayer_layer), 'invalid Layer handle');
      
      % setup self handle and attributes
      self.hLayer_self = hLayer_layer;
      self.attributes = caffe_('layer_get_attr', self.hLayer_self);
      
      % setup weights
      self.params = caffe.Blob.empty();
      for n = 1:length(self.attributes.hBlob_blobs)
        self.params(n) = caffe.Blob(self.attributes.hBlob_blobs(n));
      end
    end
    function layer_type = type(self)
      layer_type = caffe_('layer_get_type', self.hLayer_self);
    end
  end
end