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

change duration compute methods #49

Merged
merged 8 commits into from
Jan 19, 2018
Merged
7 changes: 2 additions & 5 deletions fluid/resnet50.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def run_benchmark(model, args):
buf_size=5120),
batch_size=args.batch_size)

place = core.CPUPlace() if args.device == 'CPU' else core.CUDAPlace(0)
place = core.CPUPlace() if args.device == 'CPU' else core.GPUPlace(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember CUDAPlace is used in the latest PaddlePaddle. Could you refer to the source codes to confirm this.

Copy link
Author

Choose a reason for hiding this comment

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

Done

exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())

Expand All @@ -209,15 +209,12 @@ def run_benchmark(model, args):
label = np.array(map(lambda x: x[1], data)).astype('int64')
label = label.reshape([-1, 1])

iter = 0
im_num = 0
start_time = time.time()
for pass_id in range(args.pass_num):
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Done

every_pass_loss = []
every_pass_acc = []
accuracy.reset(exe)
if iter == args.iterations:
iter = 0
iter = 0
for batch_id, data in enumerate(train_reader()):
if iter < args.skip_batch_num:
iter += 1
Expand Down