Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ParallelDo example for benchmark/fluid #11199

Merged
merged 1 commit into from
Jun 6, 2018
Merged

add ParallelDo example for benchmark/fluid #11199

merged 1 commit into from
Jun 6, 2018

Conversation

luotao1
Copy link
Contributor

@luotao1 luotao1 commented Jun 5, 2018

  • add ParallelDo example for multi-thread CPU training in benchmark/fluid. For four models in benchmark/fluid, only add ParallelDo example for mnist and resnet now.
  • add --cpus arguments to specify the number of cpus. The usage likes:
python fluid_benchmark.py --model resnet --batch_size=64 --pass_num 5 --device CPU --data_set cifar10 --no_test --cpus=20
  • remove unused batch_size_tensor = fluid.layers.create_tensor(dtype='int64'), since fluid.layers.accuracy(input=predict, label=label) will auto create it.
    def accuracy(input, label, k=1, correct=None, total=None):
    """
    This function computes the accuracy using the input and label.
    The output is the top k inputs and their indices.
    """
    helper = LayerHelper("accuracy", **locals())
    topk_out, topk_indices = nn.topk(input, k=k)
    acc_out = helper.create_tmp_variable(dtype="float32")
    if correct is None:
    correct = helper.create_tmp_variable(dtype="int64")
    if total is None:
    total = helper.create_tmp_variable(dtype="int64")

Copy link

@tonyyang-svail tonyyang-svail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@luotao1 luotao1 merged commit 7938b30 into PaddlePaddle:develop Jun 6, 2018
@luotao1 luotao1 deleted the benchmark branch June 11, 2018 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants