(op, inputs=None, outputs=None, factor_prefixes=False)
| 250 | |
| 251 | |
| 252 | def call(op, inputs=None, outputs=None, factor_prefixes=False): |
| 253 | if not inputs: |
| 254 | inputs = '' |
| 255 | else: |
| 256 | inputs_v = [a for a in inputs if not isinstance(a, tuple)] |
| 257 | inputs_kv = [a for a in inputs if isinstance(a, tuple)] |
| 258 | inputs = ', '.join( |
| 259 | x |
| 260 | for x in chain( |
| 261 | [factor_prefix(inputs_v, factor_prefixes)], |
| 262 | ('%s=%s' % kv for kv in inputs_kv), |
| 263 | ) |
| 264 | if x |
| 265 | ) |
| 266 | call = '%s(%s)' % (op, inputs) |
| 267 | return call if not outputs else '%s = %s' % ( |
| 268 | factor_prefix(outputs, factor_prefixes), call) |
| 269 | |
| 270 | |
| 271 | def format_device_option(dev_opt): |
searching dependent graphs…