Create hub module.
(params, mode)
| 62 | |
| 63 | |
| 64 | def create_ict_module(params, mode): |
| 65 | """Create hub module.""" |
| 66 | tags_and_args = [] |
| 67 | for is_training in (True, False): |
| 68 | tags = set() |
| 69 | if is_training: |
| 70 | tags.add("train") |
| 71 | tags_and_args.append((tags, dict(is_training=is_training))) |
| 72 | ict_module_spec = hub.create_module_spec( |
| 73 | functools.partial(module_fn, params=params), |
| 74 | tags_and_args=tags_and_args) |
| 75 | ict_module = hub.Module( |
| 76 | ict_module_spec, |
| 77 | tags={"train"} if mode == tf_estimator.ModeKeys.TRAIN else {}, |
| 78 | trainable=True) |
| 79 | hub.register_module_for_export(ict_module, "ict") |
| 80 | return ict_module |
| 81 | |
| 82 | |
| 83 | def model_fn(features, labels, mode, params): |