A wrapper allowing one to initiate operators from a blob reference. Example: for a blob reference b that comes from network n, doing b.Relu(...) is equivalent to doing net.Relu([b], ...)
(self, op_type)
| 279 | return self._from_net.__getattr__(op_type)(inputs, *args, **kwargs) |
| 280 | |
| 281 | def __getattr__(self, op_type): |
| 282 | """A wrapper allowing one to initiate operators from a blob reference. |
| 283 | |
| 284 | Example: for a blob reference b that comes from network n, doing |
| 285 | b.Relu(...) |
| 286 | is equivalent to doing |
| 287 | net.Relu([b], ...) |
| 288 | """ |
| 289 | if op_type.startswith('__'): |
| 290 | raise AttributeError('Attribute {} not found.'.format(op_type)) |
| 291 | if self._from_net is None: |
| 292 | raise AttributeError( |
| 293 | 'You cannot use a blob reference that does not have a net ' |
| 294 | 'source to create operators. Create the operator from an ' |
| 295 | 'explicit net object.') |
| 296 | if not IsOperator(op_type): |
| 297 | raise AttributeError( |
| 298 | 'Method ' + op_type + ' is not a registered operator.' + |
| 299 | ' Did you mean: [' + |
| 300 | ",".join(workspace.C.nearby_opnames(op_type)) + ']' |
| 301 | ) |
| 302 | return lambda *args, **kwargs: self._CreateAndAddToNet( |
| 303 | op_type, *args, **kwargs) |
| 304 | |
| 305 | def __dir__(self): |
| 306 | TriggerLazyImport() |
nothing calls this directly
no test coverage detected