关于代码的问题
Created by: JensenHJS
先贴出部分代码
with fluid.program_guard(train_prog, startup_prog):#传给(mian program,start program)
with fluid.unique_name.guard(): #后面加fluid.unique_name.generate用于重命名编号(命名空间)fluid.unique_name.guard 可以确保多次调用某函数参数初始化的名称一致
model = create(main_arch)#
with mixed_precision_context(FLAGS.loss_scale, FLAGS.fp16) as ctx:
inputs_def = cfg['TrainReader']['inputs_def']
feed_vars, train_loader = model.build_inputs(**inputs_def)#定义在ppdet.modeling.architectures.yolov3.YOLOv3
train_fetches = model.train(feed_vars) #返回loss 经过backbone和yolohead得到最终los
loss = train_fetches['loss']
lr = lr_builder()
optimizer = optim_builder(lr)
optimizer.minimize(loss)
exe.run(startup_prog)
###################################################################### 上面代码里with fluid.program_guard以下都是一些定义吧,包括model.train(feed_vars)这里也只是定义,并没有真正开始训练吧,调用exe.run(startup_prog)之后才真正开始训练?