message: [Python]: update inception
diff: @@ -104,8 +104,51 @@ def inception():
  label = ffmodel.get_label_tensor()
  # Data Loader
  - alexnetconfig = NetConfig()
  - dataloader = DataLoader4D(ffmodel, input, label, ffnetconfig=alexnetconfig)
  + # alexnetconfig = NetConfig()
  + # dataloader = DataLoader4D(ffmodel, input, label, ffnetconfig=alexnetconfig)
  + num_samples = 10000
  +
  + (x_train, y_train), (x_test, y_test) = cifar10.load_data(num_samples)
  +
  + full_input_np = np.zeros((num_samples, 3, 299, 299), dtype=np.float32)
  +
  + for i in range(0, num_samples):
  + image = x_train[i, :, :, :]
  + image = image.transpose(1, 2, 0)
  + pil_image = Image.fromarray(image)
  + pil_image = pil_image.resize((299,299), Image.NEAREST)
  + image = np.array(pil_image, dtype=np.float32)
  + image = image.transpose(2, 0, 1)
  + full_input_np[i, :, :, :] = image
  + if (i == 0):
  + print(image)
  +
  +
  + full_input_np /= 255
  + print(full_input_np.shape)
  + print(full_input_np.__array_interface__["strides"])
  + print(full_input_np[0,:, :, :])
  +
  + y_train = y_train.astype('int32')
  + full_label_np = y_train
  +
  + dims_full_input = [num_samples, 3, 299, 299]
  + full_input = ffmodel.create_tensor(dims_full_input, "", DataType.DT_FLOAT)
  +
  + dims_full_label = [num_samples, 1]
  + full_label = ffmodel.create_tensor(dims_full_label, "", DataType.DT_INT32)
  +
  + full_input.attach_numpy_array(ffconfig, full_input_np)
  + full_label.attach_numpy_array(ffconfig, full_label_np)
  +
  + dataloader_input = SingleDataLoader(ffmodel, input, full_input, num_samples, DataType.DT_FLOAT)
  + dataloader_label = SingleDataLoader(ffmodel, label, full_label, num_samples, DataType.DT_INT32)
  +
  + full_input.detach_numpy_array(ffconfig)
  + full_label.detach_numpy_array(ffconfig)
  +
  + num_samples = dataloader_input.get_num_samples()
  + assert dataloader_input.get_num_samples() == dataloader_label.get_num_samples()
  ffmodel.init_layers()
  @@ -113,15 +156,15 @@ def inception():
  ts_start = ffconfig.get_current_time()
  for epoch in range(0,epochs):
  - dataloader.reset()
  + # dataloader.reset()
  + dataloader_input.reset()
  + dataloader_label.reset()
  ffmodel.reset_metrics()
  iterations = dataloader.get_num_samples() / ffconfig.get_batch_size()
  for iter in range(0, int(iterations)):
  - if (len(alexnetconfig.dataset_path) == 0):
  - if (iter == 0 and epoch == 0):
  - dataloader.next_batch(ffmodel)
  - else:
  - dataloader.next_batch(ffmodel)
  + #dataloader.next_batch(ffmodel)
  + dataloader_input.next_batch(ffmodel)
  + dataloader_label.next_batch(ffmodel)
  if (epoch > 0):
  ffconfig.start_trace(111)
  ffmodel.forward()
  