def top_level_task(): ffconfig = FFConfig() alexnetconfig = NetConfig() print(alexnetconfig.dataset_path) print("Python API batchSize(%d) workersPerNodes(%d) numNodes(%d)" %(ffconfig.batch_size, ffconfig.workers_per_node, ffconfig.num_nodes)) ffmodel = FFModel(ffconfig) dims_input = [ffconfig.batch_size, 3, 229, 229] input = ffmodel.create_tensor(dims_input, DataType.DT_FLOAT) onnx_model = ONNXModel("resnet18.onnx") t = onnx_model.apply(ffmodel, {"input.1": input}) t = ffmodel.softmax(t) ffoptimizer = SGDOptimizer(ffmodel, 0.01) ffmodel.optimizer = ffoptimizer ffmodel.compile(loss_type=LossType.LOSS_SPARSE_CATEGORICAL_CROSSENTROPY, metrics=[MetricsType.METRICS_ACCURACY, MetricsType.METRICS_SPARSE_CATEGORICAL_CROSSENTROPY]) label = ffmodel.label_tensor num_samples = 10000 (x_train, y_train), (x_test, y_test) = cifar10.load_data(num_samples) full_input_np = np.zeros((num_samples, 3, 229, 229), 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((229,229), Image.NEAREST) image = np.array(pil_image, dtype=np.float32) image = image.transpose(2, 0, 1) full_input_np[i, :, :, :] = image full_input_np /= 255 y_train = y_train.astype('int32') full_label_np = y_train dataloader_input = ffmodel.create_data_loader(input, full_input_np) dataloader_label = ffmodel.create_data_loader(label, full_label_np) num_samples = dataloader_input.num_samples assert dataloader_input.num_samples == dataloader_label.num_samples ffmodel.init_layers() epochs = ffconfig.epochs ts_start = ffconfig.get_current_time() ffmodel.fit(x=dataloader_input, y=dataloader_label, epochs=epochs) ts_end = ffconfig.get_current_time() run_time = 1e-6 * (ts_end - ts_start); print("epochs %d, ELAPSED TIME = %.4fs, THROUGHPUT = %.2f samples/s\n" %(epochs, run_time, num_samples * epochs / run_time)); perf_metrics = ffmodel.get_perf_metrics() accuracy = perf_metrics.get_accuracy() if accuracy < ModelAccuracy.CIFAR10_ALEXNET.value: assert 0, 'Check Accuracy'
def top_level_task(): ffconfig = FFConfig() ffconfig.parse_args() print("Python API batchSize(%d) workersPerNodes(%d) numNodes(%d)" %(ffconfig.get_batch_size(), ffconfig.get_workers_per_node(), ffconfig.get_num_nodes())) ffmodel = FFModel(ffconfig) dims1 = [ffconfig.get_batch_size(), 784] input1 = ffmodel.create_tensor(dims1, DataType.DT_FLOAT); num_samples = 60000 onnx_model = ONNXModel("mnist_mlp.onnx") t = onnx_model.apply(ffmodel, {"input.1": input1}) ffoptimizer = SGDOptimizer(ffmodel, 0.01) ffmodel.set_sgd_optimizer(ffoptimizer) ffmodel.compile(loss_type=LossType.LOSS_SPARSE_CATEGORICAL_CROSSENTROPY, metrics=[MetricsType.METRICS_ACCURACY, MetricsType.METRICS_SPARSE_CATEGORICAL_CROSSENTROPY]) label = ffmodel.get_label_tensor() (x_train, y_train), (x_test, y_test) = mnist.load_data() x_train = x_train.reshape(60000, 784) x_train = x_train.astype('float32') x_train /= 255 y_train = y_train.astype('int32') y_train = np.reshape(y_train, (len(y_train), 1)) dims_full_input = [num_samples, 784] 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, x_train) full_label.attach_numpy_array(ffconfig, y_train) dataloader_input = SingleDataLoader(ffmodel, input1, 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) ffmodel.init_layers() epochs = ffconfig.get_epochs() ts_start = ffconfig.get_current_time() ffmodel.fit(x=dataloader_input, y=dataloader_label, epochs=epochs) ts_end = ffconfig.get_current_time() run_time = 1e-6 * (ts_end - ts_start); print("epochs %d, ELAPSED TIME = %.4fs, THROUGHPUT = %.2f samples/s\n" %(epochs, run_time, num_samples * epochs / run_time)); perf_metrics = ffmodel.get_perf_metrics() accuracy = perf_metrics.get_accuracy() if accuracy < ModelAccuracy.MNIST_MLP.value: assert 0, 'Check Accuracy'
def top_level_task(test_type=1): ffconfig = FFConfig() print("Python API batchSize(%d) workersPerNodes(%d) numNodes(%d)" % (ffconfig.batch_size, ffconfig.workers_per_node, ffconfig.num_nodes)) ffmodel = FFModel(ffconfig) dims1 = [ffconfig.batch_size, 784] input1 = ffmodel.create_tensor(dims1, DataType.DT_FLOAT) num_samples = 60000 if test_type == 1: onnx_model = ONNXModel("mnist_mlp_pt.onnx") t = onnx_model.apply(ffmodel, {"input.1": input1}) else: onnx_model = ONNXModelKeras("mnist_mlp_keras.onnx", ffconfig, ffmodel) t = onnx_model.apply(ffmodel, {"input_1": input1}) ffoptimizer = SGDOptimizer(ffmodel, 0.01) ffmodel.optimizer = ffoptimizer ffmodel.compile(loss_type=LossType.LOSS_SPARSE_CATEGORICAL_CROSSENTROPY, metrics=[ MetricsType.METRICS_ACCURACY, MetricsType.METRICS_SPARSE_CATEGORICAL_CROSSENTROPY ]) label = ffmodel.label_tensor (x_train, y_train), (x_test, y_test) = mnist.load_data() x_train = x_train.reshape(60000, 784) x_train = x_train.astype('float32') x_train /= 255 y_train = y_train.astype('int32') y_train = np.reshape(y_train, (len(y_train), 1)) dataloader_input = ffmodel.create_data_loader(input1, x_train) dataloader_label = ffmodel.create_data_loader(label, y_train) ffmodel.init_layers() epochs = ffconfig.epochs ts_start = ffconfig.get_current_time() ffmodel.fit(x=dataloader_input, y=dataloader_label, epochs=epochs) ts_end = ffconfig.get_current_time() run_time = 1e-6 * (ts_end - ts_start) print("epochs %d, ELAPSED TIME = %.4fs, THROUGHPUT = %.2f samples/s\n" % (epochs, run_time, num_samples * epochs / run_time)) perf_metrics = ffmodel.get_perf_metrics() accuracy = perf_metrics.get_accuracy() if accuracy < ModelAccuracy.MNIST_MLP.value: assert 0, 'Check Accuracy'
def top_level_task(): ffconfig = FFConfig() alexnetconfig = NetConfig() print(alexnetconfig.dataset_path) ffconfig.parse_args() print("Python API batchSize(%d) workersPerNodes(%d) numNodes(%d)" % (ffconfig.get_batch_size(), ffconfig.get_workers_per_node(), ffconfig.get_num_nodes())) ffmodel = FFModel(ffconfig) dims_input = [ffconfig.get_batch_size(), 3, 32, 32] input = ffmodel.create_tensor(dims_input, "", DataType.DT_FLOAT) # dims_label = [ffconfig.get_batch_size(), 1] # label = ffmodel.create_tensor(dims_label, "", DataType.DT_INT32) onnx_model = ONNXModel("cifar10_cnn.onnx") t = onnx_model.apply(ffmodel, {"input.1": input}) ffoptimizer = SGDOptimizer(ffmodel, 0.01) ffmodel.set_sgd_optimizer(ffoptimizer) ffmodel.compile(loss_type=LossType.LOSS_SPARSE_CATEGORICAL_CROSSENTROPY, metrics=[ MetricsType.METRICS_ACCURACY, MetricsType.METRICS_SPARSE_CATEGORICAL_CROSSENTROPY ]) label = ffmodel.get_label_tensor() use_external = True if (use_external == True): num_samples = 10000 (x_train, y_train), (x_test, y_test) = cifar10.load_data(num_samples) x_train = x_train.astype('float32') x_train /= 255 full_input_array = x_train print(full_input_array.__array_interface__["strides"]) y_train = y_train.astype('int32') full_label_array = y_train print(full_input_array.__array_interface__["strides"]) print(full_input_array.shape, full_label_array.shape) #print(full_input_array[0,:,:,:]) #print(full_label_array[0, 0:64]) print(full_label_array.__array_interface__["strides"]) dims_full_input = [num_samples, 3, 32, 32] 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_array) full_label.attach_numpy_array(ffconfig, full_label_array) 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() else: # Data Loader dataloader = DataLoader4D(ffmodel, input, label, ffnetconfig=alexnetconfig) num_samples = dataloader.get_num_samples() ffmodel.init_layers() epochs = ffconfig.get_epochs() #epochs = 10 ts_start = ffconfig.get_current_time() for epoch in range(0, epochs): if (use_external == True): dataloader_input.reset() dataloader_label.reset() else: dataloader.reset() ffmodel.reset_metrics() iterations = int(num_samples / ffconfig.get_batch_size()) print(iterations, num_samples) 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) if (use_external == True): dataloader_input.next_batch(ffmodel) dataloader_label.next_batch(ffmodel) else: dataloader.next_batch(ffmodel) if (epoch > 0): ffconfig.begin_trace(111) ffmodel.forward() ffmodel.zero_gradients() ffmodel.backward() ffmodel.update() if (epoch > 0): ffconfig.end_trace(111) ts_end = ffconfig.get_current_time() run_time = 1e-6 * (ts_end - ts_start) print("epochs %d, ELAPSED TIME = %.4fs, THROUGHPUT = %.2f samples/s\n" % (epochs, run_time, num_samples * epochs / run_time)) perf_metrics = ffmodel.get_perf_metrics() accuracy = perf_metrics.get_accuracy() if accuracy < ModelAccuracy.CIFAR10_CNN.value: assert 0, 'Check Accuracy' conv_2d1 = ffmodel.get_layer_by_id(0) cbias_tensor = conv_2d1.get_input_tensor() #cbias_tensor = conv_2d1.get_output_tensor() cbias_tensor.inline_map(ffconfig) cbias = cbias_tensor.get_flat_array(ffconfig, DataType.DT_FLOAT) print(cbias.shape) print(cbias) cbias_tensor.inline_unmap(ffconfig) label.inline_map(ffconfig) label_array = label.get_flat_array(ffconfig, DataType.DT_INT32) print(label_array.shape) # print(cbias) print(label_array) label.inline_unmap(ffconfig)
def top_level_task(test_type=1): ffconfig = FFConfig() alexnetconfig = NetConfig() print(alexnetconfig.dataset_path) print("Python API batchSize(%d) workersPerNodes(%d) numNodes(%d)" % (ffconfig.batch_size, ffconfig.workers_per_node, ffconfig.num_nodes)) ffmodel = FFModel(ffconfig) dims_input = [ffconfig.batch_size, 3, 32, 32] input = ffmodel.create_tensor(dims_input, DataType.DT_FLOAT) if test_type == 1: onnx_model = ONNXModel("cifar10_cnn_pt.onnx") t = onnx_model.apply(ffmodel, {"input.1": input}) else: onnx_model = ONNXModelKeras("cifar10_cnn_keras.onnx", ffconfig, ffmodel) t = onnx_model.apply(ffmodel, {"input_1": input}) ffoptimizer = SGDOptimizer(ffmodel, 0.01) ffmodel.optimizer = ffoptimizer ffmodel.compile(loss_type=LossType.LOSS_SPARSE_CATEGORICAL_CROSSENTROPY, metrics=[ MetricsType.METRICS_ACCURACY, MetricsType.METRICS_SPARSE_CATEGORICAL_CROSSENTROPY ]) label = ffmodel.label_tensor num_samples = 10000 (x_train, y_train), (x_test, y_test) = cifar10.load_data(num_samples) x_train = x_train.astype('float32') x_train /= 255 full_input_array = x_train print(full_input_array.__array_interface__["strides"]) y_train = y_train.astype('int32') full_label_array = y_train dataloader_input = ffmodel.create_data_loader(input, full_input_array) dataloader_label = ffmodel.create_data_loader(label, full_label_array) num_samples = dataloader_input.num_samples ffmodel.init_layers() epochs = ffconfig.epochs ts_start = ffconfig.get_current_time() ffmodel.fit(x=dataloader_input, y=dataloader_label, epochs=epochs) ts_end = ffconfig.get_current_time() run_time = 1e-6 * (ts_end - ts_start) print("epochs %d, ELAPSED TIME = %.4fs, THROUGHPUT = %.2f samples/s\n" % (epochs, run_time, num_samples * epochs / run_time)) perf_metrics = ffmodel.get_perf_metrics() accuracy = perf_metrics.get_accuracy() if accuracy < ModelAccuracy.CIFAR10_CNN.value: assert 0, 'Check Accuracy'
def top_level_task(): ffconfig = FFConfig() alexnetconfig = NetConfig() print(alexnetconfig.dataset_path) ffconfig.parse_args() print("Python API batchSize(%d) workersPerNodes(%d) numNodes(%d)" % (ffconfig.get_batch_size(), ffconfig.get_workers_per_node(), ffconfig.get_num_nodes())) ffmodel = FFModel(ffconfig) dims_input = [ffconfig.get_batch_size(), 3, 229, 229] #print(dims) input = ffmodel.create_tensor(dims_input, "", DataType.DT_FLOAT) # dims_label = [ffconfig.get_batch_size(), 1] # #print(dims) # label = ffmodel.create_tensor(dims_label, "", DataType.DT_INT32) onnx_model = ONNXModel("alexnet.onnx") t = onnx_model.apply(ffmodel, {"input.1": input}) ffoptimizer = SGDOptimizer(ffmodel, 0.01) ffmodel.set_sgd_optimizer(ffoptimizer) ffmodel.compile(loss_type=LossType.LOSS_SPARSE_CATEGORICAL_CROSSENTROPY, metrics=[ MetricsType.METRICS_ACCURACY, MetricsType.METRICS_SPARSE_CATEGORICAL_CROSSENTROPY ]) label = ffmodel.get_label_tensor() use_external = True if (use_external == True): num_samples = 10000 (x_train, y_train), (x_test, y_test) = cifar10.load_data(num_samples) full_input_np = np.zeros((num_samples, 3, 229, 229), 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((229, 229), 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, 229, 229] 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) #dataloader = DataLoader4D(ffmodel, input, label, full_input, full_label, num_samples) 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() else: # Data Loader dataloader = DataLoader4D(ffmodel, input, label, ffnetconfig=alexnetconfig) num_samples = dataloader.get_num_samples() # input.inline_map(ffconfig) # input_array = input.get_array(ffconfig, DataType.DT_FLOAT) # input_array *= 1.0 # print(input_array.shape) # input.inline_unmap(ffconfig) # label.inline_map(ffconfig) # label.inline_unmap(ffconfig) ffmodel.init_layers() # conv_2d1 = ffmodel.get_layer_by_id(11) # cbias_tensor = conv_2d1.get_weight_tensor() # input_tensor = conv_2d1.get_input_tensor_by_id(0) # cbias_tensor.inline_map(ffconfig) # cbias = cbias_tensor.get_array(ffconfig, DataType.DT_FLOAT) # # cbias += 0.125 # print(cbias.shape) # #print(cbias) # cbias_tensor.inline_unmap(ffconfig) #use_external = False epochs = ffconfig.get_epochs() ts_start = ffconfig.get_current_time() for epoch in range(0, epochs): if (use_external == True): dataloader_input.reset() dataloader_label.reset() else: dataloader.reset() ffmodel.reset_metrics() iterations = int(num_samples / ffconfig.get_batch_size()) print(iterations, num_samples) for iter in range(0, int(iterations)): if (use_external == True): dataloader_input.next_batch(ffmodel) dataloader_label.next_batch(ffmodel) else: dataloader.next_batch(ffmodel) if (epoch > 0): ffconfig.begin_trace(111) ffmodel.forward() ffmodel.zero_gradients() ffmodel.backward() ffmodel.update() if (epoch > 0): ffconfig.end_trace(111) ts_end = ffconfig.get_current_time() run_time = 1e-6 * (ts_end - ts_start) print("epochs %d, ELAPSED TIME = %.4fs, THROUGHPUT = %.2f samples/s\n" % (epochs, run_time, num_samples * epochs / run_time)) perf_metrics = ffmodel.get_perf_metrics() accuracy = perf_metrics.get_accuracy() if accuracy < ModelAccuracy.CIFAR10_ALEXNET.value: assert 0, 'Check Accuracy' #ffmodel.print_layers(13) conv_2d1 = ffmodel.get_layer_by_id(0) #cbias_tensor = conv_2d1.get_input_tensor() cbias_tensor = conv_2d1.get_input_tensor() cbias_tensor.inline_map(ffconfig) cbias = cbias_tensor.get_flat_array(ffconfig, DataType.DT_FLOAT) print(cbias.shape) print(cbias) #save_image(cbias, 2) cbias_tensor.inline_unmap(ffconfig) label.inline_map(ffconfig) label_array = label.get_flat_array(ffconfig, DataType.DT_INT32) print(label_array.shape) # print(cbias) print(label_array) label.inline_unmap(ffconfig)
def top_level_task(): ffconfig = FFConfig() alexnetconfig = NetConfig() print(alexnetconfig.dataset_path) ffconfig.parse_args() print("Python API batchSize(%d) workersPerNodes(%d) numNodes(%d)" % (ffconfig.get_batch_size(), ffconfig.get_workers_per_node(), ffconfig.get_num_nodes())) ffmodel = FFModel(ffconfig) dims_input = [ffconfig.get_batch_size(), 3, 32, 32] input = ffmodel.create_tensor(dims_input, DataType.DT_FLOAT) onnx_model = ONNXModel("cifar10_cnn.onnx") t = onnx_model.apply(ffmodel, {"input.1": input}) ffoptimizer = SGDOptimizer(ffmodel, 0.01) ffmodel.set_sgd_optimizer(ffoptimizer) ffmodel.compile(loss_type=LossType.LOSS_SPARSE_CATEGORICAL_CROSSENTROPY, metrics=[ MetricsType.METRICS_ACCURACY, MetricsType.METRICS_SPARSE_CATEGORICAL_CROSSENTROPY ]) label = ffmodel.get_label_tensor() num_samples = 10000 (x_train, y_train), (x_test, y_test) = cifar10.load_data(num_samples) x_train = x_train.astype('float32') x_train /= 255 full_input_array = x_train print(full_input_array.__array_interface__["strides"]) y_train = y_train.astype('int32') full_label_array = y_train dims_full_input = [num_samples, 3, 32, 32] 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_array) full_label.attach_numpy_array(ffconfig, full_label_array) 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() ffmodel.init_layers() epochs = ffconfig.get_epochs() ts_start = ffconfig.get_current_time() ffmodel.fit(x=dataloader_input, y=dataloader_label, epochs=epochs) ts_end = ffconfig.get_current_time() run_time = 1e-6 * (ts_end - ts_start) print("epochs %d, ELAPSED TIME = %.4fs, THROUGHPUT = %.2f samples/s\n" % (epochs, run_time, num_samples * epochs / run_time)) perf_metrics = ffmodel.get_perf_metrics() accuracy = perf_metrics.get_accuracy() if accuracy < ModelAccuracy.CIFAR10_CNN.value: assert 0, 'Check Accuracy'
def top_level_task(): ffconfig = FFConfig() resnetconfig = NetConfig() print(resnetconfig.dataset_path) ffconfig.parse_args() print("Python API batchSize(%d) workersPerNodes(%d) numNodes(%d)" % (ffconfig.get_batch_size(), ffconfig.get_workers_per_node(), ffconfig.get_num_nodes())) ffmodel = FFModel(ffconfig) dims_input = [ffconfig.get_batch_size(), 3, 229, 229] inputi = ffmodel.create_tensor(dims_input, DataType.DT_FLOAT) model = rgn.RegNetX32gf() model = nn.Sequential(model, nn.Flatten(), nn.Linear(2520 * 7 * 7, 1000)) onnx_input = torch.randn(64, 3, 229, 229) onnx_model = ONNXModel(model, onnx_input) t = onnx_model.apply(ffmodel, {"input.1": inputi}) t = ffmodel.softmax(t) ffoptimizer = SGDOptimizer(ffmodel, 0.01) ffmodel.set_sgd_optimizer(ffoptimizer) ffmodel.compile(loss_type=LossType.LOSS_SPARSE_CATEGORICAL_CROSSENTROPY, metrics=[ MetricsType.METRICS_ACCURACY, MetricsType.METRICS_SPARSE_CATEGORICAL_CROSSENTROPY ]) label = ffmodel.get_label_tensor() num_samples = 10000 (x_train, y_train), (x_test, y_test) = cifar10.load_data(num_samples) full_input_np = np.zeros((num_samples, 3, 229, 229), 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((229, 229), Image.NEAREST) image = np.array(pil_image, dtype=np.float32) image = image.transpose(2, 0, 1) full_input_np[i, :, :, :] = image full_input_np /= 255 print("$$$$$$$$$$$$$$$$$$$FULL_INPUT_NP$$$$$$$$$$$$$$$$$$$$") print(full_input_np) input("ENTER to continue.") y_train = y_train.astype('int32') full_label_np = y_train dims_full_input = [num_samples, 3, 229, 229] 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) print(full_input) input("ENTER to continue.") dataloader_input = SingleDataLoader(ffmodel, inputi, 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() epochs = ffconfig.get_epochs() ts_start = ffconfig.get_current_time() ffmodel.fit(x=dataloader_input, y=dataloader_label, epochs=epochs) ts_end = ffconfig.get_current_time() run_time = 1e-6 * (ts_end - ts_start) print("epochs %d, ELAPSED TIME = %.4fs, THROUGHPUT = %.2f samples/s\n" % (epochs, run_time, num_samples * epochs / run_time)) perf_metrics = ffmodel.get_perf_metrics() accuracy = perf_metrics.get_accuracy() if accuracy < ModelAccuracy.CIFAR10_ALEXNET.value: assert 0, 'Check Accuracy'