Retrieves the current net, or add a new net to the builder. Args: net: If provided, add the given net to the active builder. Else, returns the current Net or creates a new one as needed. name: if provided, creates a new Net with given na
(self, net=None, name=None)
| 208 | Operations to be used in the context of a NetBuilder. |
| 209 | """ |
| 210 | def net(self, net=None, name=None): |
| 211 | """ |
| 212 | Retrieves the current net, or add a new net to the builder. |
| 213 | Args: |
| 214 | net: If provided, add the given net to the active builder. |
| 215 | Else, returns the current Net or creates a new one as needed. |
| 216 | name: if provided, creates a new Net with given name and makes |
| 217 | it the new current net of the active builder. Cannot |
| 218 | be provided if net is provided. |
| 219 | """ |
| 220 | assert name is None or net is None, ( |
| 221 | 'Cannot provide both `net` and `name`.') |
| 222 | if net is not None: |
| 223 | NetBuilder.current().add(net) |
| 224 | return net |
| 225 | return NetBuilder.current().current_net(name=name) |
| 226 | |
| 227 | def __getattr__(self, op_type): |
| 228 | """ |