Args: params: the weight and bias, passed by either add_ops or add_train_ops function features: feature blobs to predict on. Can be the actual cur_layer or the bootstrapped_feature blobs. version: currently fp32 support only
(self, net, features, iteration, params, version)
| 261 | raise Exception("unsupported FC type version {}".format(version)) |
| 262 | |
| 263 | def _add_ops(self, net, features, iteration, params, version): |
| 264 | """ |
| 265 | Args: |
| 266 | params: the weight and bias, passed by either add_ops or |
| 267 | add_train_ops function |
| 268 | |
| 269 | features: feature blobs to predict on. Can be the actual cur_layer |
| 270 | or the bootstrapped_feature blobs. |
| 271 | |
| 272 | version: currently fp32 support only |
| 273 | """ |
| 274 | |
| 275 | if self.clip_args is not None: |
| 276 | clipped_params = [net.NextScopedBlob("clipped_%s" % str(p)) for p in params] |
| 277 | for p, cp in zip(params, clipped_params): |
| 278 | net.Clip([p], [cp], **self.clip_args) |
| 279 | params = clipped_params |
| 280 | |
| 281 | if self.output_dim_vec is None or len(self.output_dim_vec) == 1: |
| 282 | self._insert_fc_ops( |
| 283 | net=net, |
| 284 | features=features, |
| 285 | params=params, |
| 286 | outputs=[self.output_schema.field_blobs()[(iteration * 2) + 1]], |
| 287 | version=version, |
| 288 | ) |
| 289 | |
| 290 | def add_ops(self, net): |
| 291 | """ |
no test coverage detected