Encode a block to a string. Args: block (namedtuple): A BlockArgs type argument. Returns: block_string: A String form of BlockArgs.
(block)
| 329 | |
| 330 | @staticmethod |
| 331 | def _encode_block_string(block): |
| 332 | """Encode a block to a string. |
| 333 | Args: |
| 334 | block (namedtuple): A BlockArgs type argument. |
| 335 | Returns: |
| 336 | block_string: A String form of BlockArgs. |
| 337 | """ |
| 338 | args = [ |
| 339 | 'r%d' % block.num_repeat, |
| 340 | 'k%d' % block.kernel_size, |
| 341 | 's%d%d' % (block.strides[0], block.strides[1]), |
| 342 | 'e%s' % block.expand_ratio, |
| 343 | 'i%d' % block.input_filters, |
| 344 | 'o%d' % block.output_filters |
| 345 | ] |
| 346 | if 0 < block.se_ratio <= 1: |
| 347 | args.append('se%s' % block.se_ratio) |
| 348 | if block.id_skip is False: |
| 349 | args.append('noskip') |
| 350 | return '_'.join(args) |
| 351 | |
| 352 | @staticmethod |
| 353 | def decode(string_list): |