google / google/python-fire

Dynamically dispatch function but do not print result

未關閉
#231 3 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement
主要語言
Python
星號
28.2k
分支
1.5k
PR 合併指標
30 天內沒有已合併 PR

描述

Can Fire be used to dynamically dispatch a function as in the dict example but without printing the result? I would like to do something with the return value, for instance:

```
if __name__ == "__main__":
# inception and exception are functions that return keras models,
# each having its own parameters
ret = Fire.Fire({'inception': inception,
'xception': xception})

# do something with ret
```

If I try to run the previous code, for instance:

python ./train.py inception 100 100 10

I get the following error:

```
ERROR: The function received no value for the required argument: inputs
2020-03-03 16:30:13.774542: W tensorflow/python/util/util.cc:319] Sets are not currently considered sequences, but this may change in the future, so consider avoiding using them.
Usage: train.py inception 100 100 10 - | --inputs=INPUTS [ARGS]...
available groups: inbound_nodes | input | input_names | input_shape |
inputs | layers | losses | metrics | metrics_names |
non_trainable_variables | non_trainable_weights |
outbound_nodes | output | output_names |
output_shape | outputs | state_updates | submodules |
trainable_variables | trainable_weights | updates |
variables | weights
available commands: add_loss | add_metric | add_update | add_variable |
add_weight | apply | build | call | compile |
compute_mask | compute_output_shape |
compute_output_signature | count_params | evaluate |
evaluate_generator | fit | fit_generator |
from_config | get_config | get_input_at |
get_input_mask_at | get_input_shape_at | get_layer |
get_losses_for | get_output_at | get_output_mask_at |
get_output_shape_at | get_updates_for | get_weights |
load_weights | name_scope | predict |
predict_generator | predict_on_batch | reset_metrics |
reset_states | save | save_weights | set_weights |
summary | test_on_batch | to_json | to_yaml |
train_on_batch | with_name_scope
available values: activity_regularizer | built | dtype | dynamic |
input_mask | input_spec | name | optimizer |
output_mask | run_eagerly | stateful |
supports_masking | trainable
flags are accepted

For detailed information on this command, run:
train.py inception 100 100 10 - -- --help`
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。