Skip to content

Commit

Permalink
Add transfer_learning_blob_name_mappings into layer_model_helper to s…
Browse files Browse the repository at this point in the history
…upport layer model transfer learning

Summary: Add transfer_learning_blob_name_mappings into layer_model_helper to support layer model transfer learning

Reviewed By: mraway

Differential Revision: D20286298

fbshipit-source-id: de3e029611d843f38d3f42ecd4148358f7e14a2b
  • Loading branch information
Li Zhang (DAI) authored and facebook-github-bot committed Mar 18, 2020
1 parent e35dd4f commit 69e701f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions caffe2/python/layer_model_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def __init__(self, name, input_feature_schema, trainer_extra_schema,
self.param_init_net = self.create_init_net('param_init_net')
self._initialize_params = True

self._transfer_learning_blob_name_mappings = None

# additional (hard-coded) diagnose_options to report based on the model
# TODO(xlwang): it's hack!
self.ad_hoc_diagnose_blobs_and_operations = []
Expand Down Expand Up @@ -490,6 +492,15 @@ def add_prediction(self, prediction, weight=1.0):
assert prediction is not None, "Added prediction should not be None"
self._prediction.append((prediction, weight))

@property
def transfer_learning_blob_name_mappings(self):
return self._transfer_learning_blob_name_mappings

@transfer_learning_blob_name_mappings.setter
def transfer_learning_blob_name_mappings(self, blob_name_mappings):
assert blob_name_mappings is not None, "Transfer learning blob name mappings should not be None"
self._transfer_learning_blob_name_mappings = blob_name_mappings

@property
def loss(self):
assert self._loss is not None
Expand Down

0 comments on commit 69e701f

Please sign in to comment.