diff --git "a/data/dataset_RNN.csv" "b/data/dataset_RNN.csv" new file mode 100644--- /dev/null +++ "b/data/dataset_RNN.csv" @@ -0,0 +1,26529 @@ +"keyword","repo_name","file_path","file_extension","file_size","line_count","content","language" +"RNN","Wu-2/BP_Prediction","RNN/ppgPredictAbp125forSBP.py",".py","9385","230","# -*- coding: utf-8 -*- +"""""" +Created on Thu Jan 11 10:50:29 2018 + +@author: FZM +"""""" + + +from scipy.io import loadmat +import tensorflow as tf +import numpy as np +import matplotlib.pyplot as plt + + +#——————————————————导入数据—————————————————————— +result_dict=loadmat(""dataRNNsum2_5"") #测试数据为高血压 +dataPPGtra = result_dict['dataPPGtra'] +dataABPtra = result_dict['dataABPtra'] +dataPPGtes = result_dict['dataPPGtes'] +dataABPtes = result_dict['dataABPtes'] +#res_true = np.zeros((125,2000)) +#res_cal = np.zeros((125,2000)) + +BATCH_START = 0 # 建立 batch data 时候的 index +#TIME_STEPS = 20 # backpropagation through time 的 time_steps +#BATCH_SIZE = 50 +TIME_STEPS = 125 # backpropagation through time 的 time_steps +BATCH_SIZE = 1 +INPUT_SIZE = 1 # sin 数据输入 size +OUTPUT_SIZE = 1 # cos 数据输出 size +CELL_SIZE = 10 # RNN 的 hidden unit size +LR = 0.006 # learning rate + +def get_batch(step): + global BATCH_START, TIME_STEPS + # xs shape (1642batch, 500steps) + xs = np.arange(BATCH_START, BATCH_START+TIME_STEPS*BATCH_SIZE).reshape((BATCH_SIZE, TIME_STEPS)) + #seq_tmp = dataPPGtra[step,0:500] + #seq = np.transpose(seq_tmp) + #res_tmp = dataABPtra[step,0:500] + #res = np.transpose(res_tmp) + seq = dataPPGtra[step:step+BATCH_SIZE,:] + res = dataABPtra[step:step+BATCH_SIZE,:] + BATCH_START += TIME_STEPS + # returned seq, res and xs: shape (batch, step, input) + return [seq[:, :, np.newaxis], res[:, :, np.newaxis], xs] + +# ============================================================================= +# global BATCH_START, TIME_STEPS +# # xs shape (50batch, 20steps) +# xs = np.arange(BATCH_START, BATCH_START+TIME_STEPS*BATCH_SIZE).reshape((BATCH_SIZE, TIME_STEPS)) / (10*np.pi) +# seq = np.sin(xs) +# res = np.cos(xs) +# BATCH_START += TIME_STEPS +# # returned seq, res and xs: shape (batch, step, input) +# return [seq[:, :, np.newaxis], res[:, :, np.newaxis], xs] +# ============================================================================= + + +class LSTMRNN(object): + def __init__(self, n_steps, input_size, output_size, cell_size, batch_size): + #ValueError:https://sthsf.github.io/2017/06/18/ValueError:%20kernel%20already%20exists/ + tf.reset_default_graph() + + self.n_steps = n_steps + self.input_size = input_size + self.output_size = output_size + self.cell_size = cell_size + self.batch_size = batch_size + with tf.name_scope('inputs'): + self.xs = tf.placeholder(tf.float32, [None, n_steps, input_size], name='xs') + self.ys = tf.placeholder(tf.float32, [None, n_steps, output_size], name='ys') +#error:http://blog.csdn.net/u014283248/article/details/64440268 + with tf.variable_scope('in_hidden'): + self.add_input_layer() + with tf.variable_scope('LSTM_cell'): + self.add_cell() + with tf.variable_scope('out_hidden'): + self.add_output_layer() + + with tf.name_scope('cost'): + self.compute_cost() + with tf.name_scope('train'): + self.train_op = tf.train.AdamOptimizer(LR).minimize(self.cost) + def add_input_layer(self,): + l_in_x = tf.reshape(self.xs, [-1, self.input_size], name='2_2D') # (batch*n_step, in_size) + # Ws (in_size, cell_size) + Ws_in = self._weight_variable([self.input_size, self.cell_size]) + # bs (cell_size, ) + bs_in = self._bias_variable([self.cell_size,]) + # l_in_y = (batch * n_steps, cell_size) + with tf.name_scope('Wx_plus_b'): + l_in_y = tf.matmul(l_in_x, Ws_in) + bs_in + # reshape l_in_y ==> (batch, n_steps, cell_size) + self.l_in_y = tf.reshape(l_in_y, [-1, self.n_steps, self.cell_size], name='2_3D') + def add_cell(self): + lstm_cell = tf.contrib.rnn.BasicLSTMCell(self.cell_size, forget_bias=1.0, state_is_tuple=True) + with tf.name_scope('initial_state'): + self.cell_init_state = lstm_cell.zero_state(self.batch_size, dtype=tf.float32) + self.cell_outputs, self.cell_final_state = tf.nn.dynamic_rnn( + lstm_cell, self.l_in_y, initial_state=self.cell_init_state, time_major=False) + def add_output_layer(self): + # shape = (batch * steps, cell_size) + l_out_x = tf.reshape(self.cell_outputs, [-1, self.cell_size], name='2_2D') + Ws_out = self._weight_variable([self.cell_size, self.output_size]) + bs_out = self._bias_variable([self.output_size, ]) + # shape = (batch * steps, output_size) + with tf.name_scope('Wx_plus_b'): + self.pred = tf.matmul(l_out_x, Ws_out) + bs_out + def compute_cost(self): + losses = tf.contrib.legacy_seq2seq.sequence_loss_by_example( + [tf.reshape(self.pred, [-1], name='reshape_pred')], + [tf.reshape(self.ys, [-1], name='reshape_target')], + [tf.ones([self.batch_size * self.n_steps], dtype=tf.float32)], + average_across_timesteps=True, + softmax_loss_function=self.ms_error, + name='losses' + ) + with tf.name_scope('average_cost'): + self.cost = tf.div( + tf.reduce_sum(losses, name='losses_sum'), + self.batch_size, + name='average_cost') + tf.summary.scalar('cost', self.cost) + +# ============================================================================= +# def ms_error(self, y_target, y_pre): +# return tf.square(tf.sub(y_target, y_pre)) +# ============================================================================= + + def ms_error(self, labels, logits): + return tf.square(tf.subtract(labels,logits)) + + def _weight_variable(self, shape, name='weights'): + initializer = tf.random_normal_initializer(mean=0., stddev=1.,) + return tf.get_variable(shape=shape, initializer=initializer, name=name) + + def _bias_variable(self, shape, name='biases'): + initializer = tf.constant_initializer(0.1) + return tf.get_variable(name=name, shape=shape, initializer=initializer) + +if __name__ == '__main__': + # 搭建 LSTMRNN 模型 + model = LSTMRNN(TIME_STEPS, INPUT_SIZE, OUTPUT_SIZE, CELL_SIZE, BATCH_SIZE) + sess = tf.Session() + # sess.run(tf.initialize_all_variables()) # tf 马上就要废弃这种写法 + # 替换成下面的写法: + sess.run(tf.global_variables_initializer()) + + plt.ion() # 设置连续 plot + plt.show() + + # 训练 200 次 + for step in range(10000): + seq, res, xs = get_batch(step) # 提取 batch data + if step == 0: + # 初始化 data + feed_dict = { + model.xs: seq, + model.ys: res, + } + else: + feed_dict = { + model.xs: seq, + model.ys: res, + model.cell_init_state: state # 保持 state 的连续性 + } + + # 训练 + _, cost, state, pred = sess.run( + [model.train_op, model.cost, model.cell_final_state, model.pred], + feed_dict=feed_dict) + + # 记录输出值 + #res_true[:,step] = res[0].flatten(); + #res_cal[:,step] = pred.flatten()[:TIME_STEPS]; + + """""" + # plotting + plt.plot(xs[0, :], res[0].flatten(), 'r', xs[0, :], pred.flatten()[:TIME_STEPS], 'b--') + plt.ylim((-1.2, 1.2)) + plt.draw() + #plt.pause(0.3) # 每 0.3 s 刷新一次 + """""" + +# ============================================================================= +# # 打印 cost 结果 +# if step % 20 == 0: +# print('cost: ', round(cost, 4)) +# ============================================================================= + print(""......Test Start......"") + result = np.zeros((1000,3)) + abpresult = np.zeros((1000,125)) + #mse = np.zeros((20,1)) + #doc = open('result.txt','w') + for i in range(1000): + seq = dataPPGtes[i:i+1,:] + seq = seq[:, :, np.newaxis] + res = dataABPtes[i:i+1,:] + res = res[:, :, np.newaxis] + feed_dict = { + model.xs: seq, + model.ys: res, + } + state, pred = sess.run( + [model.cell_final_state, model.pred], feed_dict=feed_dict) + mse = tf.reduce_mean(tf.abs((pred[:TIME_STEPS]*120+30) - (res[0]*120+30))) + result[i,0] = sess.run(mse) + print(""MSE: %.4f"",result[i,0]) + abpresult[i,:] = np.transpose(pred[:TIME_STEPS]*120+30) + #print(result[i,0]) + #mse1 = tf.reduce_mean(tf.abs((pred.flatten()[:TIME_STEPS]*120+30) - (res[0].flatten()*120+30))) + #print(""MSE1: %.4f"" % sess.run(mse1)) + MseSbp = tf.reduce_mean(tf.abs(max(pred[:TIME_STEPS]*120+30) - max(res[0]*120+30))) + result[i,1] = sess.run(MseSbp) + print(""MseSbp: %.4f"",result[i,1]) + #print(result[i,1]) + MseDbp = tf.reduce_mean(tf.abs(min(pred[:TIME_STEPS]*120+30) - min(res[0]*120+30))) + result[i,2] = sess.run(MseDbp) + print(""MseDbp: %.4f"",result[i,2]) + #print(result[i,2]) + + #print(result[i,0],file=doc) + #doc.flush() + #print(result[i,1],file=doc) + #doc.flush() + #print(result[i,2],file=doc) + #doc.flush() + + #doc.close()","Python" +"RNN","sparalic/Electronic-Health-Records-GRUs","Working with Health Care EHR Data Part 2- Pre-processing EHR data.ipynb",".ipynb","18608","613","{ + ""cells"": [ + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## Part 2- Pre-processing EHR data\n"", + ""by:Sparkle Russell-Puleri and Dorian Puleri"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""#### Background: Detailed review of Doctor AI: Predicting Clinical Events via Recurrent Neural Nets (Choi et.al 2016)\n"", + ""The intent of tutorial is to provide a detailed step through on how EHR data should be pre-processed for use in RNNs using Pytorch. This paper is one of the few papers that provide a code base to start taking a detailed look into how we can build generic models that leverages temporal models to predict future clinical events. However, while this highly cited paper is open sourced (written using Theano:https://github.com/mp2893/doctorai), it assumes quite a bit about it's readers. As such, we have modernized the code for ease of use in python 3+ and provided a detailed explanation of each step to allow anyone, with a computer and access to healthcare data to begin trying to develop innovative solutions to solve healthcare challenges. "" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Important Disclaimer: \n"", + ""This data set was artificial created with two patients in Part 1 of this series to help provide readers with a clear understanding of the structure of EHR data. Please note that each EHR system is specifically designed to meet a specific providers needs and this is just a basic example of data that is typically contained in most systems. Additionally, it is also key to note that this tutorial begins after all of the desired exclusion and inclusion criteria related to your research question has been performed. Therefore, at this step your data would have been fully wrangled and cleaned."" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 2, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""application/javascript"": [ + ""IPython.notebook.set_autosave_interval(180000)"" + ] + }, + ""metadata"": {}, + ""output_type"": ""display_data"" + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Autosaving every 180 seconds\n"" + ] + } + ], + ""source"": [ + ""import pandas as pd\n"", + ""import numpy as np\n"", + ""import pandas as pd\n"", + ""from time import time\n"", + ""import matplotlib.pyplot as plt\n"", + ""import seaborn as sns\n"", + ""import sys\n"", + ""import warnings\n"", + ""from datetime import datetime\n"", + ""import torch\n"", + ""import pickle\n"", + ""from collections import defaultdict\n"", + ""warnings.filterwarnings('ignore')\n"", + ""sns.set(style='white')\n"", + ""%autosave 180"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Load data : A quick review of the artifical EHR data we created in Part 1:\n"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + """" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Step 1: Create mappings of patient IDs \n"", + ""In this step we are going to create a dictionary that maps each patient with his or her specific visit or `Admission ID`."" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + """" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 6, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Creating visit date mapping\n"" + ] + } + ], + ""source"": [ + ""print('Creating visit date mapping')\n"", + ""patHashMap = dict(defaultdict(list)) # this creates a dictionary with a list of values for each patient:[number of visists]\n"", + ""visitMap = dict(defaultdict()) # this creates a dictionary with a mapping of the patientID : visitdates\n"", + ""\n"", + ""data = open('data/Admissions_Table.csv','r')\n"", + ""data.readline()[1:] # read every line except the file header\n"", + ""\n"", + ""for line in data:\n"", + "" feature = line.strip().split(',') # split line on , and isolate columns\n"", + "" visitDateID = datetime.strptime(feature[3],'%Y-%m-%d') \n"", + "" patHashMap.setdefault(feature[1], []).append(feature[0]) # create a mapping for each visit for a specific PatientID\n"", + "" visitMap.setdefault(feature[0], []).append(visitDateID) # create a mapping for each visit for a specific Admission Date"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 7, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""{'A1234-B456': ['A1234-12', 'A1234-34', 'A1234-15'],\n"", + "" 'B1234-C456': ['B1234-13', 'B1234-34']}"" + ] + }, + ""execution_count"": 7, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""#Patient ID- visit mapping\n"", + ""patHashMap"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 8, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""{'A1234-12': [datetime.datetime(2019, 1, 3, 0, 0)],\n"", + "" 'A1234-34': [datetime.datetime(2019, 2, 3, 0, 0)],\n"", + "" 'A1234-15': [datetime.datetime(2019, 4, 3, 0, 0)],\n"", + "" 'B1234-13': [datetime.datetime(2018, 1, 3, 0, 0)],\n"", + "" 'B1234-34': [datetime.datetime(2018, 2, 3, 0, 0)]}"" + ] + }, + ""execution_count"": 8, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""# Patient Admission ID- visit date mapping\n"", + ""visitMap"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## Step 2: Create Diagnosis Code Mapped to each unique patient and visit\n"", + ""This step as with all subsequent steps is very important as it is important to keep the patient's diagnosis codes in the correct visit order."" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + """" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 9, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Creating Diagnosis-Visit mapping\n"" + ] + } + ], + ""source"": [ + ""print('Creating Diagnosis-Visit mapping')\n"", + ""visitDxMap = dict(defaultdict(list))\n"", + ""\n"", + ""data = open('data/Diagnosis_Table.csv', 'r')\n"", + ""data.readline()[1:]\n"", + ""\n"", + ""for line in data:\n"", + "" feature = line.strip().split(',')\n"", + "" visitDxMap.setdefault(feature[0], []).append('D_' + feature[4].split('.')[0]) # add a unique identifier before the"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 10, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""{'A1234-12': ['D_E11', 'D_I25', 'D_I25'],\n"", + "" 'A1234-34': ['D_E11', 'D_I25', 'D_I25', 'D_780', 'D_784'],\n"", + "" 'A1234-15': ['D_E11', 'D_I25', 'D_I25', 'D_786', 'D_401', 'D_789'],\n"", + "" 'B1234-13': ['D_M05', 'D_Z13', 'D_O99'],\n"", + "" 'B1234-34': ['D_M05', 'D_Z13', 'D_O99', 'D_D37']}"" + ] + }, + ""execution_count"": 10, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""visitDxMap # Mapping of each Admission ID to each diagnosis code assigned during that visit"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Step 3: Embed diagnosis codes into visit mapping Patient-Admission mapping\n"", + ""This step essentially adds each code assigned to the patient directing into the dictionary with the patient-admission id mapping and the visit date mapping `visitMap`. Which allows us to have a list of list of diagnosis codes that each patient recieved during each visit."" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + """" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 11, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Sorting visit mapping\n"" + ] + } + ], + ""source"": [ + ""print(\""Sorting visit mapping\"")\n"", + ""patDxVisitOrderMap = {}\n"", + ""for patid, visitDates in patHashMap.items():\n"", + "" sorted_list = ([(visitMap[visitDateID], visitDxMap[visitDateID]) for visitDateID in visitDates])\n"", + "" patDxVisitOrderMap[patid] = sorted_list "" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 12, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""{'A1234-B456': [([datetime.datetime(2019, 1, 3, 0, 0)],\n"", + "" ['D_E11', 'D_I25', 'D_I25']),\n"", + "" ([datetime.datetime(2019, 2, 3, 0, 0)],\n"", + "" ['D_E11', 'D_I25', 'D_I25', 'D_780', 'D_784']),\n"", + "" ([datetime.datetime(2019, 4, 3, 0, 0)],\n"", + "" ['D_E11', 'D_I25', 'D_I25', 'D_786', 'D_401', 'D_789'])],\n"", + "" 'B1234-C456': [([datetime.datetime(2018, 1, 3, 0, 0)],\n"", + "" ['D_M05', 'D_Z13', 'D_O99']),\n"", + "" ([datetime.datetime(2018, 2, 3, 0, 0)],\n"", + "" ['D_M05', 'D_Z13', 'D_O99', 'D_D37'])]}"" + ] + }, + ""execution_count"": 12, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""patDxVisitOrderMap"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Step 4a: Extract patient IDs, visit dates and diagnosis\n"", + ""In this step, we will create a list of all of the diagnosis codes, this will then be used in step 4b to convert these strings into integers for modeling."" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + """" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 13, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Extracting patient IDs, visit dates and diagnosis codes into individual lists for encoding\n"" + ] + } + ], + ""source"": [ + ""print(\""Extracting patient IDs, visit dates and diagnosis codes into individual lists for encoding\"")\n"", + ""patIDs = [patid for patid, visitDate in patDxVisitOrderMap.items()]\n"", + ""datesList = [[visit[0][0] for visit in visitDate] for patid, visitDate in patDxVisitOrderMap.items()]\n"", + ""DxsCodesList = [[visit[1] for visit in visitDate] for patid, visitDate in patDxVisitOrderMap.items()]"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 14, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""['A1234-B456', 'B1234-C456']"" + ] + }, + ""execution_count"": 14, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""patIDs"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 15, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""[[datetime.datetime(2019, 1, 3, 0, 0),\n"", + "" datetime.datetime(2019, 2, 3, 0, 0),\n"", + "" datetime.datetime(2019, 4, 3, 0, 0)],\n"", + "" [datetime.datetime(2018, 1, 3, 0, 0), datetime.datetime(2018, 2, 3, 0, 0)]]"" + ] + }, + ""execution_count"": 15, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""datesList"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 16, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""[[['D_E11', 'D_I25', 'D_I25'],\n"", + "" ['D_E11', 'D_I25', 'D_I25', 'D_780', 'D_784'],\n"", + "" ['D_E11', 'D_I25', 'D_I25', 'D_786', 'D_401', 'D_789']],\n"", + "" [['D_M05', 'D_Z13', 'D_O99'], ['D_M05', 'D_Z13', 'D_O99', 'D_D37']]]"" + ] + }, + ""execution_count"": 16, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""DxsCodesList"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Step 4b: Create a dictionary of the unique diagnosis codes assigned at each visit for each unique patient\n"", + ""Here we need to make sure that the codes are not only converted to integers but that they are kept in the unique orders in which they were administered to each unique patient."" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + """" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 76, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Encoding string Dx codes to integers and mapping the encoded integer value to the ICD-10 code for interpretation\n"" + ] + } + ], + ""source"": [ + ""print('Encoding string Dx codes to integers and mapping the encoded integer value to the ICD-10 code for interpretation')\n"", + ""DxCodeDictionary = {}\n"", + ""encodedDxs = []\n"", + ""for patient in DxsCodesList:\n"", + "" encodedPatientDxs = []\n"", + "" for visit in patient:\n"", + "" encodedVisit = []\n"", + "" for code in visit:\n"", + "" if code in DxCodeDictionary:\n"", + "" encodedVisit.append(DxCodeDictionary[code])\n"", + "" else:\n"", + "" DxCodeDictionary[code] = len(DxCodeDictionary)\n"", + "" encodedVisit.append(DxCodeDictionary[code])\n"", + "" encodedPatientDxs.append(encodedVisit)\n"", + "" encodedDxs.append(encodedPatientDxs)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 78, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""{'D_E11': 0,\n"", + "" 'D_I25': 1,\n"", + "" 'D_780': 2,\n"", + "" 'D_784': 3,\n"", + "" 'D_786': 4,\n"", + "" 'D_401': 5,\n"", + "" 'D_789': 6,\n"", + "" 'D_M05': 7,\n"", + "" 'D_Z13': 8,\n"", + "" 'D_O99': 9,\n"", + "" 'D_D37': 10}"" + ] + }, + ""execution_count"": 78, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""DxCodeDictionary # Dictionary of all unique codes in the entire dataset aka: Our Code Vocabulary"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 79, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""[[[0, 1, 1], [0, 1, 1, 2, 3], [0, 1, 1, 4, 5, 6]], [[7, 8, 9], [7, 8, 9, 10]]]"" + ] + }, + ""execution_count"": 79, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""encodedDxs # Converted list of list with integer converted diagnosis codes"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Step 6: Dump the data into a pickled list of list "" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 84, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Dumping files into a pickled list\n"" + ] + } + ], + ""source"": [ + ""outFile = 'ArtificialEHR_Data'\n"", + ""print('Dumping files into a pickled list')\n"", + ""pickle.dump(patIDs, open(outFile+'.patIDs', 'wb'),-1)\n"", + ""pickle.dump(datesList, open(outFile+'.dates', 'wb'),-1)\n"", + ""pickle.dump(encodedDxs, open(outFile+'.encodedDxs', 'wb'),-1)\n"", + ""pickle.dump(DxCodeDictionary, open(outFile+'.Dxdictionary', 'wb'),-1)"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Full Script"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": null, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""print('Creating visit date mapping')\n"", + ""patHashMap = dict(defaultdict(list)) # this creates a dictionary with a list of values for each patient:[number of visists]\n"", + ""visitMap = dict(defaultdict()) # this creates a dictionary with a mapping of the patientID : visitdates\n"", + ""\n"", + ""data = open('data/Admissions_Table.csv','r')\n"", + ""data.readline()[1:] # read every line except the file header\n"", + ""\n"", + ""for line in data:\n"", + "" feature = line.strip().split(',')\n"", + "" visitDateID = datetime.strptime(feature[4],'%Y-%m-%d')\n"", + "" patHashMap.setdefault(feature[0], []).append(feature[1])\n"", + "" visitMap.setdefault(feature[1], []).append(visitDateID)\n"", + ""\n"", + ""print('Creating Diagnosis-Visit mapping')\n"", + ""visitDxMap = dict(defaultdict(list))\n"", + ""\n"", + ""data = open('data/Diagnosis_Table.csv', 'r')\n"", + ""data.readline()[1:]\n"", + ""\n"", + ""for line in data:\n"", + "" feature = line.strip().split(',')\n"", + "" visitDxMap.setdefault(feature[1], []).append('D_' + feature[7].split('.')[0])\n"", + ""\n"", + ""print(\""Sorting visit mapping\"")\n"", + ""patDxVisitOrderMap = {}\n"", + ""for patid, visitDates in patHashMap.items():\n"", + "" sorted_list = ([(visitMap[visitDateID], visitDxMap[visitDateID]) for visitDateID in visitDates])\n"", + "" patDxVisitOrderMap[patid] = sorted_list \n"", + ""\n"", + ""print(\""Extracting patient IDs, visit dates and diagnosis codes into individual lists for encoding\"")\n"", + ""patIDs = [patid for patid, visitDate in patDxVisitOrderMap.items()]\n"", + ""datesList = [[visit[0][0] for visit in visitDate] for patid, visitDate in patDxVisitOrderMap.items()]\n"", + ""DxsCodesList = [[visit[1] for visit in visitDate] for patid, visitDate in patDxVisitOrderMap.items()]\n"", + ""\n"", + ""print('Encoding string Dx codes to integers and mapping the encoded integer value to the ICD-10 code for interpretation')\n"", + ""DxCodeDictionary = {}\n"", + ""encodedDxs = []\n"", + ""for patient in DxsCodesList:\n"", + "" encodedPatientDxs = []\n"", + "" for visit in patient:\n"", + "" encodedVisit = []\n"", + "" for code in visit:\n"", + "" if code in DxCodeDictionary:\n"", + "" encodedVisit.append(DxCodeDictionary[code])\n"", + "" else:\n"", + "" DxCodeDictionary[code] = len(DxCodeDictionary)\n"", + "" encodedVisit.append(DxCodeDictionary[code])\n"", + "" encodedPatientDxs.append(encodedVisit)\n"", + "" encodedDxs.append(encodedPatientDxs)"" + ] + } + ], + ""metadata"": { + ""kernelspec"": { + ""display_name"": ""Python 3"", + ""language"": ""python"", + ""name"": ""python3"" + }, + ""language_info"": { + ""codemirror_mode"": { + ""name"": ""ipython"", + ""version"": 3 + }, + ""file_extension"": "".py"", + ""mimetype"": ""text/x-python"", + ""name"": ""python"", + ""nbconvert_exporter"": ""python"", + ""pygments_lexer"": ""ipython3"", + ""version"": ""3.7.2"" + } + }, + ""nbformat"": 4, + ""nbformat_minor"": 2 +} +","Unknown" +"RNN","sparalic/Electronic-Health-Records-GRUs","Working with Health Care EHR Data Part 1-Generating fake EHR data.ipynb",".ipynb","26537","719","{ + ""cells"": [ + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## Generating fake EHR data\n"", + ""by: Sparkle Russell-Puleri and Dorian Puleri\n"", + ""\n"", + ""For the purpose of this three part tutorial, we generated some artificial EHR data to demonstrate how EHR data should be processed for use in sequence models. Please note that this data has no clinical relevance and was just created for training purposes only."" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 1, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""import pandas as pd\n"", + ""import numpy as np"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Patient Admission Table\n"", + ""This table contains information on the patient admission history and times. The features generated were:\n"", + ""1. `PatientID`- Unique identifier that stay with the patient permanently\n"", + ""2. `Admission ID` - Specific to each visit\n"", + ""3. `AdmissionStartDate` - Date and time of admission \n"", + ""4. `AdmissionEndDate` - Date and time of discharge after care for a specific admission ID"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 84, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""admission_table = {'Patient 1': {'PatientID':'A1234-B456', \n"", + "" 'Admission ID':[12,34,15], \n"", + "" 'AdmissionStartDate':['2019-01-03 9:34:55','2019-02-03 10:50:55','2019-04-03 12:34:55'],\n"", + "" 'AdmissionEndDate':['2019-01-07 8:45:43','2019-03-04 1:50:32','2019-04-03 5:38:18']},\n"", + "" 'Patient 2': {'PatientID':'B1234-C456', \n"", + "" 'Admission ID':[13,34], \n"", + "" 'AdmissionStartDate':['2018-01-03 9:34:55','2018-02-03 10:50:55'],\n"", + "" 'AdmissionEndDate':['2018-01-07 8:45:43','2018-03-04 1:50:32']}}\n"", + ""admission_table = (pd.concat({k: pd.DataFrame(v) for k, v in admission_table.items()}).reset_index(level=1, drop=True))\n"", + ""admission_table = admission_table.reset_index(drop=True)"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Patient Diagnosis Table\n"", + ""The diagnosis table is quite unique, as it can contain several diagnosis codes for the same visit. For example, Patient 1 was diagnosised with diabetes (`PrimaryDiagnosisCode`:E11.64) during his/her first visit (`Admission ID`:12). However, this code also shows up on subsequent visits (`Admission ID`:34, 15), why is that? Well if a patient is diagnosised with an uncurable condition he/she that code will always be associated all subsequent visits. On the other hand, codes associated with acute care, will come and go as seen with `PrimaryDiagnosisCode`:780.96(Headache). "" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 85, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""Patient_1 = {'PatientID':'A1234-B456', \n"", + "" 'Admission ID':[12,34,15], \n"", + "" 'PrimaryDiagnosisCode':[['E11.64','I25.812','I25.10'],\n"", + "" ['E11.64','I25.812','I25.10','780.96','784.0'],\n"", + "" ['E11.64','I25.812','I25.10','786.50','401.9','789.00']],\n"", + "" 'CodingSystem':['ICD-9','ICD-9','ICD-9'],\n"", + "" 'DiagnosisCodeDescription':[['Type 2 diabetes mellitus with hypoglycemia',\n"", + "" 'Atherosclerosis of bypass graft of coronary artery of transplanted heart without angina pectoris',\n"", + "" 'Atherosclerotic heart disease of native coronary artery without angina pectoris'],\n"", + "" ['Type 2 diabetes mellitus with hypoglycemia',\n"", + "" 'Atherosclerosis of bypass graft of coronary artery of transplanted heart without angina pectoris',\n"", + "" 'Atherosclerotic heart disease of native coronary artery without angina pectoris',\n"", + "" 'Generalized Pain', 'Dizziness and giddiness'],\n"", + "" ['Type 2 diabetes mellitus with hypoglycemia',\n"", + "" 'Atherosclerosis of bypass graft of coronary artery of transplanted heart without angina pectoris',\n"", + "" 'Atherosclerotic heart disease of native coronary artery without angina pectoris',\n"", + "" 'Chest pain, unspecified','Essential hypertension, unspecified',\n"", + "" 'Abdominal pain, unspecified site']]}\n"", + ""Patient_2 = {'PatientID':'B1234-C456', \n"", + "" 'Admission ID':[13,34], \n"", + "" 'PrimaryDiagnosisCode':[['M05.59','Z13.85','O99.35'],['M05.59','Z13.85','O99.35','D37.0']],\n"", + "" 'CodingSystem':['ICD-9','ICD-9'],\n"", + "" 'DiagnosisCodeDescription':[['Rheumatoid polyneuropathy with rheumatoid arthritis of multiple sites',\n"", + "" 'Encounter for screening for nervous system disorders',\n"", + "" 'Diseases of the nervous system complicating pregnancy, childbirth, and the puerperium'],\n"", + "" ['Rheumatoid polyneuropathy with rheumatoid arthritis of multiple sites',\n"", + "" 'Encounter for screening for nervous system disorders',\n"", + "" 'Diseases of the nervous system complicating pregnancy, childbirth, and the puerperium',\n"", + "" 'Neoplasm of uncertain behavior of lip, oral cavity and pharynx']]}"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Helper functions for parsing data from a dictionary to DataFrame"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 86, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""def process_ehr(Patient1,Patient2):\n"", + "" pt_diagnosis_table = [Patient1,Patient2]\n"", + "" pt_diagnosis_table = pd.concat([pd.DataFrame({k:v for k,v in d.items()}) for d in pt_diagnosis_table])\n"", + "" \n"", + "" pt_diagnosis_table = (pt_diagnosis_table.set_index(['PatientID', 'Admission ID','CodingSystem'])\n"", + "" .apply(lambda x: x.apply(pd.Series).stack())\n"", + "" .reset_index()\n"", + "" .drop('level_3', 1))\n"", + "" return pt_diagnosis_table\n"", + ""def hash_key(df):\n"", + "" df['HashKey'] = df['PatientID'].\\\n"", + "" apply(lambda x: x.split('-')[0]) + '-' + df['Admission ID'].astype('str')\n"", + "" cols = [df.columns[-1]] + [col for col in df if col != df.columns[-1]]\n"", + "" print(cols)\n"", + "" return df[cols]"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 87, + ""metadata"": { + ""scrolled"": true + }, + ""outputs"": [ + { + ""data"": { + ""text/html"": [ + ""
\n"", + ""\n"", + ""\n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + ""
PatientIDAdmission IDCodingSystemPrimaryDiagnosisCodeDiagnosisCodeDescription
0A1234-B45612ICD-9E11.64Type 2 diabetes mellitus with hypoglycemia
1A1234-B45612ICD-9I25.812Atherosclerosis of bypass graft of coronary ar...
2A1234-B45612ICD-9I25.10Atherosclerotic heart disease of native corona...
3A1234-B45634ICD-9E11.64Type 2 diabetes mellitus with hypoglycemia
4A1234-B45634ICD-9I25.812Atherosclerosis of bypass graft of coronary ar...
\n"", + ""
"" + ], + ""text/plain"": [ + "" PatientID Admission ID CodingSystem PrimaryDiagnosisCode \\\n"", + ""0 A1234-B456 12 ICD-9 E11.64 \n"", + ""1 A1234-B456 12 ICD-9 I25.812 \n"", + ""2 A1234-B456 12 ICD-9 I25.10 \n"", + ""3 A1234-B456 34 ICD-9 E11.64 \n"", + ""4 A1234-B456 34 ICD-9 I25.812 \n"", + ""\n"", + "" DiagnosisCodeDescription \n"", + ""0 Type 2 diabetes mellitus with hypoglycemia \n"", + ""1 Atherosclerosis of bypass graft of coronary ar... \n"", + ""2 Atherosclerotic heart disease of native corona... \n"", + ""3 Type 2 diabetes mellitus with hypoglycemia \n"", + ""4 Atherosclerosis of bypass graft of coronary ar... "" + ] + }, + ""execution_count"": 87, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""diagnosis_table = process_ehr(Patient_1,Patient_2)\n"", + ""diagnosis_table.head()"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## Create a hashkey for Admission ID\n"", + ""Why do this step? Unless your EHR system has uniqely identifiable Admission IDs for each patients visit, it would be difficult to associate each patient ID with a unique `Admission ID`. To demonstrate this, we deliberately created double digit `Admission ID`s one of which was repeated ( `Admission ID`: 34) for both patients. To avoid this, we took a pre-cautionary step to create a hash key that is a unique combination of the first half of the the unique `PatientID` hyphenated with the patient's specific `Admission ID`."" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 88, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/html"": [ + ""
\n"", + ""\n"", + ""\n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + ""
PatientIDAdmission IDCodingSystemPrimaryDiagnosisCodeDiagnosisCodeDescription
3A1234-B45634ICD-9E11.64Type 2 diabetes mellitus with hypoglycemia
4A1234-B45634ICD-9I25.812Atherosclerosis of bypass graft of coronary ar...
5A1234-B45634ICD-9I25.10Atherosclerotic heart disease of native corona...
6A1234-B45634ICD-9780.96Generalized Pain
7A1234-B45634ICD-9784.0Dizziness and giddiness
17B1234-C45634ICD-9M05.59Rheumatoid polyneuropathy with rheumatoid arth...
18B1234-C45634ICD-9Z13.85Encounter for screening for nervous system dis...
19B1234-C45634ICD-9O99.35Diseases of the nervous system complicating pr...
20B1234-C45634ICD-9D37.0Neoplasm of uncertain behavior of lip, oral ca...
\n"", + ""
"" + ], + ""text/plain"": [ + "" PatientID Admission ID CodingSystem PrimaryDiagnosisCode \\\n"", + ""3 A1234-B456 34 ICD-9 E11.64 \n"", + ""4 A1234-B456 34 ICD-9 I25.812 \n"", + ""5 A1234-B456 34 ICD-9 I25.10 \n"", + ""6 A1234-B456 34 ICD-9 780.96 \n"", + ""7 A1234-B456 34 ICD-9 784.0 \n"", + ""17 B1234-C456 34 ICD-9 M05.59 \n"", + ""18 B1234-C456 34 ICD-9 Z13.85 \n"", + ""19 B1234-C456 34 ICD-9 O99.35 \n"", + ""20 B1234-C456 34 ICD-9 D37.0 \n"", + ""\n"", + "" DiagnosisCodeDescription \n"", + ""3 Type 2 diabetes mellitus with hypoglycemia \n"", + ""4 Atherosclerosis of bypass graft of coronary ar... \n"", + ""5 Atherosclerotic heart disease of native corona... \n"", + ""6 Generalized Pain \n"", + ""7 Dizziness and giddiness \n"", + ""17 Rheumatoid polyneuropathy with rheumatoid arth... \n"", + ""18 Encounter for screening for nervous system dis... \n"", + ""19 Diseases of the nervous system complicating pr... \n"", + ""20 Neoplasm of uncertain behavior of lip, oral ca... "" + ] + }, + ""execution_count"": 88, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""diagnosis_table[diagnosis_table['Admission ID']==34]"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 89, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""['HashKey', 'PatientID', 'Admission ID', 'CodingSystem', 'PrimaryDiagnosisCode', 'DiagnosisCodeDescription']\n"", + ""['HashKey', 'PatientID', 'Admission ID', 'AdmissionStartDate', 'AdmissionEndDate']\n"" + ] + } + ], + ""source"": [ + ""# Diag\n"", + ""diagnosis_table = hash_key(diagnosis_table)\n"", + ""admission_table = hash_key(admission_table)"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## Final Admission and Diagnosis Tables generated with fake EHR data"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 90, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/html"": [ + ""
\n"", + ""\n"", + ""\n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + ""
HashKeyPatientIDAdmission IDAdmissionStartDateAdmissionEndDate
0A1234-12A1234-B456122019-01-03 9:34:552019-01-07 8:45:43
1A1234-34A1234-B456342019-02-03 10:50:552019-03-04 1:50:32
2A1234-15A1234-B456152019-04-03 12:34:552019-04-03 5:38:18
3B1234-13B1234-C456132018-01-03 9:34:552018-01-07 8:45:43
4B1234-34B1234-C456342018-02-03 10:50:552018-03-04 1:50:32
\n"", + ""
"" + ], + ""text/plain"": [ + "" HashKey PatientID Admission ID AdmissionStartDate AdmissionEndDate\n"", + ""0 A1234-12 A1234-B456 12 2019-01-03 9:34:55 2019-01-07 8:45:43\n"", + ""1 A1234-34 A1234-B456 34 2019-02-03 10:50:55 2019-03-04 1:50:32\n"", + ""2 A1234-15 A1234-B456 15 2019-04-03 12:34:55 2019-04-03 5:38:18\n"", + ""3 B1234-13 B1234-C456 13 2018-01-03 9:34:55 2018-01-07 8:45:43\n"", + ""4 B1234-34 B1234-C456 34 2018-02-03 10:50:55 2018-03-04 1:50:32"" + ] + }, + ""execution_count"": 90, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""admission_table.head()"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Cast Admission dates to Date time object "" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 91, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""\n"", + ""RangeIndex: 5 entries, 0 to 4\n"", + ""Data columns (total 5 columns):\n"", + ""HashKey 5 non-null object\n"", + ""PatientID 5 non-null object\n"", + ""Admission ID 5 non-null int64\n"", + ""AdmissionStartDate 5 non-null datetime64[ns]\n"", + ""AdmissionEndDate 5 non-null datetime64[ns]\n"", + ""dtypes: datetime64[ns](2), int64(1), object(2)\n"", + ""memory usage: 280.0+ bytes\n"" + ] + } + ], + ""source"": [ + ""admission_table[['AdmissionStartDate','AdmissionEndDate']] = admission_table[['AdmissionStartDate','AdmissionEndDate']]\\\n"", + "" .apply(lambda x: pd.to_datetime(x, format='%Y-%m-%d'))\n"", + ""admission_table.info()"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 93, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/html"": [ + ""
\n"", + ""\n"", + ""\n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + ""
HashKeyPatientIDAdmission IDCodingSystemPrimaryDiagnosisCodeDiagnosisCodeDescription
0A1234-12A1234-B45612ICD-9E11.64Type 2 diabetes mellitus with hypoglycemia
1A1234-12A1234-B45612ICD-9I25.812Atherosclerosis of bypass graft of coronary ar...
2A1234-12A1234-B45612ICD-9I25.10Atherosclerotic heart disease of native corona...
3A1234-34A1234-B45634ICD-9E11.64Type 2 diabetes mellitus with hypoglycemia
4A1234-34A1234-B45634ICD-9I25.812Atherosclerosis of bypass graft of coronary ar...
\n"", + ""
"" + ], + ""text/plain"": [ + "" HashKey PatientID Admission ID CodingSystem PrimaryDiagnosisCode \\\n"", + ""0 A1234-12 A1234-B456 12 ICD-9 E11.64 \n"", + ""1 A1234-12 A1234-B456 12 ICD-9 I25.812 \n"", + ""2 A1234-12 A1234-B456 12 ICD-9 I25.10 \n"", + ""3 A1234-34 A1234-B456 34 ICD-9 E11.64 \n"", + ""4 A1234-34 A1234-B456 34 ICD-9 I25.812 \n"", + ""\n"", + "" DiagnosisCodeDescription \n"", + ""0 Type 2 diabetes mellitus with hypoglycemia \n"", + ""1 Atherosclerosis of bypass graft of coronary ar... \n"", + ""2 Atherosclerotic heart disease of native corona... \n"", + ""3 Type 2 diabetes mellitus with hypoglycemia \n"", + ""4 Atherosclerosis of bypass graft of coronary ar... "" + ] + }, + ""execution_count"": 93, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""diagnosis_table.head()"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Write tables to csv"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 94, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stderr"", + ""output_type"": ""stream"", + ""text"": [ + ""mkdir: data: File exists\n"" + ] + } + ], + ""source"": [ + ""%%bash\n"", + ""mkdir data "" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 95, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""# Write files to data directory\n"", + ""diagnosis_table.to_csv('data/Diagnosis_Table.csv',encoding='UTF-8',index=False)\n"", + ""admission_table.to_csv('data/Admissions_Table.csv',encoding='UTF-8',index=False,date_format='%Y-%m-%d')"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## Next:\n"", + ""We will process the data in preparation for modeling"" + ] + } + ], + ""metadata"": { + ""kernelspec"": { + ""display_name"": ""Python 3"", + ""language"": ""python"", + ""name"": ""python3"" + }, + ""language_info"": { + ""codemirror_mode"": { + ""name"": ""ipython"", + ""version"": 3 + }, + ""file_extension"": "".py"", + ""mimetype"": ""text/x-python"", + ""name"": ""python"", + ""nbconvert_exporter"": ""python"", + ""pygments_lexer"": ""ipython3"", + ""version"": ""3.7.0"" + } + }, + ""nbformat"": 4, + ""nbformat_minor"": 2 +} +","Unknown" +"RNN","sparalic/Electronic-Health-Records-GRUs","DrAI_pytorch.ipynb",".ipynb","17230","454","{ + ""cells"": [ + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""# Doctor AI Pytorch Minimial Implementation in Pytorch:\n"", + ""by: Sparkle Russell-Puleri and Dorian Puleri\n"", + ""\n"", + ""We will now apply the knowledge gained from the GRUs tutorial and part 1 of this series to a larger publicly available EHR dataset.This study will utilize the MIMIC III electronic health record (EHR) dataset, which is comprised of over 58,000 hospital admissions for 38,645 adults and 7 ,875 neonates. This dataset is a collection of de-identified intensive care unit stays at the Beth Israel Deaconess Medical Center from June 2001- October 2012. Despite being de-identified, this EHR dataset contains information about the patients’ demographics, vital sign measurements made at the bedside (~1/hr), laboratory test results, billing codes, medications, caregiver notes, imaging reports, and mortality (during and after hospitalization). Using the pre-processing methods demonstrated on artificially generated dataset in (Part 1 & Part 2) we will create a companion cohort for use in this study."" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## Model Architecture"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + """" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 3, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""application/javascript"": [ + ""IPython.notebook.set_autosave_interval(120000)"" + ] + }, + ""metadata"": {}, + ""output_type"": ""display_data"" + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Autosaving every 120 seconds\n"" + ] + } + ], + ""source"": [ + ""import torch\n"", + ""import torch.nn as nn\n"", + ""from torch.autograd import Variable\n"", + ""from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence\n"", + ""import torch.nn.functional as F\n"", + ""import numpy as np\n"", + ""import itertools\n"", + ""import pickle\n"", + ""import sys, random\n"", + ""np.random.seed(0)\n"", + ""torch.manual_seed(0)\n"", + ""%autosave 120"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## Checking for GPU availability\n"", + ""This model was trained on a GPU enabled system...highly recommended."" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 4, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Training on CPU!\n"" + ] + } + ], + ""source"": [ + ""# check if GPU is available\n"", + ""if(torch.cuda.is_available()):\n"", + "" print('Training on GPU!')\n"", + ""else: \n"", + "" print('Training on CPU!')\n"", + "" \n"", + ""device = torch.device(\""cuda:0\"" if torch.cuda.is_available() else \""cpu\"")"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Load data\n"", + ""The data pre-processed datasets will be loaded and split into a train, test and validation set at a `75%:15%:10%` ratio."" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 10, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""def load_data(sequences, labels):\n"", + "" dataSize = len(labels)\n"", + "" idx = np.random.permutation(dataSize)\n"", + "" nTest = int(np.ceil(0.15 * dataSize))\n"", + "" nValid = int(np.ceil(0.10 * dataSize))\n"", + ""\n"", + "" test_idx = idx[:nTest]\n"", + "" valid_idx = idx[nTest:nTest+nValid]\n"", + "" train_idx = idx[nTest+nValid:]\n"", + ""\n"", + "" train_x = sequences[train_idx]\n"", + "" train_y = labels[train_idx]\n"", + "" test_x = sequences[test_idx]\n"", + "" test_y = labels[test_idx]\n"", + "" valid_x = sequences[valid_idx]\n"", + "" valid_y = labels[valid_idx]\n"", + ""\n"", + "" train_x = [sorted(seq) for seq in train_x]\n"", + "" train_y = [sorted(seq) for seq in train_y]\n"", + "" valid_x = [sorted(seq) for seq in valid_x]\n"", + "" valid_y = [sorted(seq) for seq in valid_y]\n"", + "" test_x = [sorted(seq) for seq in test_x]\n"", + "" test_y = [sorted(seq) for seq in test_y]\n"", + ""\n"", + "" train = (train_x, train_y)\n"", + "" test = (test_x, test_y)\n"", + "" valid = (valid_x, valid_y)\n"", + "" return (train, test, valid)"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## Padding the inputs:\n"", + ""The input tensors were padded with zeros, note that the inputs are padded to allow the RNN to handle the variable length inputs. A mask was then created to provide the algorithm information about the padding. Note this can be done using Pytorch's utility `pad_pack_sequence` function. However, given the nested nature of this dataset, the encoded inputs were first multi-one hot encoded. This off-course creates a high-dimenisonal sparse inputs, however the dimensionallity was then projected into a lower-dimensional space using an embedding layer."" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 11, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""def padding(seqs, labels, vocab, n_classes):\n"", + "" lengths = np.array([len(seq) for seq in seqs]) - 1 # remove the last list in each patient's sequences for labels\n"", + "" n_samples = len(lengths)\n"", + "" maxlen = np.max(lengths)\n"", + ""\n"", + "" x = torch.zeros(maxlen, n_samples, vocab) # maxlen = number of visits, n_samples = samples\n"", + "" y = torch.zeros(maxlen, n_samples, n_classes)\n"", + "" mask = torch.zeros(maxlen, n_samples)\n"", + "" for idx, (seq,label) in enumerate(zip(seqs,labels)):\n"", + "" for xvec, subseq in zip(x[:,idx,:], seq[:-1]):\n"", + "" xvec[subseq] = 1.\n"", + "" for yvec, subseq in zip(y[:,idx,:], label[1:]):\n"", + "" yvec[subseq] = 1.\n"", + "" mask[:lengths[idx], idx] = 1.\n"", + "" \n"", + "" return x, y, lengths, mask"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## GRU Class:\n"", + ""This class contains randomly initiated weights needed to begin calculating the hidden states of the alogrithms. Note, in this paper the author used embedding matrix ($W_{emb}$) generated using the skip-gram algorithm, which outperformed the randomly initialized approached shown in this step."" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 12, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""torch.manual_seed(1)\n"", + ""class EHRNN(nn.Module):\n"", + "" def __init__(self, inputDimSize, hiddenDimSize,embSize, batchSize, numClass):\n"", + "" super(EHRNN, self).__init__()\n"", + ""\n"", + "" self.hiddenDimSize = hiddenDimSize\n"", + "" self.inputDimSize = inputDimSize\n"", + "" self.embSize = embSize\n"", + "" self.numClass = numClass\n"", + "" self.batchSize = batchSize\n"", + ""\n"", + "" #Initialize random weights\n"", + "" self.W_z = nn.Parameter(torch.randn(self.embSize, self.hiddenDimSize).cuda())\n"", + "" self.W_r = nn.Parameter(torch.randn(self.embSize, self.hiddenDimSize).cuda())\n"", + "" self.W_h = nn.Parameter(torch.randn(self.embSize, self.hiddenDimSize).cuda())\n"", + ""\n"", + "" self.U_z = nn.Parameter(torch.randn(self.hiddenDimSize, self.hiddenDimSize).cuda())\n"", + "" self.U_r = nn.Parameter(torch.randn(self.hiddenDimSize, self.hiddenDimSize).cuda())\n"", + "" self.U_h = nn.Parameter(torch.randn(self.hiddenDimSize, self.hiddenDimSize).cuda())\n"", + ""\n"", + "" self.b_z = nn.Parameter(torch.zeros(self.hiddenDimSize).cuda())\n"", + "" self.b_r = nn.Parameter(torch.zeros(self.hiddenDimSize).cuda())\n"", + "" self.b_h = nn.Parameter(torch.zeros(self.hiddenDimSize).cuda())\n"", + ""\n"", + "" \n"", + "" self.params = [self.W_z, self.W_r, self.W_h, \n"", + "" self.U_z, self.U_r, self.U_h,\n"", + "" self.b_z, self.b_r, self.b_h]\n"", + ""\n"", + "" \n"", + "" def forward(self,emb,h):\n"", + "" z = torch.sigmoid(torch.matmul(emb, self.W_z) + torch.matmul(h, self.U_z) + self.b_z)\n"", + "" r = torch.sigmoid(torch.matmul(emb, self.W_r) + torch.matmul(h, self.U_r) + self.b_r)\n"", + "" h_tilde = torch.tanh(torch.matmul(emb, self.W_h) + torch.matmul(r * h, self.U_h) + self.b_h)\n"", + "" h = z * h + ((1. - z) * h_tilde)\n"", + "" return h\n"", + "" \n"", + "" \n"", + "" def init_hidden(self):\n"", + "" return Variable(torch.zeros(self.batchSize,self.hiddenDimSize))"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## Custom Layer for handling two layer GRU\n"", + ""The purpose of this class, is to perform the intially embedding followed by caluculating the hidden states and performing dropout between the layers."" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 17, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""torch.manual_seed(1)\n"", + ""class build_EHRNN(nn.Module):\n"", + "" def __init__(self, inputDimSize=4894, hiddenDimSize=[200,200], batchSize=100, embSize=200,numClass=4894, dropout=0.5,logEps=1e-8):\n"", + "" super(build_EHRNN, self).__init__()\n"", + "" \n"", + "" self.inputDimSize = inputDimSize\n"", + "" self.hiddenDimSize = hiddenDimSize\n"", + "" self.numClass = numClass\n"", + "" self.embSize = embSize\n"", + "" self.batchSize = batchSize\n"", + "" self.dropout = nn.Dropout(p=0.5)\n"", + "" self.logEps = logEps\n"", + "" \n"", + "" \n"", + "" # Embedding inputs\n"", + "" self.W_emb = nn.Parameter(torch.randn(self.inputDimSize, self.embSize).cuda())\n"", + "" self.b_emb = nn.Parameter(torch.zeros(self.embSize).cuda())\n"", + "" \n"", + "" self.W_out = nn.Parameter(torch.randn(self.hiddenDimSize, self.numClass).cuda())\n"", + "" self.b_out = nn.Parameter(torch.zeros(self.numClass).cuda())\n"", + "" \n"", + "" self.params = [self.W_emb, self.W_out, \n"", + "" self.b_emb, self.b_out] \n"", + "" \n"", + "" def forward(self,x, y, h, lengths, mask):\n"", + "" self.emb = torch.tanh(torch.matmul(x, self.W_emb) + self.b_emb)\n"", + "" input_values = self.emb\n"", + "" self.outputs = [input_values]\n"", + "" for i, hiddenSize in enumerate([self.hiddenDimSize, self.hiddenDimSize]): # iterate over layers\n"", + "" rnn = EHRNN(self.inputDimSize,hiddenSize,self.embSize,self.batchSize,self.numClass) # calculate hidden states\n"", + "" hidden_state = []\n"", + "" h = self.init_hidden().cuda()\n"", + "" for i,seq in enumerate(input_values): # loop over sequences in each batch\n"", + "" h = rnn(seq, h) \n"", + "" hidden_state.append(h) \n"", + "" hidden_state = self.dropout(torch.stack(hidden_state)) # apply dropout between layers\n"", + "" input_values = hidden_state\n"", + "" \n"", + "" y_linear = torch.matmul(hidden_state, self.W_out) + self.b_out # fully connected layer\n"", + "" yhat = F.softmax(y_linear, dim=1) # yhat\n"", + "" yhat = yhat*mask[:,:,None] # apply mask\n"", + "" \n"", + "" # Loss calculation\n"", + "" cross_entropy = -(y * torch.log(yhat + self.logEps) + (1. - y) * torch.log(1. - yhat + self.logEps))\n"", + "" last_step = -torch.mean(y[-1] * torch.log(yhat[-1] + self.logEps) + (1. - y[-1]) * torch.log(1. - yhat[-1] + self.logEps))\n"", + "" prediction_loss = torch.sum(torch.sum(cross_entropy, dim=0),dim=1)/ torch.cuda.FloatTensor(lengths)\n"", + "" cost = torch.mean(prediction_loss) + 0.000001 * (self.W_out ** 2).sum() # regularize\n"", + "" return (yhat, hidden_state, cost)\n"", + ""\n"", + "" def init_hidden(self):\n"", + "" return torch.zeros(self.batchSize, self.hiddenDimSize) # initial state"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## Instantiate Model\n"", + ""Instantiate model and provided parameters and be sure to send it to a GPU enabled device to speed up matrix computations."" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 19, + ""metadata"": { + ""scrolled"": false + }, + ""outputs"": [], + ""source"": [ + ""model = build_EHRNN(4894, 200, 100, 200, 4894,0.5,1e-8)\n"", + ""model = model.to(device)"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""## Load Data"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 8, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""print(\""Loading Data\"")\n"", + ""train, test, valid = load_data(sequences, labels)"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Batch Size\n"", + ""Keep only enough samples to make the specified bactch size."" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 16, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""batchSize = 100\n"", + ""n_batches = int(np.ceil(float(len(train[0])) / float(batchSize)))-1\n"", + ""n_batches_valid = int(np.ceil(float(len(valid[0])) / float(batchSize)))-1"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Train model\n"", + ""This model is a minimal implementation fo the Dr.AI algorithm created by Edward Choi, while functional it requires significant tuning. This will be demonstrated in a subsequent tutorial."" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 1, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""optimizer = torch.optim.Adadelta(model.parameters(), lr = 0.01, rho=0.90)\n"", + ""max_epochs = 10\n"", + ""\n"", + ""loss_all = []\n"", + ""iteration = 0\n"", + "" \n"", + ""for e in range(max_epochs):\n"", + "" for index in random.sample(range(n_batches), n_batches):\n"", + "" batchX = train[0][:n_batches*batchSize][index*batchSize:(index+1)*batchSize]\n"", + "" batchY = train[1][:n_batches*batchSize][index*batchSize:(index+1)*batchSize]\n"", + "" \n"", + "" optimizer.zero_grad()\n"", + "" \n"", + "" x, y, lengths, mask = padding(batchX, batchY, 4894, 4894)\n"", + "" \n"", + "" if torch.cuda.is_available():\n"", + "" x, y, lenghts, mask = x.cuda(), y.cuda(), lengths, mask.cuda()\n"", + "" \n"", + "" outputs, hidden, cost = model(x,y, h, lengths, mask)\n"", + "" \n"", + "" if torch.cuda.is_available():\n"", + "" cost.cuda()\n"", + "" cost.backward()\n"", + "" nn.utils.clip_grad_norm_(model.parameters(), 5)\n"", + "" optimizer.step()\n"", + "" \n"", + "" loss_all.append(cost.item())\n"", + "" iteration +=1\n"", + "" if iteration % 10 == 0:\n"", + "" # Calculate Accuracy \n"", + "" losses = []\n"", + "" model.eval()\n"", + "" for index in random.sample(range(n_batches_valid), n_batches_valid):\n"", + "" validX = valid[0][:n_batches_valid*batchSize][index*batchSize:(index+1)*batchSize]\n"", + "" validY = valid[1][:n_batches_valid*batchSize][index*batchSize:(index+1)*batchSize]\n"", + ""\n"", + "" x, y, lengths, mask = padding(validX, validY, 4894, 4894)\n"", + ""\n"", + "" if torch.cuda.is_available():\n"", + "" x, y, lenghts, mask = x.cuda(), y.cuda(), lenghts, mask.cuda()\n"", + ""\n"", + "" outputs, hidden_val, cost_val = model(x,y, h, lengths, mask)\n"", + "" losses.append(cost_val)\n"", + "" model.train()\n"", + ""\n"", + "" print(\""Epoch: {}/{}...\"".format(e+1, max_epochs),\n"", + "" \""Step: {}...\"".format(iteration),\n"", + "" \""Training Loss: {:.4f}...\"".format(np.mean(loss_all)),\n"", + "" \""Val Loss: {:.4f}\"".format(torch.mean(torch.tensor(losses))))"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Final Notes/ Next Steps:\n"", + ""This should serve as starter code to get the model up and running. As noted before, a significant amount of tuning will be required as this was built using custom classes. We will walkthrough the proces in a future tutorial."" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### References:\n"", + ""1. Doctor AI: Predicting Clinical Events via Recurrent Neural Networks (https://arxiv.org/abs/1511.05942)"" + ] + } + ], + ""metadata"": { + ""kernelspec"": { + ""display_name"": ""Python 3"", + ""language"": ""python"", + ""name"": ""python3"" + }, + ""language_info"": { + ""codemirror_mode"": { + ""name"": ""ipython"", + ""version"": 3 + }, + ""file_extension"": "".py"", + ""mimetype"": ""text/x-python"", + ""name"": ""python"", + ""nbconvert_exporter"": ""python"", + ""pygments_lexer"": ""ipython3"", + ""version"": ""3.7.0"" + } + }, + ""nbformat"": 4, + ""nbformat_minor"": 2 +} +","Unknown" +"RNN","figotj/Copolymer","train_dataset3.py",".py","14019","319","import pandas as pd +import numpy as np +import pickle +from rdkit import Chem +from rdkit.Chem import AllChem +from rdkit.Chem import Descriptors +from rdkit.Chem import rdMolDescriptors +from rdkit.Chem.Draw import IPythonConsole +from rdkit.Chem import Draw +from rdkit.Chem.Draw import rdMolDraw2D +import kerastuner as kt +from kerastuner.tuners import RandomSearch +from kerastuner.engine.hyperparameters import HyperParameters +from tensorflow.keras.models import Sequential, save_model, load_model +from tensorflow.keras.optimizers import Adam +from tensorflow import keras +from tensorflow.keras.layers import Conv2D, MaxPooling2D, Conv1D, MaxPooling1D, Dense, Flatten, Activation, ZeroPadding2D +from tensorflow.keras.layers import LSTM, Embedding, Bidirectional, TimeDistributed, Reshape, Dropout +from tensorflow.keras.preprocessing.text import one_hot +from tensorflow.keras.preprocessing.sequence import pad_sequences +import time +from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error +from sklearn.metrics import mean_absolute_error, r2_score +from sklearn.model_selection import train_test_split +import random +from numpy.random import seed +import tensorflow +from keras.layers import Input, Dense +from keras.models import Model +from keras.layers.merge import Concatenate +import argparse + +def train(args): + + #read in the reference data + DF = pickle.load(open(""datasets/Copolymer_Dataset_3.pickle"",""rb"")) + + #fingperints featurization + fp_1 = DF['SMILES_1_mol'].dropna().apply(lambda m: AllChem.GetMorganFingerprint(m, radius=3)) + fp_1_n = fp_1.apply(lambda m: m.GetNonzeroElements()) + + fp_2 = DF['SMILES_2_mol'].dropna().apply(lambda m: AllChem.GetMorganFingerprint(m, radius=3)) + fp_2_n = fp_2.apply(lambda m: m.GetNonzeroElements()) + + #Recognize all n substructures found in the datasets + + HashCode = [] + for i in fp_1_n: + for j in i.keys(): + HashCode.append(j) + + for i in fp_2_n: + for j in i.keys(): + HashCode.append(j) + + unique_set = set(HashCode) + unique_list = list(unique_set) + + Corr_df = pd.DataFrame(unique_list).reset_index() + + #Construct feature matrix + MY_finger = [] + for polymer in fp_1_n: + my_finger = [0] * len(unique_list) + for key in polymer.keys(): + index = Corr_df[Corr_df[0] == key]['index'].values[0] + my_finger[index] = polymer[key] + MY_finger.append(my_finger) + + for polymer in fp_2_n: + my_finger = [0] * len(unique_list) + for key in polymer.keys(): + index = Corr_df[Corr_df[0] == key]['index'].values[0] + my_finger[index] = polymer[key] + MY_finger.append(my_finger) + + MY_finger_dataset = pd.DataFrame(MY_finger) + + Zero_Sum = (MY_finger_dataset == 0).astype(int).sum() + NumberOfZero = 12800 + X_1 = MY_finger_dataset[Zero_Sum[Zero_Sum < NumberOfZero].index].iloc[:131] + X_2 = MY_finger_dataset[Zero_Sum[Zero_Sum < NumberOfZero].index].iloc[131:] + + # CNN model + if args.model == 'CNN': + # input for CNN + DF['Ratio_1'] = [int(x) for x in DF['Mon. ratio']] + DF['Ratio_2'] = [100 - int(x) for x in DF['Mon. ratio']] + + Mix_X_100Block = [] + for i in range(len(DF)): + if DF['Random/\nBlock'].iloc[i] == 'B': + Sequency_X = [] + for j in range(int(DF['Ratio_1'].iloc[i])): + Sequency_X.append((X_1.iloc[i].values)) + for j in range(int(DF['Ratio_2'].iloc[i])): + Sequency_X.append((X_2.iloc[i].values)) + else: + random.seed(10) + X1_random_position = random.sample(range(0, 100), int(DF['Ratio_1'].iloc[i])) + Sequency_X = [0 for a in range(100)] + for j in range(100): + if j in X1_random_position: + Sequency_X[j] = list(X_1.iloc[i].values) + else: + Sequency_X[j] = list(X_2.iloc[i].values) + Mix_X_100Block.append(Sequency_X) + + Mix_X_100Block = np.array(Mix_X_100Block) + Mix_X_100Block = Mix_X_100Block.reshape((131, 100, 125, 1)) + + # data split into train/test sets + X_train, X_test, y_train, y_test = train_test_split(Mix_X_100Block, DF['Tg_avg'], test_size=0.2, random_state=42) + + # model setup using the optimized architecture + model = Sequential() + model.add(Conv2D(8, (10, 10), activation='relu', input_shape=(100, 125, 1))) + model.add(Conv2D(8, (4, 4), activation='relu')) + model.add(Conv2D(8, (3, 3), activation='relu')) + model.add(MaxPooling2D(pool_size=(2, 2))) + model.add(Dropout(0.3)) + model.add(Flatten()) + model.add(Dense(1)) + optimizer=keras.optimizers.Adam(lr=0.005) + model.compile(optimizer=optimizer, loss='mean_absolute_error') + model.fit(x=X_train,y=y_train,epochs=200, + batch_size=64, + validation_split=0.2) + + filepath = 'PK_CNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + y_pred_train = model.predict(X_train) + y_pred_test = model.predict(X_test) + print(""model performance"") + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + + # Fusion model + if args.model == 'Fusion': + # input for Fusion + Mix_X = [] + for i in range(len(DF)): + Mix_X.append(X_1.iloc[i].values * DF['Ratio_1'].iloc[i] + \ + X_2.iloc[i].values * DF['Ratio_2'].iloc[i]) + Mix_X = np.array(Mix_X) + + Mix_X_100Block = [] + for i in range(len(DF)): + if DF['Random/\nBlock'].iloc[i] == 'B': + Sequency_X = [] + for j in range(int(DF['Ratio_1'].iloc[i])): + Sequency_X.append(1) + for j in range(int(DF['Ratio_2'].iloc[i])): + Sequency_X.append(0) + else: + random.seed(10) + X1_random_position = random.sample(range(0, 100), int(DF['Ratio_1'].iloc[i])) + Sequency_X = [0 for a in range(100)] + for j in range(100): + if j in X1_random_position: + Sequency_X[j] = 1 + else: + Sequency_X[j] = 0 + Mix_X_100Block.append(Sequency_X) + + Mix_X_100Block = np.array(Mix_X_100Block) + Mix_X_100Block = Mix_X_100Block.reshape((131, 100, 1)) + + LSTMunits = 20 # hyperprameter for LSTM + # define two sets of inputs + inputA = Input(shape=(100,1)) + inputB = Input(shape=(125)) + + # model setup using the optimized architecture + # the first branch operates on the first input + RNNmodel = Sequential() + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True), input_shape=(100,1))) + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True))) + RNNmodel.add(TimeDistributed(Dense(int(LSTMunits/2), activation=""relu""))) + RNNmodel.add(Reshape((int(LSTMunits/2*100),))) + + # the second branch opreates on the second input + y = Dense(8, activation=""relu"")(inputB) + y = Dense(8, activation=""relu"")(y) + y = Model(inputs=inputB, outputs=y) + + # fuse two branches + combined = Concatenate()([RNNmodel.output, y.output]) + z = Dense(8, activation=""relu"")(combined) + z = Dense(1, activation=""linear"")(z) + model = Model(inputs=[RNNmodel.input, y.input], outputs=z) + + # data split into train/test sets + xtrain_A, xtest_A, ytrain_A, ytest_A=train_test_split(Mix_X_100Block, DF['Tg_avg'], test_size=0.20, random_state=200) + xtrain_B, xtest_B, ytrain_B, ytest_B=train_test_split(Mix_X, DF['Tg_avg'], test_size=0.20, random_state=200) + + optimizer=keras.optimizers.Adam(lr=0.001) + model.compile(optimizer=optimizer, loss='mean_absolute_error') + model.fit(x=[xtrain_A, xtrain_B], y=ytrain_B,epochs=500, + batch_size=32, + validation_split=0.2) + + filepath = 'PK_Fusion.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance"") + ytrain = ytrain_B + ytest = ytest_B + y_pred_train = model.predict([xtrain_A, xtrain_B]) + print(""Train set R^2: "", r2_score(ytrain, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(ytrain, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(ytrain, y_pred_train))) + y_pred_test = model.predict([xtest_A, xtest_B]) + print(""Test set R^2: "", r2_score(ytest, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(ytest, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(ytest, y_pred_test))) + + + # FFNN model + if args.model == 'FFNN': + + # data split into train/test sets + x_train, x_test, y_train, y_test = train_test_split(Mix_X, DF['Tg_avg'], test_size=0.2, random_state=11) + # model setup using the optimized architecture + model = keras.models.Sequential() + model.add(Dense(units = 24, input_dim = x_train.shape[1],activation='relu')) + model.add(Dense(units = 64, activation='relu')) + model.add(Dense(units = 1)) + model.compile(optimizer=keras.optimizers.Adam(learning_rate=0.001), + loss=""mean_squared_error"") + model.fit(x_train, y_train, epochs = 1000, batch_size = 128, + validation_split=0.2) + + filepath = 'PK_FFNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance"") + y_pred_train = model.predict((x_train)) + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + y_pred_test = model.predict((x_test)) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + + # RNN model + if args.model == 'RNN': + # input for RNN + Mix_X_100Block = [] + for i in range(len(DF)): + if DF['Random/\nBlock'].iloc[i] == 'B': + Sequency_X = [] + for j in range(int(DF['Ratio_1'].iloc[i])): + Sequency_X.append((X_1.iloc[i].values)) + for j in range(int(DF['Ratio_2'].iloc[i])): + Sequency_X.append((X_2.iloc[i].values)) + else: + random.seed(10) + X1_random_position = random.sample(range(0, 100), int(DF['Ratio_1'].iloc[i])) + Sequency_X = [0 for a in range(100)] + for j in range(100): + if j in X1_random_position: + Sequency_X[j] = list(X_1.iloc[i].values) + else: + Sequency_X[j] = list(X_2.iloc[i].values) + Mix_X_100Block.append(Sequency_X) + + Mix_X_100Block = np.array(Mix_X_100Block) + + # data split into train/test sets + X_train, X_test, y_train, y_test = train_test_split(Mix_X_100Block, DF['Tg_avg'], test_size=0.2, random_state=11) + + # model setup using the optimized architecture + LSTMunits = 20 # hyperprameter for LSTM + RNNmodel = Sequential() + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True), input_shape=(100,125))) + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True))) + RNNmodel.add(TimeDistributed(Dense(int(LSTMunits/2), activation=""relu""))) + RNNmodel.add(Reshape((int(LSTMunits/2*100),))) + RNNmodel.add(Dense(1)) + + RNNmodel.compile(loss='mse', optimizer='adam') + RNNmodel.fit(X_train, y_train, validation_split=0.2, epochs=200, batch_size=64) + + filepath = 'PK_RNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance"") + y_pred_train = RNNmodel.predict((X_train)) + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + y_pred_test = RNNmodel.predict((X_test)) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser() + parser.add_argument('--model', type=str, required = True, + help='Choose either ""CNN"", ""DNN"", ""RNN"", or ""Fusion"" for model architecture') + + parsed_args = parser.parse_args() + + train(parsed_args)","Python" +"RNN","figotj/Copolymer","train_dataset4.py",".py","14156","322","import pandas as pd +import numpy as np +import pickle +from rdkit import Chem +from rdkit.Chem import AllChem +from rdkit.Chem import Descriptors +from rdkit.Chem import rdMolDescriptors +from rdkit.Chem.Draw import IPythonConsole +from rdkit.Chem import Draw +from rdkit.Chem.Draw import rdMolDraw2D +import kerastuner as kt +from kerastuner.tuners import RandomSearch +from kerastuner.engine.hyperparameters import HyperParameters +from tensorflow.keras.models import Sequential, save_model, load_model +from tensorflow.keras.optimizers import Adam +from tensorflow import keras +from tensorflow.keras.layers import Conv2D, MaxPooling2D, Conv1D, MaxPooling1D, Dense, Flatten, Activation, ZeroPadding2D +from tensorflow.keras.layers import LSTM, Embedding, Bidirectional, TimeDistributed, Reshape, Dropout +from tensorflow.keras.preprocessing.text import one_hot +from tensorflow.keras.preprocessing.sequence import pad_sequences +import time +from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error +from sklearn.metrics import mean_absolute_error, r2_score +from sklearn.model_selection import train_test_split +import random +from numpy.random import seed +import tensorflow +from keras.layers import Input, Dense +from keras.models import Model +from keras.layers.merge import Concatenate +import argparse + +def train(args): + + #read in the reference data + DF = pickle.load(open(""Need query data from PolyInfo"",""rb"")) + + #fingperints featurization + fp_1 = DF['SMILES_1_mol'].dropna().apply(lambda m: AllChem.GetMorganFingerprint(m, radius=3)) + fp_1_n = fp_1.apply(lambda m: m.GetNonzeroElements()) + + fp_2 = DF['SMILES_2_mol'].dropna().apply(lambda m: AllChem.GetMorganFingerprint(m, radius=3)) + fp_2_n = fp_2.apply(lambda m: m.GetNonzeroElements()) + + #Recognize all n substructures found in the datasets + + HashCode = [] + for i in fp_1_n: + for j in i.keys(): + HashCode.append(j) + + for i in fp_2_n: + for j in i.keys(): + HashCode.append(j) + + unique_set = set(HashCode) + unique_list = list(unique_set) + + Corr_df = pd.DataFrame(unique_list).reset_index() + + #Construct feature matrix + MY_finger = [] + for polymer in fp_1_n: + my_finger = [0] * len(unique_list) + for key in polymer.keys(): + index = Corr_df[Corr_df[0] == key]['index'].values[0] + my_finger[index] = polymer[key] + MY_finger.append(my_finger) + + for polymer in fp_2_n: + my_finger = [0] * len(unique_list) + for key in polymer.keys(): + index = Corr_df[Corr_df[0] == key]['index'].values[0] + my_finger[index] = polymer[key] + MY_finger.append(my_finger) + + MY_finger_dataset = pd.DataFrame(MY_finger) + + Zero_Sum = (MY_finger_dataset == 0).astype(int).sum() + NumberOfZero = 12800 + X_1 = MY_finger_dataset[Zero_Sum[Zero_Sum < NumberOfZero].index].iloc[:131] + X_2 = MY_finger_dataset[Zero_Sum[Zero_Sum < NumberOfZero].index].iloc[131:] + + # CNN model + if args.model == 'CNN': + # input for CNN + Mix_X_100Block = [] + for i in range(len(DF)): + if DF['Random/\nBlock'].iloc[i] == 'B': + Sequency_X = [] + for j in range(int(DF['Ratio_1'].iloc[i])): + Sequency_X.append((X_1.iloc[i].values)) + for j in range(int(DF['Ratio_2'].iloc[i])): + Sequency_X.append((X_2.iloc[i].values)) + else: + random.seed(10) + X1_random_position = random.sample(range(0, 100), int(DF['Ratio_1'].iloc[i])) + Sequency_X = [0 for a in range(100)] + for j in range(100): + if j in X1_random_position: + Sequency_X[j] = list(X_1.iloc[i].values) + else: + Sequency_X[j] = list(X_2.iloc[i].values) + Mix_X_100Block.append(Sequency_X) + + Mix_X_100Block = np.array(Mix_X_100Block) + Mix_X_100Block = Mix_X_100Block.reshape((131, 100, 125, 1)) + + # data split into train/test sets + X_train, X_test, y_train, y_test = train_test_split(Mix_X_100Block, DF['Tg_avg'], test_size=0.2, random_state=42) + + # model setup using the optimized architecture + model = Sequential() + model.add(Conv2D(8, (10, 10), activation='relu', input_shape=(100, 125, 1))) + model.add(Conv2D(8, (4, 4), activation='relu')) + model.add(Conv2D(8, (3, 3), activation='relu')) + model.add(MaxPooling2D(pool_size=(2, 2))) + model.add(Dropout(0.3)) + model.add(Flatten()) + model.add(Dense(1)) + optimizer=keras.optimizers.Adam(lr=0.005) + model.compile(optimizer=optimizer, loss='mean_absolute_error') + model.fit(x=X_train,y=y_train,epochs=200, + batch_size=64, + validation_split=0.2) + + filepath = 'PolyInfo_CNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + y_pred_train = model.predict(X_train) + y_pred_test = model.predict(X_test) + print(""model performance"") + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + # Fusion model + if args.model == 'Fusion': + # input for Fusion + Mix_X = [] + for i in range(len(DF)): + Mix_X.append(X_1.iloc[i].values * DF['Ratio_1'].iloc[i] + \ + X_2.iloc[i].values * DF['Ratio_2'].iloc[i]) + Mix_X = np.array(Mix_X) + + Mix_X_100Block = [] + for i in range(len(DF)): + if DF['Random/\nBlock'].iloc[i] == 'B': + Sequency_X = [] + for j in range(int(DF['Ratio_1'].iloc[i])): + Sequency_X.append(1) + for j in range(int(DF['Ratio_2'].iloc[i])): + Sequency_X.append(0) + else: + random.seed(10) + X1_random_position = random.sample(range(0, 100), int(DF['Ratio_1'].iloc[i])) + Sequency_X = [0 for a in range(100)] + for j in range(100): + if j in X1_random_position: + Sequency_X[j] = 1 + else: + Sequency_X[j] = 0 + Mix_X_100Block.append(Sequency_X) + + Mix_X_100Block = np.array(Mix_X_100Block) + Mix_X_100Block = Mix_X_100Block.reshape((131, 100, 1)) + + LSTMunits = 20 # hyperprameter for LSTM + # define two sets of inputs + inputA = Input(shape=(100,1)) + inputB = Input(shape=(125)) + + # model setup using the optimized architecture + # the first branch operates on the first input + RNNmodel = Sequential() + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True), input_shape=(100,1))) + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True))) + RNNmodel.add(TimeDistributed(Dense(int(LSTMunits/2), activation=""relu""))) + RNNmodel.add(Reshape((int(LSTMunits/2*100),))) + + # the second branch opreates on the second input + y = Dense(8, activation=""relu"")(inputB) + y = Dense(8, activation=""relu"")(y) + y = Model(inputs=inputB, outputs=y) + + # fuse two branches + combined = Concatenate()([RNNmodel.output, y.output]) + z = Dense(8, activation=""relu"")(combined) + z = Dense(1, activation=""linear"")(z) + model = Model(inputs=[RNNmodel.input, y.input], outputs=z) + + # data split into train/test sets + xtrain_A, xtest_A, ytrain_A, ytest_A=train_test_split(Mix_X_100Block, DF['Tg_avg'], test_size=0.20, random_state=200) + xtrain_B, xtest_B, ytrain_B, ytest_B=train_test_split(Mix_X, DF['Tg_avg'], test_size=0.20, random_state=200) + + optimizer=keras.optimizers.Adam(lr=0.001) + model.compile(optimizer=optimizer, loss='mean_absolute_error') + model.fit(x=[xtrain_A, xtrain_B], y=ytrain_B,epochs=300, + batch_size=32, + validation_split=0.2) + + filepath = 'PolyInfo_Fusion.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance"") + ytrain = ytrain_B + ytest = ytest_B + y_pred_train = model.predict([xtrain_A, xtrain_B]) + print(""Train set R^2: "", r2_score(ytrain, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(ytrain, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(ytrain, y_pred_train))) + y_pred_test = model.predict([xtest_A, xtest_B]) + print(""Test set R^2: "", r2_score(ytest, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(ytest, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(ytest, y_pred_test))) + + + # FFNN model + if args.model == 'FFNN': + + Mix_X = [] + for i in range(len(DF)): + Mix_X.append(X_1.iloc[i].values * DF['Ratio_1'].iloc[i] + \ + X_2.iloc[i].values * DF['Ratio_2'].iloc[i]) + Mix_X = np.array(Mix_X) + + # data split into train/test sets + x_train, x_test, y_train, y_test = train_test_split(Mix_X, DF['Tg_avg'], test_size=0.2, random_state=11) + # model setup using the optimized architecture + model = keras.models.Sequential() + model.add(Dense(units = 24, input_dim = x_train.shape[1],activation='relu')) + model.add(Dense(units = 64, activation='relu')) + model.add(Dense(units = 1)) + model.compile(optimizer=keras.optimizers.Adam(learning_rate=0.001), + loss=""mean_squared_error"") + model.fit(x_train, y_train, epochs = 100, batch_size = 128, + validation_split=0.2) + + filepath = 'PolyInfo_FFNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance"") + y_pred_train = model.predict((x_train)) + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + y_pred_test = model.predict((x_test)) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + + + # RNN model + if args.model == 'RNN': + # input for RNN + Mix_X_100Block = [] + for i in range(len(DF)): + if DF['Random/\nBlock'].iloc[i] == 'B': + Sequency_X = [] + for j in range(int(DF['Ratio_1'].iloc[i])): + Sequency_X.append((X_1.iloc[i].values)) + for j in range(int(DF['Ratio_2'].iloc[i])): + Sequency_X.append((X_2.iloc[i].values)) + else: + random.seed(10) + X1_random_position = random.sample(range(0, 100), int(DF['Ratio_1'].iloc[i])) + Sequency_X = [0 for a in range(100)] + for j in range(100): + if j in X1_random_position: + Sequency_X[j] = list(X_1.iloc[i].values) + else: + Sequency_X[j] = list(X_2.iloc[i].values) + Mix_X_100Block.append(Sequency_X) + + Mix_X_100Block = np.array(Mix_X_100Block) + + # data split into train/test sets + X_train, X_test, y_train, y_test = train_test_split(Mix_X_100Block, DF['Tg_avg'], test_size=0.2, random_state=11) + + # model setup using the optimized architecture + LSTMunits = 20 # hyperprameter for LSTM + RNNmodel = Sequential() + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True), input_shape=(100,125))) + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True))) + RNNmodel.add(TimeDistributed(Dense(int(LSTMunits/2), activation=""relu""))) + RNNmodel.add(Reshape((int(LSTMunits/2*100),))) + RNNmodel.add(Dense(1)) + + RNNmodel.compile(loss='mse', optimizer='adam') + RNNmodel.fit(X_train, y_train, validation_split=0.2, epochs=120, batch_size=64) + + filepath = 'PolyInfo_RNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance"") + y_pred_train = RNNmodel.predict((X_train)) + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + y_pred_test = RNNmodel.predict((X_test)) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser() + parser.add_argument('--model', type=str, required = True, + help='Choose either ""CNN"", ""DNN"", ""RNN"", or ""Fusion"" for model architecture') + + parsed_args = parser.parse_args() + + train(parsed_args)","Python" +"RNN","figotj/Copolymer","train_dataset1.py",".py","19093","405","import pandas as pd +import numpy as np +import pickle +from rdkit import Chem +from rdkit.Chem import AllChem +from rdkit.Chem import Descriptors +from rdkit.Chem import rdMolDescriptors +from rdkit.Chem.Draw import IPythonConsole +from rdkit.Chem import Draw +from rdkit.Chem.Draw import rdMolDraw2D +import kerastuner as kt +from kerastuner.tuners import RandomSearch +from kerastuner.engine.hyperparameters import HyperParameters +from tensorflow.keras.models import Sequential, save_model, load_model +from tensorflow.keras.optimizers import Adam +from tensorflow import keras +from tensorflow.keras.layers import Conv2D, MaxPooling2D, Conv1D, MaxPooling1D, Dense, Flatten, Activation, ZeroPadding2D +from tensorflow.keras.layers import LSTM, Embedding, Bidirectional, TimeDistributed, Reshape, Dropout +from tensorflow.keras.preprocessing.text import one_hot +from tensorflow.keras.preprocessing.sequence import pad_sequences +import time +from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error +from sklearn.metrics import mean_absolute_error, r2_score +from sklearn.model_selection import train_test_split +import random +from numpy.random import seed +import tensorflow +from keras.layers import Input, Dense +from keras.models import Model +from keras.layers.merge import Concatenate +import argparse + +def train(args): + + #read in the reference data + DF = pd.read_csv('datasets/Dataset 1.csv') #to be comparable with the size of other datasets, select ~5000 data points from the reference + DF['TRIMER_mol'] = DF['TRIMER'].apply(Chem.MolFromSmiles) + DF = DF.dropna() + + + #fingperints featurization + fp = DF['TRIMER_mol'].apply(lambda m: AllChem.GetMorganFingerprint(m, radius=3)) + + #Recognize all n substructures found in the datasets + fp_n = fp.apply(lambda m: m.GetNonzeroElements()) + HashCode = [] + for i in fp_n: + for j in i.keys(): + HashCode.append(j) + unique_set = set(HashCode) + unique_list = list(unique_set) + Corr_df = pd.DataFrame(unique_list).reset_index() + + #Construct feature matrix + MY_finger = [] + for polymer in fp_n: + my_finger = [0] * len(unique_list) + for key in polymer.keys(): + index = Corr_df[Corr_df[0] == key]['index'].values[0] + my_finger[index] = polymer[key] + MY_finger.append(my_finger) + MY_finger_dataset = pd.DataFrame(MY_finger) + + + # filter feature matrix using only the most dominant substructures in the dataset + Zero_Sum = (MY_finger_dataset == 0).astype(int).sum() + NumberOfZero = 4670 # a optimized parameter for feature filter: if more than 4670 of the 5000 samples do not pocess one substrcture, then remove this substructure from the feature matrix + X = MY_finger_dataset[Zero_Sum[Zero_Sum < NumberOfZero].index] + + # CNN model + if args.model == 'CNN': + # input for CNN + Mix_X_100Block = [] + for i in range(len(DF)): + Sequency_X = [0 for a in range(100)] + for j in range(100): + if j%2 == 0: + Sequency_X[j] = list(X.iloc[i].values) + else: + Sequency_X[j] = list(X.iloc[i].values) + Mix_X_100Block.append(Sequency_X) + + Mix_X_100Block = np.array(Mix_X_100Block) + + Mix_X_100Block = Mix_X_100Block.reshape((len(X) , 100, 132, 1)) + Mix_X_100Block.shape + + # data split into train/test sets for property IP + X_train, X_test, y_train, y_test = train_test_split(Mix_X_100Block, DF['IP (eV)'], test_size=0.2, random_state=42) + + # model setup using the optimized architecture for IP + model = Sequential() + model.add(Conv2D(32, (10, 10), activation='relu', input_shape=X_train.shape[1:])) + model.add(Conv2D(32, (8, 8), activation='relu')) + model.add(Conv2D(32, (4, 4), activation='relu')) + model.add(Flatten()) + model.add(Dense(1)) + optimizer=keras.optimizers.Adam(lr=0.001) + model.compile(optimizer=optimizer, loss='mean_absolute_error') + model.fit(x=X_train,y=y_train,epochs=200, + batch_size=32, + validation_split=0.2) + + filepath = 'Binary_IP_CNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + y_pred_train = model.predict(X_train) + y_pred_test = model.predict(X_test) + print(""model performance (IP)"") + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + # data split into train/test sets for property EA + X_train, X_test, y_train, y_test = train_test_split(Mix_X_100Block, DF['EA (eV)'], test_size=0.2, random_state=42) + + # model setup using the optimized architecture for EA + model = Sequential() + model.add(Conv2D(24, (10, 10), activation='relu', input_shape=X_train.shape[1:])) + model.add(Conv2D(32, (4, 4), activation='relu')) + model.add(Conv2D(32, (3, 3), activation='relu')) + model.add(Flatten()) + model.add(Dense(1)) + optimizer=keras.optimizers.Adam(lr=0.001) + model.compile(optimizer=optimizer, loss='mean_absolute_error') + model.fit(x=X_train,y=y_train,epochs=200, + batch_size=32, + validation_split=0.2) + + filepath = 'Binary_EA_CNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + y_pred_train = model.predict(X_train) + y_pred_test = model.predict(X_test) + print(""model performance (EA)"") + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + + # Fusion model + if args.model == 'Fusion': + # input for Fusion + Mix_X_100Block = [] + for i in range(len(DF)): + Sequency_X = [0 for a in range(100)] + for j in range(100): + if j%2 == 0: + Sequency_X[j] = 1 + else: + Sequency_X[j] = 1 + Mix_X_100Block.append(Sequency_X) + + Mix_X_100Block = np.array(Mix_X_100Block) + + Mix_X_100Block = Mix_X_100Block.reshape((4914, 100, 1)) + Mix_X_100Block.shape + + LSTMunits = 20 # hyperprameter for LSTM + # define two sets of inputs + inputA = Input(shape=(100,1)) + inputB = Input(shape=(132)) + + # model setup using the optimized architecture for IP + # the first branch operates on the first input + RNNmodel = Sequential() + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True), input_shape=(100,1))) + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True))) + RNNmodel.add(TimeDistributed(Dense(int(LSTMunits/2), activation=""relu""))) + RNNmodel.add(Reshape((int(LSTMunits/2*100),))) + + # the second branch opreates on the second input + y = Dense(8, activation=""relu"")(inputB) + y = Dense(8, activation=""relu"")(y) + y = Model(inputs=inputB, outputs=y) + + # fuse two branches + combined = Concatenate()([RNNmodel.output, y.output]) + z = Dense(8, activation=""relu"")(combined) + z = Dense(1, activation=""linear"")(z) + model = Model(inputs=[RNNmodel.input, y.input], outputs=z) + + # data split into train/test sets for property IP + xtrain_A, xtest_A, ytrain_A, ytest_A=train_test_split(Mix_X_100Block, DF['IP (eV)'], test_size=0.20, random_state=200) + xtrain_B, xtest_B, ytrain_B, ytest_B=train_test_split(X, DF['IP (eV)'], test_size=0.20, random_state=200) + + optimizer=keras.optimizers.Adam(lr=0.001) + model.compile(optimizer=optimizer, loss='mean_absolute_error') + model.fit(x=[xtrain_A, xtrain_B], y=ytrain_B,epochs=200, + batch_size=32, + validation_split=0.2) + + filepath = 'Binary_IP_Fusion.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance (IP)"") + ytrain = ytrain_B + ytest = ytest_B + y_pred_train = model.predict([xtrain_A, xtrain_B]) + print(""Train set R^2: "", r2_score(ytrain, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(ytrain, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(ytrain, y_pred_train))) + y_pred_test = model.predict([xtest_A, xtest_B]) + print(""Test set R^2: "", r2_score(ytest, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(ytest, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(ytest, y_pred_test))) + + + # model setup using the optimized architecture for EA + # the first branch operates on the first input + RNNmodel = Sequential() + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True), input_shape=(100,1))) + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True))) + RNNmodel.add(TimeDistributed(Dense(int(LSTMunits/2), activation=""relu""))) + RNNmodel.add(Reshape((int(LSTMunits/2*100),))) + + # the second branch opreates on the second input + y = Dense(8, activation=""relu"")(inputB) + y = Dense(8, activation=""relu"")(y) + y = Model(inputs=inputB, outputs=y) + + # fuse two branches + combined = Concatenate()([RNNmodel.output, y.output]) + z = Dense(8, activation=""relu"")(combined) + z = Dense(1, activation=""linear"")(z) + model = Model(inputs=[RNNmodel.input, y.input], outputs=z) + + # data split into train/test sets for property EA + xtrain_A, xtest_A, ytrain_A, ytest_A=train_test_split(Mix_X_100Block, DF['EA (eV)'], test_size=0.20, random_state=200) + xtrain_B, xtest_B, ytrain_B, ytest_B=train_test_split(X, DF['EA (eV)'], test_size=0.20, random_state=200) + + optimizer=keras.optimizers.Adam(lr=0.001) + model.compile(optimizer=optimizer, loss='mean_absolute_error') + model.fit(x=[xtrain_A, xtrain_B], y=ytrain_B,epochs=200, + batch_size=32, + validation_split=0.2) + + filepath = 'Binary_EA_Fusion.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance (EA)"") + ytrain = ytrain_B + ytest = ytest_B + y_pred_train = model.predict([xtrain_A, xtrain_B]) + print(""Train set R^2: "", r2_score(ytrain, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(ytrain, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(ytrain, y_pred_train))) + y_pred_test = model.predict([xtest_A, xtest_B]) + print(""Test set R^2: "", r2_score(ytest, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(ytest, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(ytest, y_pred_test))) + + + # FFNN model + if args.model == 'FFNN': + + # data split into train/test sets for property IP + x_train, x_test, y_train, y_test = train_test_split(X, DF['IP (eV)'], test_size=0.2, random_state=11) + + # model setup using the optimized architecture for IP + model = keras.models.Sequential() + model.add(Dense(units = 24, input_dim = x_train.shape[1],activation='relu')) + model.add(Dense(units = 64, activation='relu')) + model.add(Dense(units = 1)) + model.compile(optimizer=keras.optimizers.Adam(learning_rate=0.001), + loss=""mean_squared_error"") + model.fit(x_train, y_train, epochs = 300, batch_size = 128, + validation_split=0.2) + + filepath = 'Binary_IP_FFNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance (IP)"") + y_pred_train = model.predict((x_train)) + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + y_pred_test = model.predict((x_test)) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + + # data split into train/test sets for property EA + x_train, x_test, y_train, y_test = train_test_split(X, DF['EA (eV)'], test_size=0.2, random_state=11) + + # model setup using the optimized architecture for EA + model = keras.models.Sequential() + model.add(Dense(units = 24, input_dim = x_train.shape[1],activation='relu')) + model.add(Dense(units = 64, activation='relu')) + model.add(Dense(units = 1)) + model.compile(optimizer=keras.optimizers.Adam(learning_rate=0.001), + loss=""mean_squared_error"") + model.fit(x_train, y_train, epochs = 300, batch_size = 128, + validation_split=0.2) + + filepath = 'Binary_EA_FFNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance (EA)"") + y_pred_train = model.predict((x_train)) + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + y_pred_test = model.predict((x_test)) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + + # RNN model + if args.model == 'RNN': + # input for RNN + Mix_X_100Block = [] + for i in range(len(DF)): + Sequency_X = [0 for a in range(100)] + for j in range(100): + if j%2 == 0: + Sequency_X[j] = list(X.iloc[i].values) + else: + Sequency_X[j] = list(X.iloc[i].values) + Mix_X_100Block.append(Sequency_X) + Mix_X_100Block = np.array(Mix_X_100Block) + + # data split into train/test sets for property IP + X_train, X_test, y_train, y_test = train_test_split(Mix_X_100Block, DF['IP (eV)'], test_size=0.2, random_state=11) + + # model setup using the optimized architecture for IP + LSTMunits = 20 # hyperprameter for LSTM + RNNmodel = Sequential() + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True), input_shape=(100,132))) + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True))) + RNNmodel.add(TimeDistributed(Dense(int(LSTMunits/2), activation=""relu""))) + RNNmodel.add(Reshape((int(LSTMunits/2*100),))) + RNNmodel.add(Dense(1)) + + RNNmodel.compile(loss='mse', optimizer='adam') + RNNmodel.fit(X_train, y_train, validation_split=0.2, epochs=120, batch_size=64) + + filepath = 'Binary_IP_RNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance (IP)"") + y_pred_train = RNNmodel.predict((X_train)) + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + y_pred_test = RNNmodel.predict((X_test)) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + + # data split into train/test sets for property EA + X_train, X_test, y_train, y_test = train_test_split(Mix_X_100Block, DF['EA (eV)'], test_size=0.2, random_state=11) + + # model setup using the optimized architecture for EA + LSTMunits = 20 # hyperprameter for LSTM + RNNmodel = Sequential() + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True), input_shape=(100,132))) + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True))) + RNNmodel.add(TimeDistributed(Dense(int(LSTMunits/2), activation=""relu""))) + RNNmodel.add(Reshape((int(LSTMunits/2*100),))) + RNNmodel.add(Dense(1)) + + RNNmodel.compile(loss='mse', optimizer='adam') + RNNmodel.fit(X_train, y_train, validation_split=0.2, epochs=120, batch_size=64) + + filepath = 'Binary_EA_RNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance (EA)"") + y_pred_train = RNNmodel.predict((X_train)) + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + y_pred_test = RNNmodel.predict((X_test)) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser() + parser.add_argument('--model', type=str, required = True, + help='Choose either ""CNN"", ""DNN"", ""RNN"", or ""Fusion"" for model architecture') + + parsed_args = parser.parse_args() + + train(parsed_args)","Python" +"RNN","figotj/Copolymer","train_dataset2.py",".py","17140","388","import pandas as pd +import numpy as np +import pickle +from rdkit import Chem +from rdkit.Chem import AllChem +from rdkit.Chem import Descriptors +from rdkit.Chem import rdMolDescriptors +from rdkit.Chem.Draw import IPythonConsole +from rdkit.Chem import Draw +from rdkit.Chem.Draw import rdMolDraw2D +import kerastuner as kt +from kerastuner.tuners import RandomSearch +from kerastuner.engine.hyperparameters import HyperParameters +from tensorflow.keras.models import Sequential, save_model, load_model +from tensorflow.keras.optimizers import Adam +from tensorflow import keras +from tensorflow.keras.layers import Conv2D, MaxPooling2D, Conv1D, MaxPooling1D, Dense, Flatten, Activation, ZeroPadding2D +from tensorflow.keras.layers import LSTM, Embedding, Bidirectional, TimeDistributed, Reshape, Dropout +from tensorflow.keras.preprocessing.text import one_hot +from tensorflow.keras.preprocessing.sequence import pad_sequences +import time +from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error +from sklearn.metrics import mean_absolute_error, r2_score +from sklearn.model_selection import train_test_split +import random +from numpy.random import seed +import tensorflow +from keras.layers import Input, Dense +from keras.models import Model +from keras.layers.merge import Concatenate +import argparse + +def train(args): + + #read in the reference data + DF = pd.read_excel(open('datasets/Dataset 2.xlsx', 'rb'), + sheet_name='Data organized fluoro-monomer') + + TFEA = 'C(OC(=O)C(C[*])[*])C(F)(F)F' + HexaFOEA = 'O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)C(F)(F)F' + NonaFOEA = 'O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(F)(F)F' + PEGA = 'O(C(=O)C(C[*])[*])CCOC' + HEA = 'O(C(=O)C(C[*])[*])CCO[H]' + MSEA = 'O(C(=O)C(C[*])[*])CC[S](C)=O' + + Flag = [i != 'X' for i in DF['19F NMR Signal-to-Noise Ratioa']] + DF = DF[Flag] + + DF['Smiles'] = np.nan + for i in range(len(DF)): + smi = 'C' + if DF['TFEA'].iloc[i] > 0: + smi = smi + '.C(OC(=O)C(C[*])[*])C(F)(F)F' + if DF['HexaFOEA'].iloc[i] > 0: + smi = smi + '.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)C(F)(F)F' + if DF['NonaFOEA'].iloc[i] > 0: + smi = smi + '.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(F)(F)F' + if DF['PEGA'].iloc[i] > 0: + smi = smi + '.O(C(=O)C(C[*])[*])CCOC' + if DF['HEA'].iloc[i] > 0: + smi = smi + '.O(C(=O)C(C[*])[*])CCO[H]' + if DF['MSEA'].iloc[i] > 0: + smi = smi + '.O(C(=O)C(C[*])[*])CC[S](C)=O' + DF['Smiles'].iloc[i] = smi + + MOL = pd.DataFrame(['C(OC(=O)C(C[*])[*])C(F)(F)F', + 'O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)C(F)(F)F', + 'O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(F)(F)F', + 'O(C(=O)C(C[*])[*])CCOC', + 'O(C(=O)C(C[*])[*])CCO[H]', + 'O(C(=O)C(C[*])[*])CC[S](C)=O'])[0].apply(Chem.MolFromSmiles) + + + #fingperints featurization + fp = MOL.apply(lambda m: AllChem.GetMorganFingerprint(m, radius=3)) + + #Recognize all n substructures found in the datasets + fp_n = fp.apply(lambda m: m.GetNonzeroElements()) + HashCode = [] + for i in fp_n: + for j in i.keys(): + HashCode.append(j) + unique_set = set(HashCode) + unique_list = list(unique_set) + Corr_df = pd.DataFrame(unique_list).reset_index() + + #Construct feature matrix + MY_finger = [] + for polymer in fp_n: + my_finger = [0] * len(unique_list) + for key in polymer.keys(): + index = Corr_df[Corr_df[0] == key]['index'].values[0] + my_finger[index] = polymer[key] + MY_finger.append(my_finger) + MY_finger_dataset = pd.DataFrame(MY_finger) + + Zero_Sum = (MY_finger_dataset == 0).astype(int).sum() + NumberOfZero = 6 + X = MY_finger_dataset[Zero_Sum[Zero_Sum < NumberOfZero].index] + + Mix_X = [] + for i in range(len(DF)): + Mix_X.append(X.iloc[0].values * DF['TFEA'].iloc[i] + \ + X.iloc[1].values * DF['HexaFOEA'].iloc[i] + \ + X.iloc[2].values * DF['NonaFOEA'].iloc[i] + \ + X.iloc[3].values * DF['PEGA'].iloc[i] + \ + X.iloc[4].values * DF['HEA'].iloc[i] + \ + X.iloc[5].values * DF['MSEA'].iloc[i]) + Mix_X = np.array(Mix_X) + + # CNN model + if args.model == 'CNN': + # input for CNN + Mix_X_100Block = [] + for i in range(len(DF)): + random.seed(10) + + Random_position = [] + Random_position_all = [] + + Rest = range(0, 100) + for col in ['TFEA', 'HexaFOEA', 'NonaFOEA', 'PEGA', 'HEA', 'MSEA']: + + X_random_position = random.sample(Rest, int(DF[col].iloc[i] * 100)) + Random_position.append(X_random_position) + for p in X_random_position: + Random_position_all.append(p) + Rest = [] + for x in range(0, 100): + if x not in Random_position_all: + Rest.append(x) + + Sequency_X = [0 for a in range(100)] + for j in range(100): + if j in Random_position[0]: + Sequency_X[j] = list(X.iloc[0].values) + elif j in Random_position[1]: + Sequency_X[j] = list(X.iloc[1].values) + elif j in Random_position[2]: + Sequency_X[j] = list(X.iloc[2].values) + elif j in Random_position[3]: + Sequency_X[j] = list(X.iloc[3].values) + elif j in Random_position[4]: + Sequency_X[j] = list(X.iloc[4].values) + elif j in Random_position[5]: + Sequency_X[j] = list(X.iloc[5].values) + + Mix_X_100Block.append(Sequency_X) + + Mix_X_100Block = np.array(Mix_X_100Block) + Mix_X_100Block = Mix_X_100Block.reshape((271, 100, 80, 1)) + + # data split into train/test sets + X_train, X_test, y_train, y_test = train_test_split(Mix_X_100Block, DF['19F NMR Signal-to-Noise Ratioa'].astype(np.float64), test_size=0.2, random_state=42) + + # model setup using the optimized architecture + model = Sequential() + model.add(Conv2D(8, (10, 10), activation='relu', input_shape=X_train.shape[1:])) + model.add(Conv2D(8, (4, 4), activation='relu')) + model.add(Conv2D(8, (3, 3), activation='relu')) + model.add(MaxPooling2D(pool_size=(2, 2))) + model.add(Dropout(0.3)) + model.add(Flatten()) + model.add(Dense(1)) + optimizer=keras.optimizers.Adam(lr=0.005) + model.compile(optimizer=optimizer, loss='mean_absolute_error') + model.fit(x=X_train,y=y_train,epochs=200, + batch_size=64, + validation_split=0.2) + + filepath = 'NMR_CNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + y_pred_train = model.predict(X_train) + y_pred_test = model.predict(X_test) + print(""model performance"") + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + + # Fusion model + if args.model == 'Fusion': + # input for Fusion + Mix_X_100Block = [] + for i in range(len(DF)): + random.seed(10) + + Random_position = [] + Random_position_all = [] + + Rest = range(0, 100) + for col in ['TFEA', 'HexaFOEA', 'NonaFOEA', 'PEGA', 'HEA', 'MSEA']: + + X_random_position = random.sample(Rest, int(DF[col].iloc[i] * 100)) + Random_position.append(X_random_position) + for p in X_random_position: + Random_position_all.append(p) + Rest = [] + for x in range(0, 100): + if x not in Random_position_all: + Rest.append(x) + + Sequency_X = [0 for a in range(100)] + for j in range(100): + if j in Random_position[0]: + Sequency_X[j] = 0 + elif j in Random_position[1]: + Sequency_X[j] = 1 + elif j in Random_position[2]: + Sequency_X[j] = 2 + elif j in Random_position[3]: + Sequency_X[j] = 3 + elif j in Random_position[4]: + Sequency_X[j] = 4 + elif j in Random_position[5]: + Sequency_X[j] = 5 + + Mix_X_100Block.append(Sequency_X) + + Mix_X_100Block = np.array(Mix_X_100Block) + Mix_X_100Block = Mix_X_100Block.reshape((271, 100, 1)) + + LSTMunits = 20 # hyperprameter for LSTM + # define two sets of inputs + inputA = Input(shape=(100,1)) + inputB = Input(shape=(80)) + + # model setup using the optimized architecture + # the first branch operates on the first input + RNNmodel = Sequential() + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True), input_shape=(100,1))) + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True))) + RNNmodel.add(TimeDistributed(Dense(int(LSTMunits/2), activation=""relu""))) + RNNmodel.add(Reshape((int(LSTMunits/2*100),))) + + # the second branch opreates on the second input + y = Dense(8, activation=""relu"")(inputB) + y = Dense(8, activation=""relu"")(y) + y = Model(inputs=inputB, outputs=y) + + # fuse two branches + combined = Concatenate()([RNNmodel.output, y.output]) + z = Dense(8, activation=""relu"")(combined) + z = Dense(1, activation=""linear"")(z) + model = Model(inputs=[RNNmodel.input, y.input], outputs=z) + + # data split into train/test sets + xtrain_A, xtest_A, ytrain_A, ytest_A=train_test_split(Mix_X_100Block, DF['19F NMR Signal-to-Noise Ratioa'].astype(np.float64), test_size=0.20, random_state=200) + xtrain_B, xtest_B, ytrain_B, ytest_B=train_test_split(Mix_X, DF['19F NMR Signal-to-Noise Ratioa'].astype(np.float64), test_size=0.20, random_state=200) + + optimizer=keras.optimizers.Adam(lr=0.001) + model.compile(optimizer=optimizer, loss='mean_absolute_error') + model.fit(x=[xtrain_A, xtrain_B], y=ytrain_B,epochs=300, + batch_size=32, + validation_split=0.2) + + filepath = 'NMR_Fusion.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance"") + ytrain = ytrain_B + ytest = ytest_B + y_pred_train = model.predict([xtrain_A, xtrain_B]) + print(""Train set R^2: "", r2_score(ytrain, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(ytrain, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(ytrain, y_pred_train))) + y_pred_test = model.predict([xtest_A, xtest_B]) + print(""Test set R^2: "", r2_score(ytest, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(ytest, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(ytest, y_pred_test))) + + + # FFNN model + if args.model == 'FFNN': + + # data split into train/test sets + x_train, x_test, y_train, y_test = train_test_split(Mix_X, DF['19F NMR Signal-to-Noise Ratioa'].astype(np.float64), test_size=0.2, random_state=11) + # model setup using the optimized architecture + model = keras.models.Sequential() + model.add(Dense(units = 24, input_dim = x_train.shape[1],activation='relu')) + model.add(Dense(units = 64, activation='relu')) + model.add(Dense(units = 1)) + model.compile(optimizer=keras.optimizers.Adam(learning_rate=0.001), + loss=""mean_squared_error"") + model.fit(x_train, y_train, epochs = 1000, batch_size = 128, + validation_split=0.2) + + filepath = 'NMR_FFNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance"") + y_pred_train = model.predict((x_train)) + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + y_pred_test = model.predict((x_test)) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + + # RNN model + if args.model == 'RNN': + # input for RNN + Mix_X_100Block = [] + for i in range(len(DF)): + random.seed(10) + + Random_position = [] + Random_position_all = [] + + Rest = range(0, 100) + for col in ['TFEA', 'HexaFOEA', 'NonaFOEA', 'PEGA', 'HEA', 'MSEA']: + + X_random_position = random.sample(Rest, int(DF[col].iloc[i] * 100)) + Random_position.append(X_random_position) + for p in X_random_position: + Random_position_all.append(p) + Rest = [] + for x in range(0, 100): + if x not in Random_position_all: + Rest.append(x) + + Sequency_X = [0 for a in range(100)] + for j in range(100): + if j in Random_position[0]: + Sequency_X[j] = list(X.iloc[0].values) + elif j in Random_position[1]: + Sequency_X[j] = list(X.iloc[1].values) + elif j in Random_position[2]: + Sequency_X[j] = list(X.iloc[2].values) + elif j in Random_position[3]: + Sequency_X[j] = list(X.iloc[3].values) + elif j in Random_position[4]: + Sequency_X[j] = list(X.iloc[4].values) + elif j in Random_position[5]: + Sequency_X[j] = list(X.iloc[5].values) + + Mix_X_100Block.append(Sequency_X) + + Mix_X_100Block = np.array(Mix_X_100Block) + + # data split into train/test sets + X_train, X_test, y_train, y_test = train_test_split(Mix_X_100Block, DF['19F NMR Signal-to-Noise Ratioa'].astype(np.float64), test_size=0.2, random_state=11) + + # model setup using the optimized architecture + LSTMunits = 20 # hyperprameter for LSTM + RNNmodel = Sequential() + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True), input_shape=(100,80))) + RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True))) + RNNmodel.add(TimeDistributed(Dense(int(LSTMunits/2), activation=""relu""))) + RNNmodel.add(Reshape((int(LSTMunits/2*100),))) + RNNmodel.add(Dense(1)) + + RNNmodel.compile(loss='mse', optimizer='adam') + RNNmodel.fit(X_train, y_train, validation_split=0.2, epochs=200, batch_size=64) + + filepath = 'NMR_RNN.model' + save_model(model, filepath, save_format='h5') + + # model evaluation + print(""model performance"") + y_pred_train = RNNmodel.predict((X_train)) + print(""Train set R^2: %.2f"" % r2_score(y_train, y_pred_train)) + print(""Train MAE score: %.2f"" % mean_absolute_error(y_train, y_pred_train)) + print(""Train RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_train, y_pred_train))) + y_pred_test = RNNmodel.predict((X_test)) + print(""Test set R^2: %.2f"" % r2_score(y_test, y_pred_test)) + print(""Test MAE score: %.2f"" % mean_absolute_error(y_test, y_pred_test)) + print(""Test RMSE score: %.2f"" % np.sqrt(mean_squared_error(y_test, y_pred_test))) + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser() + parser.add_argument('--model', type=str, required = True, + help='Choose either ""CNN"", ""DNN"", ""RNN"", or ""Fusion"" for model architecture') + + parsed_args = parser.parse_args() + + train(parsed_args)","Python" +"RNN","figotj/Copolymer","LICENSE.md",".md","1063","22","MIT License + +Copyright (c) 2022 figotj + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the ""Software""), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +","Markdown" +"RNN","figotj/Copolymer","Protocol_Copolymer_19F MRI.ipynb",".ipynb","506509","6067","{ + ""cells"": [ + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Import dependencies "" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 1, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""import pandas as pd\n"", + ""import numpy as np\n"", + ""import pickle\n"", + ""\n"", + ""from rdkit import Chem\n"", + ""from rdkit.Chem import AllChem\n"", + ""from rdkit.Chem import Descriptors\n"", + ""from rdkit.Chem import rdMolDescriptors\n"", + ""from rdkit.Chem.Draw import IPythonConsole\n"", + ""from rdkit.Chem import Draw\n"", + ""from rdkit.Chem.Draw import rdMolDraw2D\n"", + ""\n"", + ""from keras.layers import Input, Dense\n"", + ""from keras.models import Model\n"", + ""from keras.utils import plot_model\n"", + ""from keras.layers.merge import Concatenate\n"", + ""\n"", + ""from tensorflow.keras.models import Sequential, save_model, load_model\n"", + ""from tensorflow.keras.layers import Dense, Flatten, LSTM, Embedding, Bidirectional, TimeDistributed, Reshape\n"", + ""from tensorflow.keras.optimizers import Adam\n"", + ""from tensorflow import keras\n"", + ""from tensorflow.keras.layers import Conv2D, MaxPooling2D, Conv1D, MaxPooling1D, Dropout\n"", + ""import tensorflow as tf\n"", + ""\n"", + ""from sklearn.model_selection import train_test_split\n"", + ""from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error\n"", + ""import seaborn as sns\n"", + ""from sklearn.model_selection import train_test_split\n"", + ""import matplotlib.pyplot as plt\n"", + ""import random\n"", + ""import time"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 2, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]"" + ] + }, + ""execution_count"": 2, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""physical_devices = tf.config.list_physical_devices('GPU') \n"", + ""tf.config.list_physical_devices('GPU') "" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Load the dataset from the original publication"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 3, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""DF_MRI = pd.read_excel(open('./datasets/Dataset 2.xlsx', 'rb'),\n"", + "" sheet_name='Data organized fluoro-monomer') "" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 4, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/html"": [ + ""
\n"", + ""\n"", + ""\n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + ""
TFEAHexaFOEANonaFOEAPEGAHEAMSEA19F NMR Signal-to-Noise RatioaWeight % FluorineMolecular weight (Mn)bDispersity (Ɖ)b
00.000.000.100.900.000.00200.036740--
10.000.000.200.300.000.50470.11716871001.25
20.000.000.200.300.500.00610.12717481001.16
30.000.000.200.400.000.40460.10565978001.26
40.000.000.200.400.400.00510.112017--
.................................
4130.650.000.000.150.150.05X0.187427--
4140.700.000.000.300.000.00550.158419--
4150.750.000.000.000.050.20X0.277993--
4160.800.000.000.100.000.10X0.243231--
4170.800.050.050.050.050.00X0.326851--
\n"", + ""

418 rows × 10 columns

\n"", + ""
"" + ], + ""text/plain"": [ + "" TFEA HexaFOEA NonaFOEA PEGA HEA MSEA \\\n"", + ""0 0.00 0.00 0.10 0.90 0.00 0.00 \n"", + ""1 0.00 0.00 0.20 0.30 0.00 0.50 \n"", + ""2 0.00 0.00 0.20 0.30 0.50 0.00 \n"", + ""3 0.00 0.00 0.20 0.40 0.00 0.40 \n"", + ""4 0.00 0.00 0.20 0.40 0.40 0.00 \n"", + "".. ... ... ... ... ... ... \n"", + ""413 0.65 0.00 0.00 0.15 0.15 0.05 \n"", + ""414 0.70 0.00 0.00 0.30 0.00 0.00 \n"", + ""415 0.75 0.00 0.00 0.00 0.05 0.20 \n"", + ""416 0.80 0.00 0.00 0.10 0.00 0.10 \n"", + ""417 0.80 0.05 0.05 0.05 0.05 0.00 \n"", + ""\n"", + "" 19F NMR Signal-to-Noise Ratioa Weight % Fluorine Molecular weight (Mn)b \\\n"", + ""0 20 0.036740 - \n"", + ""1 47 0.117168 7100 \n"", + ""2 61 0.127174 8100 \n"", + ""3 46 0.105659 7800 \n"", + ""4 51 0.112017 - \n"", + "".. ... ... ... \n"", + ""413 X 0.187427 - \n"", + ""414 55 0.158419 - \n"", + ""415 X 0.277993 - \n"", + ""416 X 0.243231 - \n"", + ""417 X 0.326851 - \n"", + ""\n"", + "" Dispersity (Ɖ)b \n"", + ""0 - \n"", + ""1 1.25 \n"", + ""2 1.16 \n"", + ""3 1.26 \n"", + ""4 - \n"", + "".. ... \n"", + ""413 - \n"", + ""414 - \n"", + ""415 - \n"", + ""416 - \n"", + ""417 - \n"", + ""\n"", + ""[418 rows x 10 columns]"" + ] + }, + ""execution_count"": 4, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""DF_MRI"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Construct the summary table"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 5, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""TFEA = 'C(OC(=O)C(C[*])[*])C(F)(F)F'\n"", + ""HexaFOEA = 'O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)C(F)(F)F'\n"", + ""NonaFOEA = 'O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(F)(F)F'\n"", + ""PEGA = 'O(C(=O)C(C[*])[*])CCOC'\n"", + ""HEA = 'O(C(=O)C(C[*])[*])CCO[H]'\n"", + ""MSEA = 'O(C(=O)C(C[*])[*])CC[S](C)=O'"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 6, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""Flag = [i != 'X' for i in DF_MRI['19F NMR Signal-to-Noise Ratioa']]"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 7, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/html"": [ + ""
\n"", + ""\n"", + ""\n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + ""
TFEAHexaFOEANonaFOEAPEGAHEAMSEA19F NMR Signal-to-Noise RatioaWeight % FluorineMolecular weight (Mn)bDispersity (Ɖ)b
00.00.00.10.90.00.0200.036740--
10.00.00.20.30.00.5470.11716871001.25
20.00.00.20.30.50.0610.12717481001.16
30.00.00.20.40.00.4460.10565978001.26
40.00.00.20.40.40.0510.112017--
.................................
4080.60.00.00.30.10.0500.13786746001.37
4090.60.00.00.40.00.0310.120230--
4100.60.00.00.40.00.0470.120230--
4110.60.00.00.40.00.0520.120230--
4140.70.00.00.30.00.0550.158419--
\n"", + ""

271 rows × 10 columns

\n"", + ""
"" + ], + ""text/plain"": [ + "" TFEA HexaFOEA NonaFOEA PEGA HEA MSEA 19F NMR Signal-to-Noise Ratioa \\\n"", + ""0 0.0 0.0 0.1 0.9 0.0 0.0 20 \n"", + ""1 0.0 0.0 0.2 0.3 0.0 0.5 47 \n"", + ""2 0.0 0.0 0.2 0.3 0.5 0.0 61 \n"", + ""3 0.0 0.0 0.2 0.4 0.0 0.4 46 \n"", + ""4 0.0 0.0 0.2 0.4 0.4 0.0 51 \n"", + "".. ... ... ... ... ... ... ... \n"", + ""408 0.6 0.0 0.0 0.3 0.1 0.0 50 \n"", + ""409 0.6 0.0 0.0 0.4 0.0 0.0 31 \n"", + ""410 0.6 0.0 0.0 0.4 0.0 0.0 47 \n"", + ""411 0.6 0.0 0.0 0.4 0.0 0.0 52 \n"", + ""414 0.7 0.0 0.0 0.3 0.0 0.0 55 \n"", + ""\n"", + "" Weight % Fluorine Molecular weight (Mn)b Dispersity (Ɖ)b \n"", + ""0 0.036740 - - \n"", + ""1 0.117168 7100 1.25 \n"", + ""2 0.127174 8100 1.16 \n"", + ""3 0.105659 7800 1.26 \n"", + ""4 0.112017 - - \n"", + "".. ... ... ... \n"", + ""408 0.137867 4600 1.37 \n"", + ""409 0.120230 - - \n"", + ""410 0.120230 - - \n"", + ""411 0.120230 - - \n"", + ""414 0.158419 - - \n"", + ""\n"", + ""[271 rows x 10 columns]"" + ] + }, + ""execution_count"": 7, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""DF_MRI[Flag]"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 8, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""Dataset_2 = DF_MRI[Flag].copy()"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 9, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stderr"", + ""output_type"": ""stream"", + ""text"": [ + ""C:\\Users\\let20002\\AppData\\Roaming\\Python\\Python37\\site-packages\\pandas\\core\\indexing.py:1732: SettingWithCopyWarning: \n"", + ""A value is trying to be set on a copy of a slice from a DataFrame\n"", + ""\n"", + ""See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n"", + "" self._setitem_single_block(indexer, value, name)\n"" + ] + } + ], + ""source"": [ + ""Dataset_2['Smiles'] = np.nan\n"", + ""for i in range(len(Dataset_2)):\n"", + "" smi = 'C'\n"", + "" if Dataset_2['TFEA'].iloc[i] > 0:\n"", + "" smi = smi + '.C(OC(=O)C(C[*])[*])C(F)(F)F'\n"", + "" if Dataset_2['HexaFOEA'].iloc[i] > 0:\n"", + "" smi = smi + '.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)C(F)(F)F'\n"", + "" if Dataset_2['NonaFOEA'].iloc[i] > 0:\n"", + "" smi = smi + '.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(F)(F)F'\n"", + "" if Dataset_2['PEGA'].iloc[i] > 0:\n"", + "" smi = smi + '.O(C(=O)C(C[*])[*])CCOC'\n"", + "" if Dataset_2['HEA'].iloc[i] > 0:\n"", + "" smi = smi + '.O(C(=O)C(C[*])[*])CCO[H]'\n"", + "" if Dataset_2['MSEA'].iloc[i] > 0:\n"", + "" smi = smi + '.O(C(=O)C(C[*])[*])CC[S](C)=O'\n"", + "" Dataset_2['Smiles'].iloc[i] = smi "" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 10, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/html"": [ + ""
\n"", + ""\n"", + ""\n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + ""
TFEAHexaFOEANonaFOEAPEGAHEAMSEA19F NMR Signal-to-Noise RatioaWeight % FluorineMolecular weight (Mn)bDispersity (Ɖ)bSmiles
00.00.00.10.90.00.0200.036740--C.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(...
10.00.00.20.30.00.5470.11716871001.25C.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(...
20.00.00.20.30.50.0610.12717481001.16C.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(...
30.00.00.20.40.00.4460.10565978001.26C.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(...
40.00.00.20.40.40.0510.112017--C.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(...
....................................
4080.60.00.00.30.10.0500.13786746001.37C.C(OC(=O)C(C[*])[*])C(F)(F)F.O(C(=O)C(C[*])[*...
4090.60.00.00.40.00.0310.120230--C.C(OC(=O)C(C[*])[*])C(F)(F)F.O(C(=O)C(C[*])[*...
4100.60.00.00.40.00.0470.120230--C.C(OC(=O)C(C[*])[*])C(F)(F)F.O(C(=O)C(C[*])[*...
4110.60.00.00.40.00.0520.120230--C.C(OC(=O)C(C[*])[*])C(F)(F)F.O(C(=O)C(C[*])[*...
4140.70.00.00.30.00.0550.158419--C.C(OC(=O)C(C[*])[*])C(F)(F)F.O(C(=O)C(C[*])[*...
\n"", + ""

271 rows × 11 columns

\n"", + ""
"" + ], + ""text/plain"": [ + "" TFEA HexaFOEA NonaFOEA PEGA HEA MSEA 19F NMR Signal-to-Noise Ratioa \\\n"", + ""0 0.0 0.0 0.1 0.9 0.0 0.0 20 \n"", + ""1 0.0 0.0 0.2 0.3 0.0 0.5 47 \n"", + ""2 0.0 0.0 0.2 0.3 0.5 0.0 61 \n"", + ""3 0.0 0.0 0.2 0.4 0.0 0.4 46 \n"", + ""4 0.0 0.0 0.2 0.4 0.4 0.0 51 \n"", + "".. ... ... ... ... ... ... ... \n"", + ""408 0.6 0.0 0.0 0.3 0.1 0.0 50 \n"", + ""409 0.6 0.0 0.0 0.4 0.0 0.0 31 \n"", + ""410 0.6 0.0 0.0 0.4 0.0 0.0 47 \n"", + ""411 0.6 0.0 0.0 0.4 0.0 0.0 52 \n"", + ""414 0.7 0.0 0.0 0.3 0.0 0.0 55 \n"", + ""\n"", + "" Weight % Fluorine Molecular weight (Mn)b Dispersity (Ɖ)b \\\n"", + ""0 0.036740 - - \n"", + ""1 0.117168 7100 1.25 \n"", + ""2 0.127174 8100 1.16 \n"", + ""3 0.105659 7800 1.26 \n"", + ""4 0.112017 - - \n"", + "".. ... ... ... \n"", + ""408 0.137867 4600 1.37 \n"", + ""409 0.120230 - - \n"", + ""410 0.120230 - - \n"", + ""411 0.120230 - - \n"", + ""414 0.158419 - - \n"", + ""\n"", + "" Smiles \n"", + ""0 C.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(... \n"", + ""1 C.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(... \n"", + ""2 C.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(... \n"", + ""3 C.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(... \n"", + ""4 C.O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(... \n"", + "".. ... \n"", + ""408 C.C(OC(=O)C(C[*])[*])C(F)(F)F.O(C(=O)C(C[*])[*... \n"", + ""409 C.C(OC(=O)C(C[*])[*])C(F)(F)F.O(C(=O)C(C[*])[*... \n"", + ""410 C.C(OC(=O)C(C[*])[*])C(F)(F)F.O(C(=O)C(C[*])[*... \n"", + ""411 C.C(OC(=O)C(C[*])[*])C(F)(F)F.O(C(=O)C(C[*])[*... \n"", + ""414 C.C(OC(=O)C(C[*])[*])C(F)(F)F.O(C(=O)C(C[*])[*... \n"", + ""\n"", + ""[271 rows x 11 columns]"" + ] + }, + ""execution_count"": 10, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""Dataset_2"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Feature engineering with Morgan fingerprint"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 11, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""MOL = pd.DataFrame(['C(OC(=O)C(C[*])[*])C(F)(F)F',\n"", + ""'O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)C(F)(F)F',\n"", + ""'O(C(=O)C(C[*])[*])CCOC(C(F)(F)F)(C(F)(F)F)C(F)(F)F',\n"", + ""'O(C(=O)C(C[*])[*])CCOC',\n"", + ""'O(C(=O)C(C[*])[*])CCO[H]',\n"", + ""'O(C(=O)C(C[*])[*])CC[S](C)=O'])[0].apply(Chem.MolFromSmiles)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 12, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""fp_1 = MOL.apply(lambda m: AllChem.GetMorganFingerprint(m, radius=3))\n"", + ""fp_1_n = fp_1.apply(lambda m: m.GetNonzeroElements())"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 13, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""# using substructures in dataset-1 to construct a dictionary\n"", + ""HashCode = []\n"", + ""for i in fp_1_n:\n"", + "" for j in i.keys():\n"", + "" HashCode.append(j)\n"", + ""\n"", + ""unique_set = set(HashCode)\n"", + ""unique_list = list(unique_set)\n"", + ""\n"", + ""Corr_df = pd.DataFrame(unique_list).reset_index()"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 14, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""#construct dataset-1 input\n"", + ""MY_finger = []\n"", + ""for polymer in fp_1_n:\n"", + "" my_finger = [0] * len(unique_list)\n"", + "" for key in polymer.keys():\n"", + "" index = Corr_df[Corr_df[0] == key]['index'].values[0]\n"", + "" my_finger[index] = polymer[key]\n"", + "" MY_finger.append(my_finger)\n"", + ""\n"", + ""MY_finger_dataset = pd.DataFrame(MY_finger) "" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 15, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/html"": [ + ""
\n"", + ""\n"", + ""\n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + "" \n"", + ""
0123456789...70717273747576777879
01000000000...0011000100
12011210000...0011000002
21000200131...1111000000
31000201000...0011001010
41000100000...0011010000
51100101000...0011100000
\n"", + ""

6 rows × 80 columns

\n"", + ""
"" + ], + ""text/plain"": [ + "" 0 1 2 3 4 5 6 7 8 9 ... 70 71 72 73 74 75 76 \\\n"", + ""0 1 0 0 0 0 0 0 0 0 0 ... 0 0 1 1 0 0 0 \n"", + ""1 2 0 1 1 2 1 0 0 0 0 ... 0 0 1 1 0 0 0 \n"", + ""2 1 0 0 0 2 0 0 1 3 1 ... 1 1 1 1 0 0 0 \n"", + ""3 1 0 0 0 2 0 1 0 0 0 ... 0 0 1 1 0 0 1 \n"", + ""4 1 0 0 0 1 0 0 0 0 0 ... 0 0 1 1 0 1 0 \n"", + ""5 1 1 0 0 1 0 1 0 0 0 ... 0 0 1 1 1 0 0 \n"", + ""\n"", + "" 77 78 79 \n"", + ""0 1 0 0 \n"", + ""1 0 0 2 \n"", + ""2 0 0 0 \n"", + ""3 0 1 0 \n"", + ""4 0 0 0 \n"", + ""5 0 0 0 \n"", + ""\n"", + ""[6 rows x 80 columns]"" + ] + }, + ""execution_count"": 15, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""MY_finger_dataset"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 16, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""80\n"" + ] + } + ], + ""source"": [ + ""# filter input into the most popular 124 substructures\n"", + ""Zero_Sum = (MY_finger_dataset == 0).astype(int).sum()\n"", + ""NumberOfZero = 6\n"", + ""print(len(Zero_Sum[Zero_Sum < NumberOfZero]))\n"", + ""X = MY_finger_dataset[Zero_Sum[Zero_Sum < NumberOfZero].index]"" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### CNN"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 17, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""Mix_X_100Block = []\n"", + ""for i in range(len(DF_MRI[Flag])):\n"", + "" random.seed(10)\n"", + ""\n"", + "" Random_position = []\n"", + "" Random_position_all = []\n"", + ""\n"", + "" Rest = range(0, 100)\n"", + "" for col in ['TFEA', 'HexaFOEA', 'NonaFOEA', 'PEGA', 'HEA', 'MSEA']:\n"", + ""\n"", + "" X_random_position = random.sample(Rest, int(DF_MRI[Flag][col].iloc[i] * 100))\n"", + "" Random_position.append(X_random_position)\n"", + "" for p in X_random_position:\n"", + "" Random_position_all.append(p)\n"", + "" Rest = []\n"", + "" for x in range(0, 100):\n"", + "" if x not in Random_position_all:\n"", + "" Rest.append(x)\n"", + "" \n"", + "" Sequency_X = [0 for a in range(100)]\n"", + "" for j in range(100):\n"", + "" if j in Random_position[0]:\n"", + "" Sequency_X[j] = list(X.iloc[0].values)\n"", + "" elif j in Random_position[1]:\n"", + "" Sequency_X[j] = list(X.iloc[1].values)\n"", + "" elif j in Random_position[2]:\n"", + "" Sequency_X[j] = list(X.iloc[2].values)\n"", + "" elif j in Random_position[3]:\n"", + "" Sequency_X[j] = list(X.iloc[3].values)\n"", + "" elif j in Random_position[4]:\n"", + "" Sequency_X[j] = list(X.iloc[4].values)\n"", + "" elif j in Random_position[5]:\n"", + "" Sequency_X[j] = list(X.iloc[5].values)\n"", + "" \n"", + "" Mix_X_100Block.append(Sequency_X) \n"", + ""\n"", + ""Mix_X_100Block = np.array(Mix_X_100Block)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 18, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""(271, 100, 80)"" + ] + }, + ""execution_count"": 18, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""Mix_X_100Block.shape"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 19, + ""metadata"": { + ""scrolled"": false + }, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""array([[[1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 0, 0, 0],\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" ...,\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 0, 1, 0]],\n"", + ""\n"", + "" [[1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 0, 0, 0],\n"", + "" [1, 1, 0, ..., 0, 0, 0],\n"", + "" ...,\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 1, 0, ..., 0, 0, 0],\n"", + "" [1, 0, 0, ..., 0, 1, 0]],\n"", + ""\n"", + "" [[1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 0, 0, 0],\n"", + "" [1, 0, 0, ..., 0, 0, 0],\n"", + "" ...,\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 0, 0, 0],\n"", + "" [1, 0, 0, ..., 0, 1, 0]],\n"", + ""\n"", + "" ...,\n"", + ""\n"", + "" [[1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" ...,\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0]],\n"", + ""\n"", + "" [[1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" ...,\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0]],\n"", + ""\n"", + "" [[1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" ...,\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0]]], dtype=int64)"" + ] + }, + ""execution_count"": 19, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""Mix_X_100Block"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 20, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""(271, 100, 80, 1)"" + ] + }, + ""execution_count"": 20, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""Mix_X_100Block = Mix_X_100Block.reshape((271, 100, 80, 1))\n"", + ""Mix_X_100Block.shape"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 21, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""X_train, X_test, y_train, y_test = train_test_split(Mix_X_100Block, DF_MRI[Flag]['19F NMR Signal-to-Noise Ratioa'].astype(np.float64), test_size=0.2, random_state=42)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 22, + ""metadata"": { + ""scrolled"": true + }, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 1/200\n"", + ""3/3 [==============================] - 0s 78ms/step - loss: 55.1132 - val_loss: 61.7406\n"", + ""Epoch 2/200\n"", + ""3/3 [==============================] - 0s 8ms/step - loss: 35.6129 - val_loss: 25.4966\n"", + ""Epoch 3/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 35.6771 - val_loss: 25.1937\n"", + ""Epoch 4/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 24.0435 - val_loss: 34.8073\n"", + ""Epoch 5/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 24.7961 - val_loss: 13.9363\n"", + ""Epoch 6/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 16.9952 - val_loss: 14.2570\n"", + ""Epoch 7/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 15.1120 - val_loss: 18.6101\n"", + ""Epoch 8/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 14.6089 - val_loss: 13.3700\n"", + ""Epoch 9/200\n"", + ""3/3 [==============================] - 0s 11ms/step - loss: 13.7384 - val_loss: 13.1898\n"", + ""Epoch 10/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 13.1565 - val_loss: 13.4032\n"", + ""Epoch 11/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 12.5362 - val_loss: 12.6134\n"", + ""Epoch 12/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 12.5933 - val_loss: 12.4806\n"", + ""Epoch 13/200\n"", + ""3/3 [==============================] - 0s 8ms/step - loss: 11.3458 - val_loss: 12.0021\n"", + ""Epoch 14/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 11.3852 - val_loss: 12.2490\n"", + ""Epoch 15/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 10.9804 - val_loss: 11.3535\n"", + ""Epoch 16/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 10.8176 - val_loss: 11.3113\n"", + ""Epoch 17/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 10.5281 - val_loss: 10.9254\n"", + ""Epoch 18/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 9.9987 - val_loss: 11.1933\n"", + ""Epoch 19/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 9.7108 - val_loss: 10.6261\n"", + ""Epoch 20/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 9.7177 - val_loss: 10.7070\n"", + ""Epoch 21/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 10.2088 - val_loss: 11.1493\n"", + ""Epoch 22/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 10.1826 - val_loss: 11.2010\n"", + ""Epoch 23/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 10.4100 - val_loss: 11.4690\n"", + ""Epoch 24/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 9.7019 - val_loss: 10.2258\n"", + ""Epoch 25/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 8.7751 - val_loss: 10.4370\n"", + ""Epoch 26/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 8.6024 - val_loss: 9.7958\n"", + ""Epoch 27/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 8.5763 - val_loss: 9.5445\n"", + ""Epoch 28/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 7.9242 - val_loss: 9.2707\n"", + ""Epoch 29/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 8.1566 - val_loss: 9.6413\n"", + ""Epoch 30/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 7.7475 - val_loss: 9.3038\n"", + ""Epoch 31/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 8.5629 - val_loss: 9.3586\n"", + ""Epoch 32/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 9.3014 - val_loss: 13.5953\n"", + ""Epoch 33/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 10.3651 - val_loss: 10.9025\n"", + ""Epoch 34/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 11.3027 - val_loss: 13.0671\n"", + ""Epoch 35/200\n"", + ""3/3 [==============================] - 0s 15ms/step - loss: 10.7784 - val_loss: 10.2535\n"", + ""Epoch 36/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 12.4632 - val_loss: 8.9919\n"", + ""Epoch 37/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 9.7858 - val_loss: 10.5940\n"", + ""Epoch 38/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 8.5540 - val_loss: 9.2878\n"", + ""Epoch 39/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 7.8363 - val_loss: 13.1918\n"", + ""Epoch 40/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 8.1916 - val_loss: 8.7410\n"", + ""Epoch 41/200\n"", + ""3/3 [==============================] - 0s 11ms/step - loss: 7.6645 - val_loss: 10.1163\n"", + ""Epoch 42/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 8.0659 - val_loss: 8.3214\n"", + ""Epoch 43/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 7.7012 - val_loss: 8.1960\n"", + ""Epoch 44/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 7.1005 - val_loss: 9.7778\n"", + ""Epoch 45/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 7.2435 - val_loss: 8.2281\n"", + ""Epoch 46/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 7.3834 - val_loss: 10.1272\n"", + ""Epoch 47/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 6.9845 - val_loss: 9.2980\n"", + ""Epoch 48/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 6.6060 - val_loss: 8.0436\n"", + ""Epoch 49/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 7.3239 - val_loss: 10.2036\n"", + ""Epoch 50/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 6.9059 - val_loss: 8.2517\n"", + ""Epoch 51/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 7.3699 - val_loss: 9.8332\n"", + ""Epoch 52/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 6.7786 - val_loss: 7.9050\n"", + ""Epoch 53/200\n"", + ""3/3 [==============================] - 0s 8ms/step - loss: 7.4419 - val_loss: 7.6989\n"", + ""Epoch 54/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 7.3290 - val_loss: 10.4379\n"", + ""Epoch 55/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 6.8120 - val_loss: 7.7548\n"", + ""Epoch 56/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 6.4775 - val_loss: 11.0889\n"", + ""Epoch 57/200\n"", + ""3/3 [==============================] - 0s 15ms/step - loss: 6.4128 - val_loss: 7.9045\n"", + ""Epoch 58/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 6.4700 - val_loss: 8.0464\n"", + ""Epoch 59/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 6.1069 - val_loss: 10.4405\n"", + ""Epoch 60/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 6.1325 - val_loss: 7.6182\n"", + ""Epoch 61/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 6.1713 - val_loss: 10.9486\n"", + ""Epoch 62/200\n"", + ""3/3 [==============================] - 0s 8ms/step - loss: 5.9185 - val_loss: 7.7407\n"", + ""Epoch 63/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 6.8473 - val_loss: 10.2653\n"", + ""Epoch 64/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 7.2379 - val_loss: 7.9311\n"", + ""Epoch 65/200\n"", + ""3/3 [==============================] - 0s 11ms/step - loss: 7.2873 - val_loss: 7.5393\n"", + ""Epoch 66/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 7.4343 - val_loss: 11.7283\n"", + ""Epoch 67/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 6.8325 - val_loss: 7.5819\n"", + ""Epoch 68/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 6.2727 - val_loss: 11.5482\n"", + ""Epoch 69/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 6.3171 - val_loss: 7.4769\n"", + ""Epoch 70/200\n"", + ""3/3 [==============================] - 0s 8ms/step - loss: 6.1332 - val_loss: 9.4140\n"", + ""Epoch 71/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 5.9599 - val_loss: 8.5317\n"", + ""Epoch 72/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.5534 - val_loss: 9.0885\n"", + ""Epoch 73/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.7076 - val_loss: 9.7214\n"", + ""Epoch 74/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.5731 - val_loss: 8.0469\n"", + ""Epoch 75/200\n"", + ""3/3 [==============================] - 0s 11ms/step - loss: 5.4338 - val_loss: 10.1474\n"", + ""Epoch 76/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 6.0364 - val_loss: 9.5146\n"", + ""Epoch 77/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.4708 - val_loss: 7.3377\n"", + ""Epoch 78/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 6.9389 - val_loss: 11.1672\n"", + ""Epoch 79/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.5544 - val_loss: 7.3078\n"", + ""Epoch 80/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 6.1388 - val_loss: 11.4811\n"", + ""Epoch 81/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 6.5887 - val_loss: 7.8489\n"", + ""Epoch 82/200\n"", + ""3/3 [==============================] - 0s 11ms/step - loss: 5.2719 - val_loss: 7.6426\n"", + ""Epoch 83/200\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""3/3 [==============================] - 0s 9ms/step - loss: 5.4578 - val_loss: 7.7475\n"", + ""Epoch 84/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 5.0733 - val_loss: 8.6561\n"", + ""Epoch 85/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.1499 - val_loss: 8.3956\n"", + ""Epoch 86/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.2438 - val_loss: 8.6800\n"", + ""Epoch 87/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.1502 - val_loss: 11.9720\n"", + ""Epoch 88/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 6.2550 - val_loss: 7.7170\n"", + ""Epoch 89/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.0665 - val_loss: 8.3836\n"", + ""Epoch 90/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.7524 - val_loss: 9.9179\n"", + ""Epoch 91/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 5.4192 - val_loss: 7.0427\n"", + ""Epoch 92/200\n"", + ""3/3 [==============================] - 0s 8ms/step - loss: 4.9946 - val_loss: 7.7188\n"", + ""Epoch 93/200\n"", + ""3/3 [==============================] - 0s 11ms/step - loss: 4.9759 - val_loss: 10.3665\n"", + ""Epoch 94/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 4.7237 - val_loss: 7.7894\n"", + ""Epoch 95/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 5.0399 - val_loss: 7.6253\n"", + ""Epoch 96/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 5.0962 - val_loss: 8.8615\n"", + ""Epoch 97/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.2285 - val_loss: 8.9574\n"", + ""Epoch 98/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 4.6470 - val_loss: 7.3170\n"", + ""Epoch 99/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 5.0644 - val_loss: 8.0891\n"", + ""Epoch 100/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 4.5447 - val_loss: 7.9742\n"", + ""Epoch 101/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 4.4487 - val_loss: 8.0070\n"", + ""Epoch 102/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 4.5678 - val_loss: 9.1111\n"", + ""Epoch 103/200\n"", + ""3/3 [==============================] - 0s 11ms/step - loss: 4.3822 - val_loss: 7.8812\n"", + ""Epoch 104/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 4.3366 - val_loss: 8.5076\n"", + ""Epoch 105/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.3900 - val_loss: 8.0427\n"", + ""Epoch 106/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 5.0025 - val_loss: 8.1777\n"", + ""Epoch 107/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.6240 - val_loss: 7.5380\n"", + ""Epoch 108/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.8778 - val_loss: 9.8160\n"", + ""Epoch 109/200\n"", + ""3/3 [==============================] - 0s 8ms/step - loss: 4.8482 - val_loss: 7.8084\n"", + ""Epoch 110/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 4.9880 - val_loss: 7.2009\n"", + ""Epoch 111/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 6.1743 - val_loss: 10.8657\n"", + ""Epoch 112/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 5.1290 - val_loss: 7.5379\n"", + ""Epoch 113/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 5.2844 - val_loss: 6.9567\n"", + ""Epoch 114/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.5298 - val_loss: 10.2664\n"", + ""Epoch 115/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 4.7229 - val_loss: 7.9983\n"", + ""Epoch 116/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 4.0152 - val_loss: 7.1050\n"", + ""Epoch 117/200\n"", + ""3/3 [==============================] - 0s 8ms/step - loss: 4.7022 - val_loss: 7.5060\n"", + ""Epoch 118/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 4.6489 - val_loss: 8.4576\n"", + ""Epoch 119/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 4.7429 - val_loss: 8.5231\n"", + ""Epoch 120/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.3443 - val_loss: 7.5202\n"", + ""Epoch 121/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 5.0925 - val_loss: 7.1736\n"", + ""Epoch 122/200\n"", + ""3/3 [==============================] - 0s 15ms/step - loss: 4.5587 - val_loss: 9.4163\n"", + ""Epoch 123/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.7314 - val_loss: 8.8685\n"", + ""Epoch 124/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.9334 - val_loss: 7.3760\n"", + ""Epoch 125/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.3238 - val_loss: 8.8063\n"", + ""Epoch 126/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 4.1700 - val_loss: 8.1154\n"", + ""Epoch 127/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 4.0905 - val_loss: 6.9698\n"", + ""Epoch 128/200\n"", + ""3/3 [==============================] - 0s 11ms/step - loss: 4.0293 - val_loss: 6.7952\n"", + ""Epoch 129/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 3.9883 - val_loss: 10.7443\n"", + ""Epoch 130/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.0012 - val_loss: 8.1830\n"", + ""Epoch 131/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.7851 - val_loss: 6.5721\n"", + ""Epoch 132/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.6754 - val_loss: 7.8553\n"", + ""Epoch 133/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.6058 - val_loss: 11.5591\n"", + ""Epoch 134/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.9555 - val_loss: 7.3291\n"", + ""Epoch 135/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.0018 - val_loss: 8.6628\n"", + ""Epoch 136/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.8794 - val_loss: 7.2043\n"", + ""Epoch 137/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.3257 - val_loss: 6.9042\n"", + ""Epoch 138/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.1892 - val_loss: 8.7673\n"", + ""Epoch 139/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.2994 - val_loss: 6.9271\n"", + ""Epoch 140/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.1833 - val_loss: 6.4782\n"", + ""Epoch 141/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.5670 - val_loss: 9.0581\n"", + ""Epoch 142/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.2814 - val_loss: 8.1653\n"", + ""Epoch 143/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 3.7618 - val_loss: 8.2288\n"", + ""Epoch 144/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.7856 - val_loss: 7.4704\n"", + ""Epoch 145/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.7249 - val_loss: 7.1695\n"", + ""Epoch 146/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 3.8048 - val_loss: 7.0170\n"", + ""Epoch 147/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 3.8771 - val_loss: 8.8424\n"", + ""Epoch 148/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 4.4437 - val_loss: 10.5606\n"", + ""Epoch 149/200\n"", + ""3/3 [==============================] - 0s 11ms/step - loss: 4.9915 - val_loss: 6.5764\n"", + ""Epoch 150/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.5129 - val_loss: 7.1121\n"", + ""Epoch 151/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.3029 - val_loss: 10.8821\n"", + ""Epoch 152/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.8192 - val_loss: 7.2201\n"", + ""Epoch 153/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.0020 - val_loss: 6.9175\n"", + ""Epoch 154/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 5.1134 - val_loss: 9.0782\n"", + ""Epoch 155/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 4.2145 - val_loss: 6.6936\n"", + ""Epoch 156/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 4.0316 - val_loss: 7.9761\n"", + ""Epoch 157/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 4.1637 - val_loss: 8.6551\n"", + ""Epoch 158/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 4.3734 - val_loss: 6.7919\n"", + ""Epoch 159/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 4.4222 - val_loss: 6.7834\n"", + ""Epoch 160/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 4.9624 - val_loss: 8.6252\n"", + ""Epoch 161/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.7537 - val_loss: 8.2581\n"", + ""Epoch 162/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 4.0000 - val_loss: 7.2804\n"", + ""Epoch 163/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 3.6123 - val_loss: 7.2474\n"", + ""Epoch 164/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 3.6666 - val_loss: 7.3903\n"", + ""Epoch 165/200\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""3/3 [==============================] - 0s 13ms/step - loss: 3.6191 - val_loss: 6.7270\n"", + ""Epoch 166/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 3.8357 - val_loss: 6.9461\n"", + ""Epoch 167/200\n"", + ""3/3 [==============================] - 0s 11ms/step - loss: 3.5480 - val_loss: 9.6997\n"", + ""Epoch 168/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 4.1357 - val_loss: 7.1576\n"", + ""Epoch 169/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.1580 - val_loss: 6.6344\n"", + ""Epoch 170/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 4.4836 - val_loss: 8.4045\n"", + ""Epoch 171/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.2737 - val_loss: 9.6201\n"", + ""Epoch 172/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.6751 - val_loss: 6.4766\n"", + ""Epoch 173/200\n"", + ""3/3 [==============================] - 0s 9ms/step - loss: 4.3684 - val_loss: 6.8412\n"", + ""Epoch 174/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 3.5264 - val_loss: 9.3708\n"", + ""Epoch 175/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 4.4778 - val_loss: 6.6046\n"", + ""Epoch 176/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.6415 - val_loss: 6.3262\n"", + ""Epoch 177/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.9140 - val_loss: 7.9928\n"", + ""Epoch 178/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 3.9600 - val_loss: 7.7114\n"", + ""Epoch 179/200\n"", + ""3/3 [==============================] - 0s 11ms/step - loss: 3.8382 - val_loss: 6.7087\n"", + ""Epoch 180/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 3.5010 - val_loss: 7.6062\n"", + ""Epoch 181/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 3.5898 - val_loss: 7.4408\n"", + ""Epoch 182/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.6990 - val_loss: 6.2965\n"", + ""Epoch 183/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 4.4077 - val_loss: 8.9591\n"", + ""Epoch 184/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.4220 - val_loss: 7.5072\n"", + ""Epoch 185/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.4401 - val_loss: 6.6694\n"", + ""Epoch 186/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.7229 - val_loss: 7.8236\n"", + ""Epoch 187/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.3192 - val_loss: 8.8004\n"", + ""Epoch 188/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.5694 - val_loss: 7.2012\n"", + ""Epoch 189/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.3601 - val_loss: 6.8746\n"", + ""Epoch 190/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.9659 - val_loss: 7.2267\n"", + ""Epoch 191/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 4.0987 - val_loss: 7.2944\n"", + ""Epoch 192/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 3.8788 - val_loss: 8.6674\n"", + ""Epoch 193/200\n"", + ""3/3 [==============================] - 0s 10ms/step - loss: 3.6028 - val_loss: 7.1226\n"", + ""Epoch 194/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.0238 - val_loss: 7.3223\n"", + ""Epoch 195/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 3.2975 - val_loss: 7.4944\n"", + ""Epoch 196/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.3829 - val_loss: 6.8372\n"", + ""Epoch 197/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.2190 - val_loss: 6.5857\n"", + ""Epoch 198/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.6193 - val_loss: 7.9778\n"", + ""Epoch 199/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.6883 - val_loss: 8.7285\n"", + ""Epoch 200/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 3.5134 - val_loss: 6.4646\n"" + ] + } + ], + ""source"": [ + ""model = Sequential()\n"", + ""model.add(Conv2D(8, (10, 10), activation='relu', input_shape=X_train.shape[1:]))\n"", + ""model.add(Conv2D(8, (4, 4), activation='relu'))\n"", + ""model.add(Conv2D(8, (3, 3), activation='relu'))\n"", + ""model.add(MaxPooling2D(pool_size=(2, 2)))\n"", + ""model.add(Dropout(0.3))\n"", + ""model.add(Flatten())\n"", + ""model.add(Dense(1))\n"", + ""optimizer=keras.optimizers.Adam(lr=0.005)\n"", + ""model.compile(optimizer=optimizer, loss='mean_absolute_error')\n"", + ""Model=model.fit(x=X_train,y=y_train,epochs=200,\n"", + "" batch_size=64,validation_split=0.2)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 46, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""image/png"": ""iVBORw0KGgoAAAANSUhEUgAAAZYAAAEUCAYAAAAIgBBFAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAABbOUlEQVR4nO2dd3xUVfr/32dmMpOEhFACBJDeFKUJukZFgyj2lf2q66q7WNaCq67dtaDiguh3FcUu7tpY3Z9li+vXrkhASdy1UKRIkd4hJBPSJsnM+f1xC3cmk0amBPK8X695zcw9tzz33HvP55znOedcpbVGEARBEGKFK9kGCIIgCIcWIiyCIAhCTBFhEQRBEGKKCIsgCIIQU0RYBEEQhJgiwiIIgiDElIQLi1Kqs1JKR/n83UxXSql7lVKblFIVSqnPlFKHJ9pOQRAE4cDwJOGYI8zvCcA+x/Ii8/t+4C7gD8AGYAowVyk1VGvtT5SRgiAIwoGRDGEZDuzUWn8WmaCUygRuB6ZqrZ8yl30JbAR+CzyeSEMFQRCE5pMsYVlaT9pxQAbwnrVAa12slJoPnEEjwpKdna379u1bb3p5eTnt2rVrrr0JRWyMDa3dxtZuH4iNseJgsPG7777bo7XuErMdaq0T+gG+Bb4CCoAqYAtwB6CA6wENeCO2eRLY0Ni+R48erRti3rx5Daa3BsTG2NDabWzt9mktNsaKg8FG4Fsdw3Je6QTOFaaUcmPEVcoxXF4bgbOBW4EHgRrgAa11asR204Hfaa07RdnnNcA1AN26dRv95ptv1nv8srIyMjIyYnMycUJsjA2t3cbWbh+IjbHiYLBx3Lhx32mtx8Rsh7FUqcY+gBs4BRgYsfx5DLG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t66+tZWl5OSGM2uzwdu3I8jS/+BmZkcGsQYOatc3FF1/Mq6++ytKlSxk+fDgA69at49tvv+WPf/wjl1xyCcuWLeORRx6he/fu/Oc//2HKlClkZ2czc+bMZtsYjRdffJFrr72W3/3udzz00EMsXryYBx54gPXr1/P6668TCoU499xz6dOnD2+99RbBYJD777+fs88+mw0bNqCUajDdKt9aCwkXFqWUB3gZeBT4hSPpOCADeM9aoLUuVkrNB85AhEUQDlr8tbWEzN8h8/+BCMuBMH78eLp168Y777xjC8vbb79NdnY2Y8eO5YknnuCFF17gjDPOACAvL4+CggLmz58fk+MHg0GmTJnCr371K5599lkAJkyYQFZWFpMnT+bOO++ka9eurFmzhgcffJDTTz8dgN69e/O3v/2NsrIyKisrG0zPymqxUyemJKPF8gfACzxMuLAMNr9/ilh/HXBeSw8qsxsLQstobkvBSaHfz/glS6gOhfC6XLwxdCi5CSoM3W43v/zlL3nnnXeYNm0aYAjLBRdcQEZGBp9++ikAGzZsYPXq1SxbtowVK1aQmpoak+P/+OOP7N69mwsvvDBs+a9+9SsmT57MggUL+N3vfsfgwYO5+uqr+fzzzznrrLM4/fTTmTFjBgCZmZkNprc2EiosSqkjgHuB8VrraqWUM7k9ENBaV0dsts9Mq2+f1wDXAHTr1o38/Pyo661duxaAJUuWtDp1d1JWVlbvObQWxMaW09rty8zMjOn+crOymDtiBPklJeR16JAwUbG45JJLePrpp/nhhx9IS0tj0aJFPPnkkwC899573HLLLaxbt47s7GzGjBlDenp6zLwbxcXFgFE+OcnKysLn81FaWorL5eLzzz9n6tSpvPvuu7z88sukpaUxefJkHnvssSalN0ZC7zetdUI+GK7VhcDTjmWLgVfN3/cAlVG2mw7sacoxRo8erevjhx9+0IB+++23612nNTBv3rxkm9AoYmPLae32ffvtt8k2Ieb069dPP/DAA3rGjBm6V69eOhQK6dWrV2uv16uvvvpqvXnzZnvdCy+8UB955JH2f0A/+uijTT7WK6+8ogG9e/duvXz5cg3of/zjH2HrFBcXa0C/8MILYcuDwaBeuHChvuKKKzSg33zzzWalR6Ox6wl8q2NY3ieyV9iNQG/gPqWUx4y1gNHL2AP4AZ9SKiViu0wzrUVIjEUQ2jYXX3wxH3zwAf/85z+56KKLUErx/fffU11dzV133cVhhx0GQHl5OV999ZVVsW0xQ4YMITs7m3feeSds+VtvvQXACSecwNKlS+nevTvff/89LpeL448/nj//+c94PB42bdrUaHprI5GusF8AhwHFEctHAJOAawEF9ANWO9L7A6taenARFkFo21xyySU8/PDDgNFLC2DUqFG43W7+8Ic/cN1117Fnzx4ee+wxduzYgc/ni8lx3W43DzzwADfeeCOdOnXivPPOY+nSpTzwwANceOGFHHXUUdTW1tK+fXsmTZrE1KlT6dSpE6+99houl4uzzz6bwYMHN5je2khki+Va4JiIz2rgffP3m0AVMNHaQCnVETgZmNvSg0vwXhDaNkceeSTDhg1j8ODBjBo1CoDBgwczZ84cli5dyllnncWdd97JMcccw3PPPcemTZvYtm1bTI59ww038NJLLzFv3jzOPfdcnnnmGW677TbeeOMNwCifPvzwQwYNGsR1113H2WefzY8//sj777/P0KFDG01vbSSsxaK1rtPqUEpVAkVa62/N/08D05RSIQzRuRcoBf7S0uNLi0UQhCVLltRZdskll3DJJZfUWT558mT7d3PdYpdffjmXX3552LIrr7ySK6+8st5tBgwYwL/+9a8DTm9NJGWAZAPcg9HN/XaMMS0FwGVaa4mxCIKQdEKhEKFQqMF1lFKtbsBioknqJJRa65Fa68sd/2u11ndprXO01hla6wla6x9jcSwRFkEQWsqVV15JSkpKg5/x48cn28yk09paLHFDhEUQhJYydepUbrjhhgbXifUYoIORNiMsErwXBKGl9O3bl759+ybbjFZPm3kfi7RYBKF5NBZLEA4OknEdRVgEQaiD1+uloqIi2WYIMaCiogKv15vQY4qwCIJQh549e7JmzRrKysqk5XKQEgqFKCsr46effqJnz54JPXabi7GIsAhC43Tq1IkVK1awfv16qqsj54UVDha8Xi+9evWiU6dOCT1umxEWeTWxIDSP2tpahg0blmwzGiQ/P5+8vLxkm9EgB4ONsabNuMKs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tNav2Au/xrYAFyH8Qrf+4DdwJl6//t1vgN+wJiN92mMqczXAxO18XIna/+XKeOV0Bbnaq23mek9gZlKqfbaeDnUicCD2nyroxnsvxVj0sC9Lc8KQWgZIiyCYPAVxsutohFw/H7T+qG13q2UKgTGmotOAv6fdrxLXGu9Qim1FONdF08Dx5vrBB3rPIPxyliM14uw0RIVkw3mdweMVz58CfxRKTUc+AD4UGt9B4LQShBhEQQDv9b62/oSzQK/SmtdEpG0Gxhi/u6IMQ16JDsx3iYIxrTvuxqxpSLiv/WOcct1fRFwP/BLDJdcjVLqTeBarXVlI/sWhLgjMRZBaDqpSqn0iGVd2S8Ue4Fu1CUHKDJ/+4GwVz4rpToppU6Lsu+oaK33aq1v1lr3AEZhvCXw1xgxGUFIOiIsgtA8zrF+mEH7XGCeuegr4DyllNexzhHAMIxxMmC8aO5M893yFhcB72O8IbFBlFLZSqlNSqn/AdBaLzbdYBuB3gd8VoIQQ8QVJggGHZRSx9WT5nf8flYplYnhArsfo5Xygpn2EIZwfKSUegLIAqZjxEheM9eZgREj+btS6kWMNwk+BDyjtd5nutzqRWu9Rym1BnjS7Gm2GTgb6IPxml5BSDoiLIJgcAJQWE/aXIwuvmD0vnoQwwU2F7hAa+0H0Fp/p5Q6BXgYeAfjlbMfAndqrfeZ63ytlJqAITDvYsRfnsIQl6ZyMfAoxnvLOwGrgEu11p83Yx+CEDfk1cSC0ASUUpcDrwBdtNZ7kmyOILRqJMYiCIIgxBQRFkEQBCGmiCtMEARBiCnSYhEEQRBiigiLIAiCEFNEWARBEISYIsIiCIIgxBQRFkEQBCGm/H+gtoF0T88ldwAAAABJRU5ErkJggg==\n"", + ""text/plain"": [ + ""
"" + ] + }, + ""metadata"": { + ""needs_background"": ""light"" + }, + ""output_type"": ""display_data"" + } + ], + ""source"": [ + ""loss = Model.history['loss']\n"", + ""val_loss = Model.history['val_loss']\n"", + ""epochs = len(loss)\n"", + ""plt.xlim((-5, 200))\n"", + ""plt.plot(range(epochs), loss, color = 'k', marker = '.', label = 'loss')\n"", + ""plt.plot(range(epochs), val_loss, color = 'c', marker = '.', label = 'val_loss')\n"", + ""plt.xticks(fontname=\""Arial\"", fontsize=16, fontweight='normal')\n"", + ""plt.yticks(fontname=\""Arial\"", fontsize=16, fontweight='normal')\n"", + ""plt.legend(loc = 'best', framealpha=1, prop={'size': 16, 'family':\""Arial\""})\n"", + ""\n"", + ""plt.grid()\n"", + ""plt.xlabel('Epochs',fontname=\""Arial\"", fontsize=16)\n"", + ""plt.ylabel('Loss',fontname=\""Arial\"", fontsize=16)\n"", + ""plt.savefig(\""CNN_Loss.png\"", dpi=600, bbox_inches='tight')\n"", + ""plt.show()"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 33, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""filepath = 'MRI_CNN.model'\n"", + ""save_model(model, filepath, save_format='h5')"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 25, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""model = load_model('MRI_CNN.model')"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 26, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Train set R^2: 0.91\n"", + ""Train MAE score: 3.73\n"", + ""Train RMSE score: 6.76\n"", + ""Test set R^2: 0.77\n"", + ""Test MAE score: 8.21\n"", + ""Test RMSE score: 11.33\n"" + ] + } + ], + ""source"": [ + ""y_pred_train = model.predict(X_train)\n"", + ""y_pred_test = model.predict(X_test)\n"", + ""\n"", + ""print(\""Train set R^2: %.2f\"" % r2_score(y_train, y_pred_train))\n"", + ""print(\""Train MAE score: %.2f\"" % mean_absolute_error(y_train, y_pred_train))\n"", + ""print(\""Train RMSE score: %.2f\"" % np.sqrt(mean_squared_error(y_train, y_pred_train)))\n"", + ""\n"", + ""print(\""Test set R^2: %.2f\"" % r2_score(y_test, y_pred_test))\n"", + ""print(\""Test MAE score: %.2f\"" % mean_absolute_error(y_test, y_pred_test))\n"", + ""print(\""Test RMSE score: %.2f\"" % np.sqrt(mean_squared_error(y_test, y_pred_test)))"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 36, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""image/png"": ""iVBORw0KGgoAAAANSUhEUgAAANwAAADdCAYAAADQBhwkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAup0lEQVR4nO2deXhU1fnHP+9MyAIhZE8IhC2EEBYBCTsoCtRdEBWXsrgVFW0ripXWX/dWpWK1tmi17uAGKii4VqXKZjCyJxACgRACIQlkX8nM+f1xJyEJk2QSM5PM5HyeJ0/uPffec8/NzDfn3Pe873tEKYVGo3ENpvZugEbTmdCC02hciBacRuNCtOA0GheiBafRuBAtOI3GhWjBaTQuRAuugyIiF4tImYhMaVB+m4gcE5FHRaRYRH4pIi+LyHLbcS8RuVdETorI8CbqjxOR5SJyp4jcISKvi8gEEXlWRDaIiNjO6yUi74vIRSKyUEQOiUio7Vg3EXlcRO4WEbMz/x4eg1JK/3TQH+BjYG2DslXA/2zb2bbfXkABMMK23w/4rol6Q4E9QI86ZdfZrusHHAf+VOfYbXW2NwNfA2bb/lSgX3v/rdzlR/dwHZsPgBEiEgMgIlOB/9k5LwqoBrIcrHc+8L1SqrBO2Tog27b9c+BmEZlp59qXgXzgSQfvpamDFlzHxgI8Bzxg25+E0cPU0E1EHgRWAxOUUnkO1jsIOFm3QBlU2HbzMXq8FSIyuMG1CkOw00XkVkcfRGOgBdfx+Q9wg4iMBg41OCbAsxifY68W1HkciGjqBKVUMnA/Ri8b0OBYKTALeAIY0YL7dnq04Do4tmHfGuDfGF/+hsergduA50UkoOHxRngd+ImIhNcUiMhAEenZoO51wLvAfXbumw7cDjzm4D01aMF1WERkLHC1TQT/wBAdwAxgg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uRAtOo3EhWnAajQvRgtNoXMj/A1UrhQsNyCWUAAAAAElFTkSuQmCC\n"", + ""text/plain"": [ + ""
"" + ] + }, + ""metadata"": { + ""needs_background"": ""light"" + }, + ""output_type"": ""display_data"" + } + ], + ""source"": [ + ""plt.figure(figsize=(3,3))\n"", + ""\n"", + ""ax=plt.subplot(1, 1, 1)\n"", + ""plt.scatter(y_train, y_pred_train, c='#1f77b4', marker='o', s = 18, edgecolors='k', linewidths = 0.2)\n"", + ""plt.scatter(y_test, y_pred_test, c='#ff7f0e', marker='o', s = 18, edgecolors='k', linewidths = 0.2) \n"", + ""\n"", + ""plt.xlabel(\""Experiment\"",fontname=\""Times New Roman\"", fontsize=10)\n"", + ""plt.ylabel(\""Prediction\"",fontname=\""Times New Roman\"", fontsize=10)\n"", + ""x0, x1 = min(y_train), max(y_train)\n"", + ""length = 750\n"", + ""x_start, x_end = -200, 550\n"", + ""plt.xlim([-0, 150])\n"", + ""plt.ylim([-0, 150])\n"", + ""# ax.set_xticks([-200,-100,0,100,200,300,400,500])\n"", + ""# ax.set_yticks([-200,-100,0,100,200,300,400,500])\n"", + ""plt.xticks(fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""plt.yticks(fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""plt.gca().set_aspect(\""equal\"", adjustable=\""box\"")\n"", + ""# the unit line\n"", + ""plt.plot(np.arange(x_start, x_end, 0.01*length),\n"", + ""np.arange(x_start, x_end, 0.01*length), '#d62728')\n"", + ""plt.text(80, 25, \""Train $R^2={:.2f}$\"".format(round(r2_score(y_train, y_pred_train),2)),{'color':'#1f77b4'}, fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""plt.text(80, 12, \""Test $R^2 ={:.2f}$\"".format(r2_score(y_test, y_pred_test)),{'color':'#ff7f0e'}, fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""#plt.text(80, 500, \""Dataset_1\"")\n"", + ""plt.title('MRI_CNN',fontname=\""Times New Roman\"", fontsize=10)\n"", + ""plt.savefig(\""Polyinfo_MRI_CNN.png\"", dpi=1200, bbox_inches='tight') "" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### Data Fusion"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 23, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""Mix_X = []\n"", + ""for i in range(len(DF_MRI[Flag])):\n"", + "" Mix_X.append(X.iloc[0].values * DF_MRI[Flag]['TFEA'].iloc[i] + \\\n"", + "" X.iloc[1].values * DF_MRI[Flag]['HexaFOEA'].iloc[i] + \\\n"", + "" X.iloc[2].values * DF_MRI[Flag]['NonaFOEA'].iloc[i] + \\\n"", + "" X.iloc[3].values * DF_MRI[Flag]['PEGA'].iloc[i] + \\\n"", + "" X.iloc[4].values * DF_MRI[Flag]['HEA'].iloc[i] + \\\n"", + "" X.iloc[5].values * DF_MRI[Flag]['MSEA'].iloc[i])\n"", + ""Mix_X = np.array(Mix_X)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 24, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""(271, 80)"" + ] + }, + ""execution_count"": 24, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""Mix_X.shape"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 25, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""Mix_X_100Block = []\n"", + ""for i in range(len(DF_MRI[Flag])):\n"", + "" random.seed(10)\n"", + ""\n"", + "" Random_position = []\n"", + "" Random_position_all = []\n"", + ""\n"", + "" Rest = range(0, 100)\n"", + "" for col in ['TFEA', 'HexaFOEA', 'NonaFOEA', 'PEGA', 'HEA', 'MSEA']:\n"", + ""\n"", + "" X_random_position = random.sample(Rest, int(DF_MRI[Flag][col].iloc[i] * 100))\n"", + "" Random_position.append(X_random_position)\n"", + "" for p in X_random_position:\n"", + "" Random_position_all.append(p)\n"", + "" Rest = []\n"", + "" for x in range(0, 100):\n"", + "" if x not in Random_position_all:\n"", + "" Rest.append(x)\n"", + "" \n"", + "" Sequency_X = [0 for a in range(100)]\n"", + "" for j in range(100):\n"", + "" if j in Random_position[0]:\n"", + "" Sequency_X[j] = 0\n"", + "" elif j in Random_position[1]:\n"", + "" Sequency_X[j] = 1\n"", + "" elif j in Random_position[2]:\n"", + "" Sequency_X[j] = 2\n"", + "" elif j in Random_position[3]:\n"", + "" Sequency_X[j] = 3\n"", + "" elif j in Random_position[4]:\n"", + "" Sequency_X[j] = 4\n"", + "" elif j in Random_position[5]:\n"", + "" Sequency_X[j] = 5\n"", + "" \n"", + "" Mix_X_100Block.append(Sequency_X) \n"", + ""\n"", + ""Mix_X_100Block = np.array(Mix_X_100Block)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 26, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""(271, 100)"" + ] + }, + ""execution_count"": 26, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""Mix_X_100Block.shape"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 27, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""(271, 100, 1)"" + ] + }, + ""execution_count"": 27, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""Mix_X_100Block = Mix_X_100Block.reshape((271, 100, 1))\n"", + ""Mix_X_100Block.shape"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 28, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""from keras.layers import Input, Dense\n"", + ""from keras.models import Model\n"", + ""from keras.utils import plot_model\n"", + ""from keras.layers.merge import Concatenate\n"", + ""from numpy.random import seed\n"", + ""import tensorflow"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 29, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""LSTMunits = 20"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 30, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 1/300\n"", + ""7/7 - 1s - loss: 5120.5601 - mean_squared_error: 5120.5601 - val_loss: 5402.3750 - val_mean_squared_error: 5402.3750\n"", + ""Epoch 2/300\n"", + ""7/7 - 0s - loss: 4305.8198 - mean_squared_error: 4305.8198 - val_loss: 3963.5012 - val_mean_squared_error: 3963.5012\n"", + ""Epoch 3/300\n"", + ""7/7 - 0s - loss: 2693.9287 - mean_squared_error: 2693.9287 - val_loss: 1924.7507 - val_mean_squared_error: 1924.7509\n"", + ""Epoch 4/300\n"", + ""7/7 - 0s - loss: 985.7461 - mean_squared_error: 985.7461 - val_loss: 624.9214 - val_mean_squared_error: 624.9214\n"", + ""Epoch 5/300\n"", + ""7/7 - 0s - loss: 552.6452 - mean_squared_error: 552.6452 - val_loss: 726.8588 - val_mean_squared_error: 726.8588\n"", + ""Epoch 6/300\n"", + ""7/7 - 0s - loss: 664.6360 - mean_squared_error: 664.6360 - val_loss: 595.7104 - val_mean_squared_error: 595.7104\n"", + ""Epoch 7/300\n"", + ""7/7 - 0s - loss: 494.2893 - mean_squared_error: 494.2893 - val_loss: 655.4172 - val_mean_squared_error: 655.4172\n"", + ""Epoch 8/300\n"", + ""7/7 - 0s - loss: 519.1539 - mean_squared_error: 519.1539 - val_loss: 673.0013 - val_mean_squared_error: 673.0013\n"", + ""Epoch 9/300\n"", + ""7/7 - 0s - loss: 505.3344 - mean_squared_error: 505.3344 - val_loss: 612.4034 - val_mean_squared_error: 612.4034\n"", + ""Epoch 10/300\n"", + ""7/7 - 0s - loss: 490.1410 - mean_squared_error: 490.1410 - val_loss: 595.1727 - val_mean_squared_error: 595.1727\n"", + ""Epoch 11/300\n"", + ""7/7 - 0s - loss: 493.8121 - mean_squared_error: 493.8121 - val_loss: 598.0035 - val_mean_squared_error: 598.0035\n"", + ""Epoch 12/300\n"", + ""7/7 - 0s - loss: 490.0060 - mean_squared_error: 490.0060 - val_loss: 597.9254 - val_mean_squared_error: 597.9254\n"", + ""Epoch 13/300\n"", + ""7/7 - 0s - loss: 488.9525 - mean_squared_error: 488.9525 - val_loss: 603.7487 - val_mean_squared_error: 603.7487\n"", + ""Epoch 14/300\n"", + ""7/7 - 0s - loss: 486.8390 - mean_squared_error: 486.8390 - val_loss: 599.8319 - val_mean_squared_error: 599.8319\n"", + ""Epoch 15/300\n"", + ""7/7 - 0s - loss: 485.9010 - mean_squared_error: 485.9010 - val_loss: 596.8120 - val_mean_squared_error: 596.8120\n"", + ""Epoch 16/300\n"", + ""7/7 - 0s - loss: 484.4076 - mean_squared_error: 484.4076 - val_loss: 599.2076 - val_mean_squared_error: 599.2076\n"", + ""Epoch 17/300\n"", + ""7/7 - 0s - loss: 483.2690 - mean_squared_error: 483.2690 - val_loss: 594.4239 - val_mean_squared_error: 594.4239\n"", + ""Epoch 18/300\n"", + ""7/7 - 0s - loss: 481.5271 - mean_squared_error: 481.5271 - val_loss: 592.0013 - val_mean_squared_error: 592.0013\n"", + ""Epoch 19/300\n"", + ""7/7 - 0s - loss: 479.4482 - mean_squared_error: 479.4482 - val_loss: 586.4079 - val_mean_squared_error: 586.4079\n"", + ""Epoch 20/300\n"", + ""7/7 - 0s - loss: 477.3699 - mean_squared_error: 477.3699 - val_loss: 581.9128 - val_mean_squared_error: 581.9128\n"", + ""Epoch 21/300\n"", + ""7/7 - 0s - loss: 476.8337 - mean_squared_error: 476.8337 - val_loss: 591.5396 - val_mean_squared_error: 591.5396\n"", + ""Epoch 22/300\n"", + ""7/7 - 0s - loss: 472.4358 - mean_squared_error: 472.4358 - val_loss: 578.4905 - val_mean_squared_error: 578.4905\n"", + ""Epoch 23/300\n"", + ""7/7 - 0s - loss: 470.0850 - mean_squared_error: 470.0850 - val_loss: 565.2891 - val_mean_squared_error: 565.2891\n"", + ""Epoch 24/300\n"", + ""7/7 - 0s - loss: 466.5121 - mean_squared_error: 466.5121 - val_loss: 572.7080 - val_mean_squared_error: 572.7080\n"", + ""Epoch 25/300\n"", + ""7/7 - 0s - loss: 462.2154 - mean_squared_error: 462.2154 - val_loss: 560.9772 - val_mean_squared_error: 560.9772\n"", + ""Epoch 26/300\n"", + ""7/7 - 0s - loss: 458.9753 - mean_squared_error: 458.9753 - val_loss: 551.3033 - val_mean_squared_error: 551.3033\n"", + ""Epoch 27/300\n"", + ""7/7 - 0s - loss: 458.4917 - mean_squared_error: 458.4917 - val_loss: 565.8347 - val_mean_squared_error: 565.8347\n"", + ""Epoch 28/300\n"", + ""7/7 - 0s - loss: 446.0135 - mean_squared_error: 446.0135 - val_loss: 536.5608 - val_mean_squared_error: 536.5608\n"", + ""Epoch 29/300\n"", + ""7/7 - 0s - loss: 445.1448 - mean_squared_error: 445.1448 - val_loss: 523.2089 - val_mean_squared_error: 523.2089\n"", + ""Epoch 30/300\n"", + ""7/7 - 0s - loss: 433.5306 - mean_squared_error: 433.5306 - val_loss: 537.4994 - val_mean_squared_error: 537.4994\n"", + ""Epoch 31/300\n"", + ""7/7 - 0s - loss: 428.1499 - mean_squared_error: 428.1499 - val_loss: 520.9312 - val_mean_squared_error: 520.9312\n"", + ""Epoch 32/300\n"", + ""7/7 - 0s - loss: 422.1779 - mean_squared_error: 422.1779 - val_loss: 497.7851 - val_mean_squared_error: 497.7851\n"", + ""Epoch 33/300\n"", + ""7/7 - 0s - loss: 416.9174 - mean_squared_error: 416.9174 - val_loss: 501.9168 - val_mean_squared_error: 501.9168\n"", + ""Epoch 34/300\n"", + ""7/7 - 0s - loss: 402.0359 - mean_squared_error: 402.0359 - val_loss: 478.7645 - val_mean_squared_error: 478.7645\n"", + ""Epoch 35/300\n"", + ""7/7 - 0s - loss: 395.3468 - mean_squared_error: 395.3468 - val_loss: 466.8650 - val_mean_squared_error: 466.8650\n"", + ""Epoch 36/300\n"", + ""7/7 - 0s - loss: 387.9481 - mean_squared_error: 387.9481 - val_loss: 475.1683 - val_mean_squared_error: 475.1683\n"", + ""Epoch 37/300\n"", + ""7/7 - 0s - loss: 375.1544 - mean_squared_error: 375.1544 - val_loss: 447.6487 - val_mean_squared_error: 447.6487\n"", + ""Epoch 38/300\n"", + ""7/7 - 0s - loss: 366.2085 - mean_squared_error: 366.2085 - val_loss: 424.3243 - val_mean_squared_error: 424.3243\n"", + ""Epoch 39/300\n"", + ""7/7 - 0s - loss: 358.4303 - mean_squared_error: 358.4303 - val_loss: 431.9589 - val_mean_squared_error: 431.9589\n"", + ""Epoch 40/300\n"", + ""7/7 - 0s - loss: 345.3439 - mean_squared_error: 345.3439 - val_loss: 403.5297 - val_mean_squared_error: 403.5297\n"", + ""Epoch 41/300\n"", + ""7/7 - 0s - loss: 333.0556 - mean_squared_error: 333.0556 - val_loss: 391.7896 - val_mean_squared_error: 391.7896\n"", + ""Epoch 42/300\n"", + ""7/7 - 0s - loss: 324.1967 - mean_squared_error: 324.1967 - val_loss: 389.9625 - val_mean_squared_error: 389.9625\n"", + ""Epoch 43/300\n"", + ""7/7 - 0s - loss: 311.0494 - mean_squared_error: 311.0494 - val_loss: 362.6760 - val_mean_squared_error: 362.6760\n"", + ""Epoch 44/300\n"", + ""7/7 - 0s - loss: 300.7639 - mean_squared_error: 300.7639 - val_loss: 352.1501 - val_mean_squared_error: 352.1501\n"", + ""Epoch 45/300\n"", + ""7/7 - 0s - loss: 289.7800 - mean_squared_error: 289.7800 - val_loss: 335.0811 - val_mean_squared_error: 335.0811\n"", + ""Epoch 46/300\n"", + ""7/7 - 0s - loss: 279.4926 - mean_squared_error: 279.4926 - val_loss: 330.5505 - val_mean_squared_error: 330.5505\n"", + ""Epoch 47/300\n"", + ""7/7 - 0s - loss: 271.3362 - mean_squared_error: 271.3362 - val_loss: 307.2222 - val_mean_squared_error: 307.2222\n"", + ""Epoch 48/300\n"", + ""7/7 - 0s - loss: 261.8825 - mean_squared_error: 261.8825 - val_loss: 302.9348 - val_mean_squared_error: 302.9348\n"", + ""Epoch 49/300\n"", + ""7/7 - 0s - loss: 253.1969 - mean_squared_error: 253.1969 - val_loss: 289.2873 - val_mean_squared_error: 289.2873\n"", + ""Epoch 50/300\n"", + ""7/7 - 0s - loss: 245.5780 - mean_squared_error: 245.5780 - val_loss: 274.7187 - val_mean_squared_error: 274.7187\n"", + ""Epoch 51/300\n"", + ""7/7 - 0s - loss: 239.3461 - mean_squared_error: 239.3461 - val_loss: 271.0551 - val_mean_squared_error: 271.0551\n"", + ""Epoch 52/300\n"", + ""7/7 - 0s - loss: 233.2993 - mean_squared_error: 233.2993 - val_loss: 258.3247 - val_mean_squared_error: 258.3247\n"", + ""Epoch 53/300\n"", + ""7/7 - 0s - loss: 227.0636 - mean_squared_error: 227.0636 - val_loss: 253.0090 - val_mean_squared_error: 253.0090\n"", + ""Epoch 54/300\n"", + ""7/7 - 0s - loss: 224.1087 - mean_squared_error: 224.1087 - val_loss: 241.0185 - val_mean_squared_error: 241.0185\n"", + ""Epoch 55/300\n"", + ""7/7 - 0s - loss: 219.7286 - mean_squared_error: 219.7286 - val_loss: 244.9673 - val_mean_squared_error: 244.9673\n"", + ""Epoch 56/300\n"", + ""7/7 - 0s - loss: 214.3699 - mean_squared_error: 214.3699 - val_loss: 226.6876 - val_mean_squared_error: 226.6876\n"", + ""Epoch 57/300\n"", + ""7/7 - 0s - loss: 211.5411 - mean_squared_error: 211.5411 - val_loss: 223.2033 - val_mean_squared_error: 223.2033\n"", + ""Epoch 58/300\n"", + ""7/7 - 0s - loss: 208.4883 - mean_squared_error: 208.4883 - val_loss: 221.0153 - val_mean_squared_error: 221.0153\n"", + ""Epoch 59/300\n"", + ""7/7 - 0s - loss: 206.9834 - mean_squared_error: 206.9834 - val_loss: 221.6636 - val_mean_squared_error: 221.6636\n"", + ""Epoch 60/300\n"", + ""7/7 - 0s - loss: 205.8920 - mean_squared_error: 205.8920 - val_loss: 208.4613 - val_mean_squared_error: 208.4613\n"", + ""Epoch 61/300\n"", + ""7/7 - 0s - loss: 202.2660 - mean_squared_error: 202.2660 - val_loss: 209.5345 - val_mean_squared_error: 209.5345\n"", + ""Epoch 62/300\n"", + ""7/7 - 0s - loss: 200.9126 - mean_squared_error: 200.9126 - val_loss: 211.6800 - val_mean_squared_error: 211.6800\n"", + ""Epoch 63/300\n"", + ""7/7 - 0s - loss: 199.6952 - mean_squared_error: 199.6953 - val_loss: 199.7033 - val_mean_squared_error: 199.7033\n"", + ""Epoch 64/300\n"", + ""7/7 - 0s - loss: 201.8459 - mean_squared_error: 201.8459 - val_loss: 200.6841 - val_mean_squared_error: 200.6841\n"", + ""Epoch 65/300\n"", + ""7/7 - 0s - loss: 202.6158 - mean_squared_error: 202.6158 - val_loss: 207.0813 - val_mean_squared_error: 207.0813\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 66/300\n"", + ""7/7 - 0s - loss: 194.8005 - mean_squared_error: 194.8005 - val_loss: 189.4932 - val_mean_squared_error: 189.4932\n"", + ""Epoch 67/300\n"", + ""7/7 - 0s - loss: 200.3340 - mean_squared_error: 200.3340 - val_loss: 187.4031 - val_mean_squared_error: 187.4031\n"", + ""Epoch 68/300\n"", + ""7/7 - 0s - loss: 198.4619 - mean_squared_error: 198.4619 - val_loss: 207.8110 - val_mean_squared_error: 207.8110\n"", + ""Epoch 69/300\n"", + ""7/7 - 0s - loss: 195.1798 - mean_squared_error: 195.1798 - val_loss: 187.3118 - val_mean_squared_error: 187.3118\n"", + ""Epoch 70/300\n"", + ""7/7 - 0s - loss: 195.5942 - mean_squared_error: 195.5942 - val_loss: 185.7527 - val_mean_squared_error: 185.7527\n"", + ""Epoch 71/300\n"", + ""7/7 - 0s - loss: 194.3468 - mean_squared_error: 194.3468 - val_loss: 196.0935 - val_mean_squared_error: 196.0935\n"", + ""Epoch 72/300\n"", + ""7/7 - 0s - loss: 193.9270 - mean_squared_error: 193.9270 - val_loss: 182.5683 - val_mean_squared_error: 182.5683\n"", + ""Epoch 73/300\n"", + ""7/7 - 0s - loss: 192.3940 - mean_squared_error: 192.3940 - val_loss: 187.9758 - val_mean_squared_error: 187.9758\n"", + ""Epoch 74/300\n"", + ""7/7 - 0s - loss: 193.5491 - mean_squared_error: 193.5491 - val_loss: 182.3492 - val_mean_squared_error: 182.3492\n"", + ""Epoch 75/300\n"", + ""7/7 - 0s - loss: 191.9317 - mean_squared_error: 191.9317 - val_loss: 188.0846 - val_mean_squared_error: 188.0846\n"", + ""Epoch 76/300\n"", + ""7/7 - 0s - loss: 191.2612 - mean_squared_error: 191.2612 - val_loss: 177.4647 - val_mean_squared_error: 177.4647\n"", + ""Epoch 77/300\n"", + ""7/7 - 0s - loss: 189.4020 - mean_squared_error: 189.4020 - val_loss: 182.4302 - val_mean_squared_error: 182.4302\n"", + ""Epoch 78/300\n"", + ""7/7 - 0s - loss: 189.8303 - mean_squared_error: 189.8303 - val_loss: 181.4644 - val_mean_squared_error: 181.4644\n"", + ""Epoch 79/300\n"", + ""7/7 - 0s - loss: 189.7815 - mean_squared_error: 189.7815 - val_loss: 183.9617 - val_mean_squared_error: 183.9617\n"", + ""Epoch 80/300\n"", + ""7/7 - 0s - loss: 188.2118 - mean_squared_error: 188.2118 - val_loss: 175.3481 - val_mean_squared_error: 175.3481\n"", + ""Epoch 81/300\n"", + ""7/7 - 0s - loss: 189.7039 - mean_squared_error: 189.7039 - val_loss: 172.6949 - val_mean_squared_error: 172.6949\n"", + ""Epoch 82/300\n"", + ""7/7 - 0s - loss: 188.4275 - mean_squared_error: 188.4275 - val_loss: 180.4138 - val_mean_squared_error: 180.4138\n"", + ""Epoch 83/300\n"", + ""7/7 - 0s - loss: 188.7731 - mean_squared_error: 188.7731 - val_loss: 176.9052 - val_mean_squared_error: 176.9052\n"", + ""Epoch 84/300\n"", + ""7/7 - 0s - loss: 190.2996 - mean_squared_error: 190.2996 - val_loss: 173.0763 - val_mean_squared_error: 173.0763\n"", + ""Epoch 85/300\n"", + ""7/7 - 0s - loss: 186.5006 - mean_squared_error: 186.5006 - val_loss: 176.4004 - val_mean_squared_error: 176.4004\n"", + ""Epoch 86/300\n"", + ""7/7 - 0s - loss: 188.7791 - mean_squared_error: 188.7791 - val_loss: 173.5146 - val_mean_squared_error: 173.5146\n"", + ""Epoch 87/300\n"", + ""7/7 - 0s - loss: 189.2987 - mean_squared_error: 189.2987 - val_loss: 183.3730 - val_mean_squared_error: 183.3730\n"", + ""Epoch 88/300\n"", + ""7/7 - 0s - loss: 186.9162 - mean_squared_error: 186.9162 - val_loss: 167.1944 - val_mean_squared_error: 167.1944\n"", + ""Epoch 89/300\n"", + ""7/7 - 0s - loss: 187.9645 - mean_squared_error: 187.9645 - val_loss: 172.0435 - val_mean_squared_error: 172.0435\n"", + ""Epoch 90/300\n"", + ""7/7 - 0s - loss: 187.9471 - mean_squared_error: 187.9471 - val_loss: 177.0269 - val_mean_squared_error: 177.0269\n"", + ""Epoch 91/300\n"", + ""7/7 - 0s - loss: 186.0217 - mean_squared_error: 186.0217 - val_loss: 168.2267 - val_mean_squared_error: 168.2267\n"", + ""Epoch 92/300\n"", + ""7/7 - 0s - loss: 185.3085 - mean_squared_error: 185.3085 - val_loss: 168.7049 - val_mean_squared_error: 168.7049\n"", + ""Epoch 93/300\n"", + ""7/7 - 0s - loss: 185.8090 - mean_squared_error: 185.8090 - val_loss: 170.6693 - val_mean_squared_error: 170.6693\n"", + ""Epoch 94/300\n"", + ""7/7 - 0s - loss: 185.3887 - mean_squared_error: 185.3887 - val_loss: 168.7542 - val_mean_squared_error: 168.7542\n"", + ""Epoch 95/300\n"", + ""7/7 - 0s - loss: 184.6391 - mean_squared_error: 184.6391 - val_loss: 168.1729 - val_mean_squared_error: 168.1729\n"", + ""Epoch 96/300\n"", + ""7/7 - 0s - loss: 187.8034 - mean_squared_error: 187.8034 - val_loss: 164.0567 - val_mean_squared_error: 164.0567\n"", + ""Epoch 97/300\n"", + ""7/7 - 0s - loss: 186.5669 - mean_squared_error: 186.5669 - val_loss: 180.5848 - val_mean_squared_error: 180.5848\n"", + ""Epoch 98/300\n"", + ""7/7 - 0s - loss: 192.0045 - mean_squared_error: 192.0045 - val_loss: 161.3825 - val_mean_squared_error: 161.3825\n"", + ""Epoch 99/300\n"", + ""7/7 - 0s - loss: 182.2392 - mean_squared_error: 182.2392 - val_loss: 173.1969 - val_mean_squared_error: 173.1969\n"", + ""Epoch 100/300\n"", + ""7/7 - 0s - loss: 186.9574 - mean_squared_error: 186.9574 - val_loss: 170.7795 - val_mean_squared_error: 170.7795\n"", + ""Epoch 101/300\n"", + ""7/7 - 0s - loss: 183.2067 - mean_squared_error: 183.2067 - val_loss: 161.5881 - val_mean_squared_error: 161.5881\n"", + ""Epoch 102/300\n"", + ""7/7 - 0s - loss: 185.6269 - mean_squared_error: 185.6269 - val_loss: 165.0497 - val_mean_squared_error: 165.0497\n"", + ""Epoch 103/300\n"", + ""7/7 - 0s - loss: 184.4180 - mean_squared_error: 184.4180 - val_loss: 167.5165 - val_mean_squared_error: 167.5165\n"", + ""Epoch 104/300\n"", + ""7/7 - 0s - loss: 182.1142 - mean_squared_error: 182.1142 - val_loss: 160.0033 - val_mean_squared_error: 160.0033\n"", + ""Epoch 105/300\n"", + ""7/7 - 0s - loss: 181.8075 - mean_squared_error: 181.8075 - val_loss: 164.1715 - val_mean_squared_error: 164.1715\n"", + ""Epoch 106/300\n"", + ""7/7 - 0s - loss: 182.9511 - mean_squared_error: 182.9511 - val_loss: 169.8457 - val_mean_squared_error: 169.8457\n"", + ""Epoch 107/300\n"", + ""7/7 - 0s - loss: 180.3122 - mean_squared_error: 180.3122 - val_loss: 158.7950 - val_mean_squared_error: 158.7950\n"", + ""Epoch 108/300\n"", + ""7/7 - 0s - loss: 182.3932 - mean_squared_error: 182.3932 - val_loss: 157.9228 - val_mean_squared_error: 157.9228\n"", + ""Epoch 109/300\n"", + ""7/7 - 0s - loss: 179.2051 - mean_squared_error: 179.2051 - val_loss: 169.1511 - val_mean_squared_error: 169.1511\n"", + ""Epoch 110/300\n"", + ""7/7 - 0s - loss: 182.7439 - mean_squared_error: 182.7439 - val_loss: 160.4546 - val_mean_squared_error: 160.4546\n"", + ""Epoch 111/300\n"", + ""7/7 - 0s - loss: 183.9044 - mean_squared_error: 183.9044 - val_loss: 155.3454 - val_mean_squared_error: 155.3454\n"", + ""Epoch 112/300\n"", + ""7/7 - 0s - loss: 181.5996 - mean_squared_error: 181.5996 - val_loss: 169.8599 - val_mean_squared_error: 169.8599\n"", + ""Epoch 113/300\n"", + ""7/7 - 0s - loss: 179.1149 - mean_squared_error: 179.1149 - val_loss: 156.4216 - val_mean_squared_error: 156.4216\n"", + ""Epoch 114/300\n"", + ""7/7 - 0s - loss: 182.0066 - mean_squared_error: 182.0066 - val_loss: 153.6270 - val_mean_squared_error: 153.6270\n"", + ""Epoch 115/300\n"", + ""7/7 - 0s - loss: 176.9598 - mean_squared_error: 176.9598 - val_loss: 165.6460 - val_mean_squared_error: 165.6460\n"", + ""Epoch 116/300\n"", + ""7/7 - 0s - loss: 179.1551 - mean_squared_error: 179.1551 - val_loss: 156.5532 - val_mean_squared_error: 156.5532\n"", + ""Epoch 117/300\n"", + ""7/7 - 0s - loss: 178.7608 - mean_squared_error: 178.7608 - val_loss: 151.8520 - val_mean_squared_error: 151.8520\n"", + ""Epoch 118/300\n"", + ""7/7 - 0s - loss: 179.2167 - mean_squared_error: 179.2167 - val_loss: 160.9830 - val_mean_squared_error: 160.9830\n"", + ""Epoch 119/300\n"", + ""7/7 - 0s - loss: 174.2617 - mean_squared_error: 174.2617 - val_loss: 149.2688 - val_mean_squared_error: 149.2688\n"", + ""Epoch 120/300\n"", + ""7/7 - 0s - loss: 176.6184 - mean_squared_error: 176.6184 - val_loss: 151.5449 - val_mean_squared_error: 151.5449\n"", + ""Epoch 121/300\n"", + ""7/7 - 0s - loss: 177.5823 - mean_squared_error: 177.5823 - val_loss: 150.9538 - val_mean_squared_error: 150.9538\n"", + ""Epoch 122/300\n"", + ""7/7 - 0s - loss: 178.0357 - mean_squared_error: 178.0357 - val_loss: 145.8751 - val_mean_squared_error: 145.8751\n"", + ""Epoch 123/300\n"", + ""7/7 - 0s - loss: 172.8908 - mean_squared_error: 172.8908 - val_loss: 155.2848 - val_mean_squared_error: 155.2848\n"", + ""Epoch 124/300\n"", + ""7/7 - 0s - loss: 170.4705 - mean_squared_error: 170.4705 - val_loss: 143.5676 - val_mean_squared_error: 143.5676\n"", + ""Epoch 125/300\n"", + ""7/7 - 0s - loss: 171.1432 - mean_squared_error: 171.1432 - val_loss: 145.1983 - val_mean_squared_error: 145.1983\n"", + ""Epoch 126/300\n"", + ""7/7 - 0s - loss: 167.7013 - mean_squared_error: 167.7013 - val_loss: 142.5124 - val_mean_squared_error: 142.5124\n"", + ""Epoch 127/300\n"", + ""7/7 - 0s - loss: 167.9532 - mean_squared_error: 167.9532 - val_loss: 143.5247 - val_mean_squared_error: 143.5247\n"", + ""Epoch 128/300\n"", + ""7/7 - 0s - loss: 166.1757 - mean_squared_error: 166.1757 - val_loss: 143.1503 - val_mean_squared_error: 143.1503\n"", + ""Epoch 129/300\n"", + ""7/7 - 0s - loss: 167.7433 - mean_squared_error: 167.7433 - val_loss: 136.5708 - val_mean_squared_error: 136.5708\n"", + ""Epoch 130/300\n"", + ""7/7 - 0s - loss: 166.3543 - mean_squared_error: 166.3543 - val_loss: 141.5910 - val_mean_squared_error: 141.5910\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 131/300\n"", + ""7/7 - 0s - loss: 167.7047 - mean_squared_error: 167.7047 - val_loss: 135.0235 - val_mean_squared_error: 135.0235\n"", + ""Epoch 132/300\n"", + ""7/7 - 0s - loss: 163.7250 - mean_squared_error: 163.7250 - val_loss: 141.6844 - val_mean_squared_error: 141.6844\n"", + ""Epoch 133/300\n"", + ""7/7 - 0s - loss: 160.2484 - mean_squared_error: 160.2484 - val_loss: 132.0378 - val_mean_squared_error: 132.0378\n"", + ""Epoch 134/300\n"", + ""7/7 - 0s - loss: 163.2269 - mean_squared_error: 163.2269 - val_loss: 133.1223 - val_mean_squared_error: 133.1223\n"", + ""Epoch 135/300\n"", + ""7/7 - 0s - loss: 165.8349 - mean_squared_error: 165.8349 - val_loss: 134.1761 - val_mean_squared_error: 134.1761\n"", + ""Epoch 136/300\n"", + ""7/7 - 0s - loss: 161.3339 - mean_squared_error: 161.3339 - val_loss: 131.4953 - val_mean_squared_error: 131.4953\n"", + ""Epoch 137/300\n"", + ""7/7 - 0s - loss: 154.3299 - mean_squared_error: 154.3299 - val_loss: 138.6519 - val_mean_squared_error: 138.6519\n"", + ""Epoch 138/300\n"", + ""7/7 - 0s - loss: 161.4477 - mean_squared_error: 161.4477 - val_loss: 127.8494 - val_mean_squared_error: 127.8494\n"", + ""Epoch 139/300\n"", + ""7/7 - 0s - loss: 160.6196 - mean_squared_error: 160.6196 - val_loss: 130.2232 - val_mean_squared_error: 130.2232\n"", + ""Epoch 140/300\n"", + ""7/7 - 0s - loss: 158.4247 - mean_squared_error: 158.4247 - val_loss: 130.9362 - val_mean_squared_error: 130.9362\n"", + ""Epoch 141/300\n"", + ""7/7 - 0s - loss: 156.5823 - mean_squared_error: 156.5823 - val_loss: 126.4265 - val_mean_squared_error: 126.4265\n"", + ""Epoch 142/300\n"", + ""7/7 - 0s - loss: 152.5842 - mean_squared_error: 152.5842 - val_loss: 130.9928 - val_mean_squared_error: 130.9928\n"", + ""Epoch 143/300\n"", + ""7/7 - 0s - loss: 154.0647 - mean_squared_error: 154.0647 - val_loss: 125.9015 - val_mean_squared_error: 125.9015\n"", + ""Epoch 144/300\n"", + ""7/7 - 0s - loss: 152.3916 - mean_squared_error: 152.3916 - val_loss: 127.7207 - val_mean_squared_error: 127.7207\n"", + ""Epoch 145/300\n"", + ""7/7 - 0s - loss: 151.9374 - mean_squared_error: 151.9374 - val_loss: 125.9325 - val_mean_squared_error: 125.9325\n"", + ""Epoch 146/300\n"", + ""7/7 - 0s - loss: 151.2065 - mean_squared_error: 151.2065 - val_loss: 124.7802 - val_mean_squared_error: 124.7802\n"", + ""Epoch 147/300\n"", + ""7/7 - 0s - loss: 152.7945 - mean_squared_error: 152.7945 - val_loss: 126.2337 - val_mean_squared_error: 126.2337\n"", + ""Epoch 148/300\n"", + ""7/7 - 0s - loss: 151.3933 - mean_squared_error: 151.3933 - val_loss: 124.3746 - val_mean_squared_error: 124.3746\n"", + ""Epoch 149/300\n"", + ""7/7 - 0s - loss: 152.8635 - mean_squared_error: 152.8635 - val_loss: 124.1025 - val_mean_squared_error: 124.1025\n"", + ""Epoch 150/300\n"", + ""7/7 - 0s - loss: 152.6144 - mean_squared_error: 152.6144 - val_loss: 125.7957 - val_mean_squared_error: 125.7957\n"", + ""Epoch 151/300\n"", + ""7/7 - 0s - loss: 149.5427 - mean_squared_error: 149.5427 - val_loss: 121.7813 - val_mean_squared_error: 121.7813\n"", + ""Epoch 152/300\n"", + ""7/7 - 0s - loss: 149.4558 - mean_squared_error: 149.4558 - val_loss: 122.0461 - val_mean_squared_error: 122.0461\n"", + ""Epoch 153/300\n"", + ""7/7 - 0s - loss: 146.9728 - mean_squared_error: 146.9728 - val_loss: 122.1661 - val_mean_squared_error: 122.1661\n"", + ""Epoch 154/300\n"", + ""7/7 - 0s - loss: 146.8136 - mean_squared_error: 146.8136 - val_loss: 122.9176 - val_mean_squared_error: 122.9176\n"", + ""Epoch 155/300\n"", + ""7/7 - 0s - loss: 147.2664 - mean_squared_error: 147.2664 - val_loss: 119.4078 - val_mean_squared_error: 119.4078\n"", + ""Epoch 156/300\n"", + ""7/7 - 0s - loss: 147.6660 - mean_squared_error: 147.6660 - val_loss: 121.1522 - val_mean_squared_error: 121.1522\n"", + ""Epoch 157/300\n"", + ""7/7 - 0s - loss: 143.8742 - mean_squared_error: 143.8742 - val_loss: 121.0536 - val_mean_squared_error: 121.0536\n"", + ""Epoch 158/300\n"", + ""7/7 - 0s - loss: 144.2189 - mean_squared_error: 144.2189 - val_loss: 117.5080 - val_mean_squared_error: 117.5080\n"", + ""Epoch 159/300\n"", + ""7/7 - 0s - loss: 144.2912 - mean_squared_error: 144.2912 - val_loss: 120.5038 - val_mean_squared_error: 120.5039\n"", + ""Epoch 160/300\n"", + ""7/7 - 0s - loss: 149.7608 - mean_squared_error: 149.7608 - val_loss: 122.4011 - val_mean_squared_error: 122.4011\n"", + ""Epoch 161/300\n"", + ""7/7 - 0s - loss: 145.0701 - mean_squared_error: 145.0701 - val_loss: 122.1363 - val_mean_squared_error: 122.1363\n"", + ""Epoch 162/300\n"", + ""7/7 - 0s - loss: 145.2773 - mean_squared_error: 145.2773 - val_loss: 118.5215 - val_mean_squared_error: 118.5215\n"", + ""Epoch 163/300\n"", + ""7/7 - 0s - loss: 144.1693 - mean_squared_error: 144.1693 - val_loss: 121.6482 - val_mean_squared_error: 121.6482\n"", + ""Epoch 164/300\n"", + ""7/7 - 0s - loss: 136.0573 - mean_squared_error: 136.0573 - val_loss: 117.1376 - val_mean_squared_error: 117.1376\n"", + ""Epoch 165/300\n"", + ""7/7 - 0s - loss: 139.5655 - mean_squared_error: 139.5655 - val_loss: 123.8599 - val_mean_squared_error: 123.8599\n"", + ""Epoch 166/300\n"", + ""7/7 - 0s - loss: 140.8161 - mean_squared_error: 140.8161 - val_loss: 114.8696 - val_mean_squared_error: 114.8696\n"", + ""Epoch 167/300\n"", + ""7/7 - 0s - loss: 141.9293 - mean_squared_error: 141.9293 - val_loss: 117.4944 - val_mean_squared_error: 117.4944\n"", + ""Epoch 168/300\n"", + ""7/7 - 0s - loss: 142.2724 - mean_squared_error: 142.2724 - val_loss: 129.0813 - val_mean_squared_error: 129.0813\n"", + ""Epoch 169/300\n"", + ""7/7 - 0s - loss: 140.5025 - mean_squared_error: 140.5025 - val_loss: 123.3190 - val_mean_squared_error: 123.3190\n"", + ""Epoch 170/300\n"", + ""7/7 - 0s - loss: 139.7854 - mean_squared_error: 139.7854 - val_loss: 124.4622 - val_mean_squared_error: 124.4622\n"", + ""Epoch 171/300\n"", + ""7/7 - 0s - loss: 137.6053 - mean_squared_error: 137.6053 - val_loss: 119.6344 - val_mean_squared_error: 119.6344\n"", + ""Epoch 172/300\n"", + ""7/7 - 0s - loss: 134.4401 - mean_squared_error: 134.4401 - val_loss: 116.8185 - val_mean_squared_error: 116.8185\n"", + ""Epoch 173/300\n"", + ""7/7 - 0s - loss: 134.8046 - mean_squared_error: 134.8046 - val_loss: 115.5637 - val_mean_squared_error: 115.5637\n"", + ""Epoch 174/300\n"", + ""7/7 - 0s - loss: 140.5974 - mean_squared_error: 140.5974 - val_loss: 114.9588 - val_mean_squared_error: 114.9588\n"", + ""Epoch 175/300\n"", + ""7/7 - 0s - loss: 138.9278 - mean_squared_error: 138.9278 - val_loss: 115.9785 - val_mean_squared_error: 115.9785\n"", + ""Epoch 176/300\n"", + ""7/7 - 0s - loss: 138.0513 - mean_squared_error: 138.0513 - val_loss: 115.4905 - val_mean_squared_error: 115.4905\n"", + ""Epoch 177/300\n"", + ""7/7 - 0s - loss: 129.0519 - mean_squared_error: 129.0519 - val_loss: 112.0812 - val_mean_squared_error: 112.0812\n"", + ""Epoch 178/300\n"", + ""7/7 - 0s - loss: 128.5305 - mean_squared_error: 128.5305 - val_loss: 111.6017 - val_mean_squared_error: 111.6017\n"", + ""Epoch 179/300\n"", + ""7/7 - 0s - loss: 125.4032 - mean_squared_error: 125.4032 - val_loss: 111.5495 - val_mean_squared_error: 111.5495\n"", + ""Epoch 180/300\n"", + ""7/7 - 0s - loss: 126.2475 - mean_squared_error: 126.2475 - val_loss: 109.4845 - val_mean_squared_error: 109.4845\n"", + ""Epoch 181/300\n"", + ""7/7 - 0s - loss: 123.4415 - mean_squared_error: 123.4415 - val_loss: 109.4123 - val_mean_squared_error: 109.4123\n"", + ""Epoch 182/300\n"", + ""7/7 - 0s - loss: 122.4440 - mean_squared_error: 122.4440 - val_loss: 105.0120 - val_mean_squared_error: 105.0120\n"", + ""Epoch 183/300\n"", + ""7/7 - 0s - loss: 124.2518 - mean_squared_error: 124.2518 - val_loss: 110.1504 - val_mean_squared_error: 110.1504\n"", + ""Epoch 184/300\n"", + ""7/7 - 0s - loss: 121.8232 - mean_squared_error: 121.8232 - val_loss: 105.1448 - val_mean_squared_error: 105.1448\n"", + ""Epoch 185/300\n"", + ""7/7 - 0s - loss: 124.3031 - mean_squared_error: 124.3031 - val_loss: 111.7361 - val_mean_squared_error: 111.7361\n"", + ""Epoch 186/300\n"", + ""7/7 - 0s - loss: 131.9778 - mean_squared_error: 131.9778 - val_loss: 125.0746 - val_mean_squared_error: 125.0746\n"", + ""Epoch 187/300\n"", + ""7/7 - 0s - loss: 133.5749 - mean_squared_error: 133.5749 - val_loss: 121.4307 - val_mean_squared_error: 121.4307\n"", + ""Epoch 188/300\n"", + ""7/7 - 0s - loss: 132.5899 - mean_squared_error: 132.5899 - val_loss: 121.2085 - val_mean_squared_error: 121.2085\n"", + ""Epoch 189/300\n"", + ""7/7 - 0s - loss: 130.7431 - mean_squared_error: 130.7431 - val_loss: 118.8182 - val_mean_squared_error: 118.8182\n"", + ""Epoch 190/300\n"", + ""7/7 - 0s - loss: 127.2361 - mean_squared_error: 127.2361 - val_loss: 113.8454 - val_mean_squared_error: 113.8454\n"", + ""Epoch 191/300\n"", + ""7/7 - 0s - loss: 123.8808 - mean_squared_error: 123.8808 - val_loss: 111.7064 - val_mean_squared_error: 111.7064\n"", + ""Epoch 192/300\n"", + ""7/7 - 0s - loss: 123.0650 - mean_squared_error: 123.0650 - val_loss: 110.3961 - val_mean_squared_error: 110.3961\n"", + ""Epoch 193/300\n"", + ""7/7 - 0s - loss: 118.3199 - mean_squared_error: 118.3199 - val_loss: 108.4663 - val_mean_squared_error: 108.4663\n"", + ""Epoch 194/300\n"", + ""7/7 - 0s - loss: 118.1348 - mean_squared_error: 118.1348 - val_loss: 111.7456 - val_mean_squared_error: 111.7456\n"", + ""Epoch 195/300\n"", + ""7/7 - 0s - loss: 118.5594 - mean_squared_error: 118.5594 - val_loss: 106.9830 - val_mean_squared_error: 106.9830\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 196/300\n"", + ""7/7 - 0s - loss: 116.9863 - mean_squared_error: 116.9863 - val_loss: 106.2228 - val_mean_squared_error: 106.2228\n"", + ""Epoch 197/300\n"", + ""7/7 - 0s - loss: 117.0961 - mean_squared_error: 117.0961 - val_loss: 106.9123 - val_mean_squared_error: 106.9123\n"", + ""Epoch 198/300\n"", + ""7/7 - 0s - loss: 123.6219 - mean_squared_error: 123.6219 - val_loss: 108.0678 - val_mean_squared_error: 108.0678\n"", + ""Epoch 199/300\n"", + ""7/7 - 0s - loss: 116.4410 - mean_squared_error: 116.4410 - val_loss: 104.3948 - val_mean_squared_error: 104.3948\n"", + ""Epoch 200/300\n"", + ""7/7 - 0s - loss: 115.1849 - mean_squared_error: 115.1849 - val_loss: 102.9129 - val_mean_squared_error: 102.9129\n"", + ""Epoch 201/300\n"", + ""7/7 - 0s - loss: 112.2840 - mean_squared_error: 112.2840 - val_loss: 104.3632 - val_mean_squared_error: 104.3632\n"", + ""Epoch 202/300\n"", + ""7/7 - 0s - loss: 112.1066 - mean_squared_error: 112.1066 - val_loss: 104.5409 - val_mean_squared_error: 104.5409\n"", + ""Epoch 203/300\n"", + ""7/7 - 0s - loss: 115.1140 - mean_squared_error: 115.1140 - val_loss: 107.1651 - val_mean_squared_error: 107.1651\n"", + ""Epoch 204/300\n"", + ""7/7 - 0s - loss: 113.4343 - mean_squared_error: 113.4343 - val_loss: 104.2867 - val_mean_squared_error: 104.2867\n"", + ""Epoch 205/300\n"", + ""7/7 - 0s - loss: 114.0212 - mean_squared_error: 114.0212 - val_loss: 108.6537 - val_mean_squared_error: 108.6537\n"", + ""Epoch 206/300\n"", + ""7/7 - 0s - loss: 118.3139 - mean_squared_error: 118.3139 - val_loss: 102.7771 - val_mean_squared_error: 102.7771\n"", + ""Epoch 207/300\n"", + ""7/7 - 0s - loss: 117.8019 - mean_squared_error: 117.8019 - val_loss: 108.1882 - val_mean_squared_error: 108.1882\n"", + ""Epoch 208/300\n"", + ""7/7 - 0s - loss: 114.7462 - mean_squared_error: 114.7462 - val_loss: 102.1282 - val_mean_squared_error: 102.1282\n"", + ""Epoch 209/300\n"", + ""7/7 - 0s - loss: 109.5455 - mean_squared_error: 109.5455 - val_loss: 103.2644 - val_mean_squared_error: 103.2644\n"", + ""Epoch 210/300\n"", + ""7/7 - 0s - loss: 110.2840 - mean_squared_error: 110.2840 - val_loss: 108.8151 - val_mean_squared_error: 108.8151\n"", + ""Epoch 211/300\n"", + ""7/7 - 0s - loss: 110.6280 - mean_squared_error: 110.6280 - val_loss: 105.6648 - val_mean_squared_error: 105.6648\n"", + ""Epoch 212/300\n"", + ""7/7 - 0s - loss: 113.7280 - mean_squared_error: 113.7280 - val_loss: 105.5938 - val_mean_squared_error: 105.5938\n"", + ""Epoch 213/300\n"", + ""7/7 - 0s - loss: 107.9671 - mean_squared_error: 107.9671 - val_loss: 105.9192 - val_mean_squared_error: 105.9192\n"", + ""Epoch 214/300\n"", + ""7/7 - 0s - loss: 110.7339 - mean_squared_error: 110.7339 - val_loss: 105.3354 - val_mean_squared_error: 105.3354\n"", + ""Epoch 215/300\n"", + ""7/7 - 0s - loss: 105.9593 - mean_squared_error: 105.9593 - val_loss: 106.0460 - val_mean_squared_error: 106.0460\n"", + ""Epoch 216/300\n"", + ""7/7 - 0s - loss: 103.3400 - mean_squared_error: 103.3400 - val_loss: 101.1352 - val_mean_squared_error: 101.1352\n"", + ""Epoch 217/300\n"", + ""7/7 - 0s - loss: 104.8229 - mean_squared_error: 104.8229 - val_loss: 99.5416 - val_mean_squared_error: 99.5416\n"", + ""Epoch 218/300\n"", + ""7/7 - 0s - loss: 106.1544 - mean_squared_error: 106.1544 - val_loss: 108.6118 - val_mean_squared_error: 108.6118\n"", + ""Epoch 219/300\n"", + ""7/7 - 0s - loss: 102.4387 - mean_squared_error: 102.4387 - val_loss: 101.4727 - val_mean_squared_error: 101.4727\n"", + ""Epoch 220/300\n"", + ""7/7 - 0s - loss: 102.1936 - mean_squared_error: 102.1936 - val_loss: 102.8719 - val_mean_squared_error: 102.8719\n"", + ""Epoch 221/300\n"", + ""7/7 - 0s - loss: 101.1490 - mean_squared_error: 101.1490 - val_loss: 103.8106 - val_mean_squared_error: 103.8106\n"", + ""Epoch 222/300\n"", + ""7/7 - 0s - loss: 103.0258 - mean_squared_error: 103.0258 - val_loss: 106.6277 - val_mean_squared_error: 106.6277\n"", + ""Epoch 223/300\n"", + ""7/7 - 0s - loss: 99.6118 - mean_squared_error: 99.6118 - val_loss: 99.6346 - val_mean_squared_error: 99.6346\n"", + ""Epoch 224/300\n"", + ""7/7 - 0s - loss: 100.0255 - mean_squared_error: 100.0255 - val_loss: 105.5367 - val_mean_squared_error: 105.5367\n"", + ""Epoch 225/300\n"", + ""7/7 - 0s - loss: 97.2471 - mean_squared_error: 97.2471 - val_loss: 104.6580 - val_mean_squared_error: 104.6580\n"", + ""Epoch 226/300\n"", + ""7/7 - 0s - loss: 100.1537 - mean_squared_error: 100.1537 - val_loss: 101.1147 - val_mean_squared_error: 101.1147\n"", + ""Epoch 227/300\n"", + ""7/7 - 0s - loss: 101.0630 - mean_squared_error: 101.0630 - val_loss: 103.5402 - val_mean_squared_error: 103.5402\n"", + ""Epoch 228/300\n"", + ""7/7 - 0s - loss: 99.4218 - mean_squared_error: 99.4218 - val_loss: 101.7397 - val_mean_squared_error: 101.7397\n"", + ""Epoch 229/300\n"", + ""7/7 - 0s - loss: 94.4093 - mean_squared_error: 94.4093 - val_loss: 105.8918 - val_mean_squared_error: 105.8918\n"", + ""Epoch 230/300\n"", + ""7/7 - 0s - loss: 95.9676 - mean_squared_error: 95.9676 - val_loss: 100.9512 - val_mean_squared_error: 100.9512\n"", + ""Epoch 231/300\n"", + ""7/7 - 0s - loss: 99.7878 - mean_squared_error: 99.7878 - val_loss: 105.5119 - val_mean_squared_error: 105.5119\n"", + ""Epoch 232/300\n"", + ""7/7 - 0s - loss: 95.1825 - mean_squared_error: 95.1825 - val_loss: 104.2072 - val_mean_squared_error: 104.2072\n"", + ""Epoch 233/300\n"", + ""7/7 - 0s - loss: 92.6022 - mean_squared_error: 92.6022 - val_loss: 101.8417 - val_mean_squared_error: 101.8417\n"", + ""Epoch 234/300\n"", + ""7/7 - 0s - loss: 94.6834 - mean_squared_error: 94.6834 - val_loss: 101.1876 - val_mean_squared_error: 101.1876\n"", + ""Epoch 235/300\n"", + ""7/7 - 0s - loss: 91.8533 - mean_squared_error: 91.8533 - val_loss: 101.2377 - val_mean_squared_error: 101.2377\n"", + ""Epoch 236/300\n"", + ""7/7 - 0s - loss: 93.0335 - mean_squared_error: 93.0335 - val_loss: 101.4029 - val_mean_squared_error: 101.4029\n"", + ""Epoch 237/300\n"", + ""7/7 - 0s - loss: 88.6668 - mean_squared_error: 88.6668 - val_loss: 103.9979 - val_mean_squared_error: 103.9979\n"", + ""Epoch 238/300\n"", + ""7/7 - 0s - loss: 89.4007 - mean_squared_error: 89.4007 - val_loss: 101.7961 - val_mean_squared_error: 101.7961\n"", + ""Epoch 239/300\n"", + ""7/7 - 0s - loss: 87.9157 - mean_squared_error: 87.9157 - val_loss: 101.7997 - val_mean_squared_error: 101.7997\n"", + ""Epoch 240/300\n"", + ""7/7 - 0s - loss: 85.8747 - mean_squared_error: 85.8747 - val_loss: 103.9846 - val_mean_squared_error: 103.9846\n"", + ""Epoch 241/300\n"", + ""7/7 - 0s - loss: 87.6378 - mean_squared_error: 87.6378 - val_loss: 106.7567 - val_mean_squared_error: 106.7567\n"", + ""Epoch 242/300\n"", + ""7/7 - 0s - loss: 91.4309 - mean_squared_error: 91.4309 - val_loss: 113.9215 - val_mean_squared_error: 113.9215\n"", + ""Epoch 243/300\n"", + ""7/7 - 0s - loss: 90.0978 - mean_squared_error: 90.0978 - val_loss: 104.7295 - val_mean_squared_error: 104.7295\n"", + ""Epoch 244/300\n"", + ""7/7 - 0s - loss: 85.1086 - mean_squared_error: 85.1086 - val_loss: 103.6832 - val_mean_squared_error: 103.6832\n"", + ""Epoch 245/300\n"", + ""7/7 - 0s - loss: 89.0895 - mean_squared_error: 89.0895 - val_loss: 114.3161 - val_mean_squared_error: 114.3161\n"", + ""Epoch 246/300\n"", + ""7/7 - 0s - loss: 88.9100 - mean_squared_error: 88.9100 - val_loss: 109.4786 - val_mean_squared_error: 109.4786\n"", + ""Epoch 247/300\n"", + ""7/7 - 0s - loss: 87.1816 - mean_squared_error: 87.1816 - val_loss: 102.1492 - val_mean_squared_error: 102.1492\n"", + ""Epoch 248/300\n"", + ""7/7 - 0s - loss: 85.2029 - mean_squared_error: 85.2029 - val_loss: 103.7492 - val_mean_squared_error: 103.7492\n"", + ""Epoch 249/300\n"", + ""7/7 - 0s - loss: 85.6100 - mean_squared_error: 85.6100 - val_loss: 97.3146 - val_mean_squared_error: 97.3146\n"", + ""Epoch 250/300\n"", + ""7/7 - 0s - loss: 78.3826 - mean_squared_error: 78.3826 - val_loss: 100.7957 - val_mean_squared_error: 100.7957\n"", + ""Epoch 251/300\n"", + ""7/7 - 0s - loss: 77.2996 - mean_squared_error: 77.2996 - val_loss: 105.0396 - val_mean_squared_error: 105.0396\n"", + ""Epoch 252/300\n"", + ""7/7 - 0s - loss: 75.3116 - mean_squared_error: 75.3116 - val_loss: 103.7390 - val_mean_squared_error: 103.7390\n"", + ""Epoch 253/300\n"", + ""7/7 - 0s - loss: 75.5093 - mean_squared_error: 75.5093 - val_loss: 104.1276 - val_mean_squared_error: 104.1276\n"", + ""Epoch 254/300\n"", + ""7/7 - 0s - loss: 73.9967 - mean_squared_error: 73.9967 - val_loss: 103.6741 - val_mean_squared_error: 103.6741\n"", + ""Epoch 255/300\n"", + ""7/7 - 0s - loss: 73.7169 - mean_squared_error: 73.7169 - val_loss: 107.4802 - val_mean_squared_error: 107.4802\n"", + ""Epoch 256/300\n"", + ""7/7 - 0s - loss: 78.0121 - mean_squared_error: 78.0121 - val_loss: 114.4845 - val_mean_squared_error: 114.4845\n"", + ""Epoch 257/300\n"", + ""7/7 - 0s - loss: 76.6211 - mean_squared_error: 76.6211 - val_loss: 107.2908 - val_mean_squared_error: 107.2908\n"", + ""Epoch 258/300\n"", + ""7/7 - 0s - loss: 72.5132 - mean_squared_error: 72.5132 - val_loss: 108.1242 - val_mean_squared_error: 108.1242\n"", + ""Epoch 259/300\n"", + ""7/7 - 0s - loss: 72.8565 - mean_squared_error: 72.8565 - val_loss: 103.3348 - val_mean_squared_error: 103.3347\n"", + ""Epoch 260/300\n"", + ""7/7 - 0s - loss: 68.9209 - mean_squared_error: 68.9209 - val_loss: 106.9313 - val_mean_squared_error: 106.9313\n"", + ""Epoch 261/300\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""7/7 - 0s - loss: 67.3447 - mean_squared_error: 67.3447 - val_loss: 109.0208 - val_mean_squared_error: 109.0208\n"", + ""Epoch 262/300\n"", + ""7/7 - 0s - loss: 69.8876 - mean_squared_error: 69.8876 - val_loss: 103.2980 - val_mean_squared_error: 103.2980\n"", + ""Epoch 263/300\n"", + ""7/7 - 0s - loss: 67.6197 - mean_squared_error: 67.6197 - val_loss: 108.7109 - val_mean_squared_error: 108.7109\n"", + ""Epoch 264/300\n"", + ""7/7 - 0s - loss: 70.3738 - mean_squared_error: 70.3738 - val_loss: 114.4844 - val_mean_squared_error: 114.4844\n"", + ""Epoch 265/300\n"", + ""7/7 - 0s - loss: 71.0919 - mean_squared_error: 71.0919 - val_loss: 111.1550 - val_mean_squared_error: 111.1550\n"", + ""Epoch 266/300\n"", + ""7/7 - 0s - loss: 66.4423 - mean_squared_error: 66.4423 - val_loss: 107.9003 - val_mean_squared_error: 107.9003\n"", + ""Epoch 267/300\n"", + ""7/7 - 0s - loss: 66.5148 - mean_squared_error: 66.5148 - val_loss: 106.2459 - val_mean_squared_error: 106.2459\n"", + ""Epoch 268/300\n"", + ""7/7 - 0s - loss: 66.3787 - mean_squared_error: 66.3787 - val_loss: 119.0577 - val_mean_squared_error: 119.0577\n"", + ""Epoch 269/300\n"", + ""7/7 - 0s - loss: 71.3558 - mean_squared_error: 71.3558 - val_loss: 105.8649 - val_mean_squared_error: 105.8649\n"", + ""Epoch 270/300\n"", + ""7/7 - 0s - loss: 66.0327 - mean_squared_error: 66.0327 - val_loss: 111.3798 - val_mean_squared_error: 111.3798\n"", + ""Epoch 271/300\n"", + ""7/7 - 0s - loss: 69.1568 - mean_squared_error: 69.1568 - val_loss: 108.8839 - val_mean_squared_error: 108.8839\n"", + ""Epoch 272/300\n"", + ""7/7 - 0s - loss: 65.3325 - mean_squared_error: 65.3325 - val_loss: 113.6718 - val_mean_squared_error: 113.6718\n"", + ""Epoch 273/300\n"", + ""7/7 - 0s - loss: 65.6054 - mean_squared_error: 65.6054 - val_loss: 107.8705 - val_mean_squared_error: 107.8705\n"", + ""Epoch 274/300\n"", + ""7/7 - 0s - loss: 62.4805 - mean_squared_error: 62.4805 - val_loss: 119.7627 - val_mean_squared_error: 119.7627\n"", + ""Epoch 275/300\n"", + ""7/7 - 0s - loss: 62.0605 - mean_squared_error: 62.0605 - val_loss: 107.6547 - val_mean_squared_error: 107.6547\n"", + ""Epoch 276/300\n"", + ""7/7 - 0s - loss: 62.0791 - mean_squared_error: 62.0791 - val_loss: 113.8168 - val_mean_squared_error: 113.8168\n"", + ""Epoch 277/300\n"", + ""7/7 - 0s - loss: 59.1316 - mean_squared_error: 59.1316 - val_loss: 114.8106 - val_mean_squared_error: 114.8106\n"", + ""Epoch 278/300\n"", + ""7/7 - 0s - loss: 62.1938 - mean_squared_error: 62.1938 - val_loss: 118.0961 - val_mean_squared_error: 118.0961\n"", + ""Epoch 279/300\n"", + ""7/7 - 0s - loss: 60.9395 - mean_squared_error: 60.9395 - val_loss: 109.0599 - val_mean_squared_error: 109.0599\n"", + ""Epoch 280/300\n"", + ""7/7 - 0s - loss: 60.6448 - mean_squared_error: 60.6448 - val_loss: 114.1633 - val_mean_squared_error: 114.1633\n"", + ""Epoch 281/300\n"", + ""7/7 - 0s - loss: 62.1305 - mean_squared_error: 62.1305 - val_loss: 114.8480 - val_mean_squared_error: 114.8480\n"", + ""Epoch 282/300\n"", + ""7/7 - 0s - loss: 58.2508 - mean_squared_error: 58.2508 - val_loss: 116.5373 - val_mean_squared_error: 116.5373\n"", + ""Epoch 283/300\n"", + ""7/7 - 0s - loss: 59.2958 - mean_squared_error: 59.2958 - val_loss: 117.5446 - val_mean_squared_error: 117.5446\n"", + ""Epoch 284/300\n"", + ""7/7 - 0s - loss: 54.9322 - mean_squared_error: 54.9322 - val_loss: 108.0426 - val_mean_squared_error: 108.0426\n"", + ""Epoch 285/300\n"", + ""7/7 - 0s - loss: 57.6526 - mean_squared_error: 57.6526 - val_loss: 118.9638 - val_mean_squared_error: 118.9638\n"", + ""Epoch 286/300\n"", + ""7/7 - 0s - loss: 57.9313 - mean_squared_error: 57.9313 - val_loss: 110.7199 - val_mean_squared_error: 110.7199\n"", + ""Epoch 287/300\n"", + ""7/7 - 0s - loss: 63.3042 - mean_squared_error: 63.3042 - val_loss: 113.8287 - val_mean_squared_error: 113.8287\n"", + ""Epoch 288/300\n"", + ""7/7 - 0s - loss: 55.5838 - mean_squared_error: 55.5838 - val_loss: 122.6955 - val_mean_squared_error: 122.6955\n"", + ""Epoch 289/300\n"", + ""7/7 - 0s - loss: 54.8691 - mean_squared_error: 54.8691 - val_loss: 107.9863 - val_mean_squared_error: 107.9863\n"", + ""Epoch 290/300\n"", + ""7/7 - 0s - loss: 55.5501 - mean_squared_error: 55.5501 - val_loss: 129.4937 - val_mean_squared_error: 129.4937\n"", + ""Epoch 291/300\n"", + ""7/7 - 0s - loss: 59.6770 - mean_squared_error: 59.6770 - val_loss: 108.6387 - val_mean_squared_error: 108.6387\n"", + ""Epoch 292/300\n"", + ""7/7 - 0s - loss: 61.0565 - mean_squared_error: 61.0565 - val_loss: 120.6868 - val_mean_squared_error: 120.6868\n"", + ""Epoch 293/300\n"", + ""7/7 - 0s - loss: 62.7368 - mean_squared_error: 62.7368 - val_loss: 109.5441 - val_mean_squared_error: 109.5441\n"", + ""Epoch 294/300\n"", + ""7/7 - 0s - loss: 55.2849 - mean_squared_error: 55.2849 - val_loss: 117.9500 - val_mean_squared_error: 117.9500\n"", + ""Epoch 295/300\n"", + ""7/7 - 0s - loss: 52.6235 - mean_squared_error: 52.6235 - val_loss: 113.9579 - val_mean_squared_error: 113.9579\n"", + ""Epoch 296/300\n"", + ""7/7 - 0s - loss: 52.0075 - mean_squared_error: 52.0075 - val_loss: 123.0886 - val_mean_squared_error: 123.0886\n"", + ""Epoch 297/300\n"", + ""7/7 - 0s - loss: 53.9228 - mean_squared_error: 53.9228 - val_loss: 109.8059 - val_mean_squared_error: 109.8059\n"", + ""Epoch 298/300\n"", + ""7/7 - 0s - loss: 54.7933 - mean_squared_error: 54.7933 - val_loss: 122.7958 - val_mean_squared_error: 122.7958\n"", + ""Epoch 299/300\n"", + ""7/7 - 0s - loss: 52.1949 - mean_squared_error: 52.1949 - val_loss: 117.5097 - val_mean_squared_error: 117.5097\n"", + ""Epoch 300/300\n"", + ""7/7 - 0s - loss: 55.4258 - mean_squared_error: 55.4258 - val_loss: 114.8099 - val_mean_squared_error: 114.8099\n"" + ] + } + ], + ""source"": [ + ""# define two sets of inputs\n"", + ""inputA = Input(shape=(100,1))\n"", + ""inputB = Input(shape=(80))\n"", + ""# the first branch operates on the first input\n"", + ""\n"", + ""RNNmodel = Sequential()\n"", + ""RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True), input_shape=(100,1)))\n"", + ""RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True)))\n"", + ""RNNmodel.add(TimeDistributed(Dense(int(LSTMunits/2), activation=\""relu\"")))\n"", + ""RNNmodel.add(Reshape((int(LSTMunits/2*100),)))\n"", + ""\n"", + ""# the second branch opreates on the second input\n"", + ""y = Dense(8, activation=\""relu\"")(inputB)\n"", + ""y = Dense(8, activation=\""relu\"")(y)\n"", + ""y = Model(inputs=inputB, outputs=y)\n"", + ""# combine the output of the two branches\n"", + ""combined = Concatenate()([RNNmodel.output, y.output])\n"", + ""# apply a FC layer and then a regression prediction on the\n"", + ""# combined outputs\n"", + ""z = Dense(8, activation=\""relu\"")(combined)\n"", + ""z = Dense(1, activation=\""linear\"")(z)\n"", + ""# our model will accept the inputs of the two branches and\n"", + ""# then output a single value\n"", + ""model = Model(inputs=[RNNmodel.input, y.input], outputs=z)\n"", + ""\n"", + ""\n"", + ""xtrain_B, xtest_B, ytrain_B, ytest_B=train_test_split(Mix_X, DF_MRI[Flag]['19F NMR Signal-to-Noise Ratioa'].astype(np.float64), test_size=0.20, random_state=200)\n"", + ""xtrain_A, xtest_A, ytrain_A, ytest_A=train_test_split(Mix_X_100Block, DF_MRI[Flag]['19F NMR Signal-to-Noise Ratioa'].astype(np.float64), test_size=0.20, random_state=200)\n"", + ""\n"", + ""model.compile(optimizer=keras.optimizers.Adam(lr=0.001),\n"", + "" loss=\""mean_squared_error\"",\n"", + "" metrics=[\""mean_squared_error\""])\n"", + ""\n"", + ""Model = model.fit(\n"", + "" x=[xtrain_A, xtrain_B], y=ytrain_B,\n"", + "" validation_data=([xtest_A, xtest_B], ytest_B),\n"", + "" epochs=300, batch_size=32, verbose=2) #epochs=100, batch_size=128, verbose=2)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 67, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""with open('Fusion_Loss.pickle', 'wb') as handle:\n"", + "" pickle.dump(Model.history, handle, protocol=pickle.HIGHEST_PROTOCOL)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 50, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""Model.history = pickle.load(open(\""Fusion_Loss.pickle\"",\""rb\""))"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 78, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""image/png"": ""iVBORw0KGgoAAAANSUhEUgAAAZ8AAAEWCAYAAAC5XZqEAAAAOXRFWHRTb2Z0d2FyZQBNY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EHBUfRVEUJeao201RFEWJOWr5KIqiKDFHxUdRFEWJOSo+iqIoSsxR8VEURVFijoqPoiiKEnP+P0g7gDs+yz+JAAAAAElFTkSuQmCC\n"", + ""text/plain"": [ + ""
"" + ] + }, + ""metadata"": { + ""needs_background"": ""light"" + }, + ""output_type"": ""display_data"" + } + ], + ""source"": [ + ""loss = Model.history['loss']\n"", + ""val_loss = Model.history['val_loss']\n"", + ""epochs = len(loss)\n"", + ""plt.xlim((-5, 300))\n"", + ""plt.ylim((0, 300))\n"", + ""plt.plot(range(epochs), loss, color = 'k', marker = '.', label = 'loss')\n"", + ""plt.plot(range(epochs), val_loss, color = 'c', marker = '.', label = 'val_loss')\n"", + ""plt.xticks(fontname=\""Arial\"", fontsize=16, fontweight='normal')\n"", + ""plt.yticks(fontname=\""Arial\"", fontsize=16, fontweight='normal')\n"", + ""plt.legend(loc = 'best', framealpha=1, prop={'size': 16, 'family':\""Arial\""})\n"", + ""\n"", + ""plt.grid()\n"", + ""plt.xlabel('Epochs',fontname=\""Arial\"", fontsize=16)\n"", + ""plt.ylabel('Loss',fontname=\""Arial\"", fontsize=16)\n"", + ""plt.savefig(\""Fusion_Loss.png\"", dpi=600, bbox_inches='tight')\n"", + ""plt.show()"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 47, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""filepath = 'MRI_FusionModel.model'\n"", + ""save_model(model, filepath, save_format='h5')"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 79, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""model = load_model('MRI_FusionModel.model')"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 31, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Train set R^2: 0.9029361960625842\n"", + ""Test set R^2: 0.8121163869626837\n"" + ] + } + ], + ""source"": [ + ""y_train = ytrain_B\n"", + ""y_test = ytest_B\n"", + ""\n"", + ""y_pred_train = model.predict([xtrain_A, xtrain_B])\n"", + ""print(\""Train set R^2: \"", r2_score(y_train, y_pred_train))\n"", + ""\n"", + ""y_pred_test = model.predict([xtest_A, xtest_B])\n"", + ""print(\""Test set R^2: \"", r2_score(y_test, y_pred_test))"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 156, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""image/png"": ""iVBORw0KGgoAAAANSUhEUgAAANwAAADeCAYAAABWkm6KAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO2deXiU5dm3z2ue7BtkJwlhC9kICMgqi7t1RXBrq0XctdV+ba2o+Nn2fd9+rVuxWn3FtVYFtUpVQLTWBRcICIR9SQIkbEnIShYgy2Rm7u+PZxKSMIEkZibJ5D6PI8c882xzP5n8cm/X9btFKYVGo/EMlp4ugEbTn9CC02g8iBacRuNBtOA0Gg+iBafReBAtOI3Gg2jBaTQeRAtOc0ZEZJaI/Kany+ENaMH1IkTkPBGpFZEZbfbfKiKHRORRETkmIr8Wkb+LyELncR8R+YWIHBGRCe3c+xwROS4iPxeRu0TkExEZ1pFyKaU+Bp77gY+nAURHmvQuROQTwKqUuqbFviXAYKXU+SJSrJQaJCI+QDlwnlJqm1M8/1RKTT3NvQ8AaUqpehEZCFiUUkfd+Tya1ugarvfxITBWRJIAROR84BsX58UDNqCwsx/gFOsEwFdEvheRYSIySkS2OY/fLCI3icjnIuIrIn8VkXnOY79w1rgvi8hIETlXRFaKyCMisklEMrr01P0ELbjehx1YBDT1maYDa1ocDxaR3wLvA+copco7ef9fAi8BIUqpEiAHQCm1G6h0nnM1sA14UCnVCOwGLCKSCkxSSr0BvAE8C6zFFP+TwN+B2Z0sT79CC6538ipwvbM/tq/NMcHsT1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9tNJ5+rTwjOC8O/rheRtc7E22+94flEZAyQJCKjXT1PX33Gls/Fqd9bfWefS0eaaDQepE/UcBqNt6AFp9F4EC04jcaDaMFpNB5EC06j8SBacP0QMfmyp8vRH9HTAr0UEZkGfA7MB2xAMrBWKbW8m+5vKKXs3XEv5/2GKKUOddf9vBUtuF6MiBwA0pRS9c73Q5VSB3u2VKciIpOBi5RSj/d0WXo7fSV4ud8jIj8CbCKyC5gI/A/wB2A8MAsoAS4DrseMXr8Ts8twsXN7EZDvPPcB4D5gHvAisANIBXyBVcC1wIdKqTdE5GIgxnnd88AU57kngKnO+/8ImCgiE5VSXbKP6y/oPlzv52YRuQeYq5RaBfwOeAL4m1IqF1gPhCmlfgs8CywArgISgIPAASAeU2xbgQnAt0CEUuq485wcpdQdQDrwIfAT4CYRsQC/BI5iZjSMwRRnvVLqAaAQU/BrgK1abGdG13C9n8VKqXoRaQqKfRVTVGXO94qTEeprMMUyCshTSn0GfOYUjh2oaOq3tYjDtQE1zu0TSqka53E/zMTYUOd9cN7nXKDKeX4t4Ne9j+vd6Bquj6CUOugcSLkJ+ClmE7EJw/k6ENgE7APuE5FAEUnDTCPpCuXAWBGZLCI+wKXtFQ9z8FP/PZ0B/QvqpbRIbrxXRO4UkT8DF2D2p9YCg0Tkv5ynjxWRn2IK4kngI0zR7cHsjxVhNgcvdk4JTAQGi0gckAFMFpGhQKKITBWRczCbpNHAvcAKYDmwAbPfliEiQ4DhmP3JfOASYKZbfylegB6l7OOIyDDgv5VSt/ZsSTQdQddwfZ9zgOEiEt3TBdGcGV3DaTQeRNdwGo0H0YLTaDyIFpxG40G04DQaD6IFp9F4EC04jcaD/H/ijAREYr7dHgAAAABJRU5ErkJggg==\n"", + ""text/plain"": [ + ""
"" + ] + }, + ""metadata"": { + ""needs_background"": ""light"" + }, + ""output_type"": ""display_data"" + } + ], + ""source"": [ + ""plt.figure(figsize=(3,3))\n"", + ""\n"", + ""ax=plt.subplot(1, 1, 1)\n"", + ""plt.scatter(y_train, y_pred_train, c='#1f77b4', marker='o', s = 18, edgecolors='k', linewidths = 0.2)\n"", + ""plt.scatter(y_test, y_pred_test, c='#ff7f0e', marker='o', s = 18, edgecolors='k', linewidths = 0.2) \n"", + ""\n"", + ""plt.xlabel(\""Experiment\"",fontname=\""Times New Roman\"", fontsize=10)\n"", + ""plt.ylabel(\""Prediction\"",fontname=\""Times New Roman\"", fontsize=10)\n"", + ""x0, x1 = min(y_train), max(y_train)\n"", + ""length = 750\n"", + ""x_start, x_end = -200, 550\n"", + ""plt.xlim([-0, 150])\n"", + ""plt.ylim([-0, 150])\n"", + ""# ax.set_xticks([-200,-100,0,100,200,300,400,500])\n"", + ""# ax.set_yticks([-200,-100,0,100,200,300,400,500])\n"", + ""plt.xticks(fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""plt.yticks(fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""plt.gca().set_aspect(\""equal\"", adjustable=\""box\"")\n"", + ""# the unit line\n"", + ""plt.plot(np.arange(x_start, x_end, 0.01*length),\n"", + ""np.arange(x_start, x_end, 0.01*length), '#d62728')\n"", + ""plt.text(80, 25, \""Train $R^2={:.2f}$\"".format(round(r2_score(y_train, y_pred_train),2)),{'color':'#1f77b4'}, fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""plt.text(80, 12, \""Test $R^2 ={:.2f}$\"".format(r2_score(y_test, y_pred_test)),{'color':'#ff7f0e'}, fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""#plt.text(80, 500, \""Dataset_1\"")\n"", + ""plt.title('MRI_Fusion',fontname=\""Times New Roman\"", fontsize=10)\n"", + ""plt.savefig(\""Polyinfo_MRI_FusionModel.png\"", dpi=1200, bbox_inches='tight') "" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### FFNN"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 32, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""Mix_X = []\n"", + ""for i in range(len(DF_MRI[Flag])):\n"", + "" Mix_X.append(X.iloc[0].values * DF_MRI[Flag]['TFEA'].iloc[i] + \\\n"", + "" X.iloc[1].values * DF_MRI[Flag]['HexaFOEA'].iloc[i] + \\\n"", + "" X.iloc[2].values * DF_MRI[Flag]['NonaFOEA'].iloc[i] + \\\n"", + "" X.iloc[3].values * DF_MRI[Flag]['PEGA'].iloc[i] + \\\n"", + "" X.iloc[4].values * DF_MRI[Flag]['HEA'].iloc[i] + \\\n"", + "" X.iloc[5].values * DF_MRI[Flag]['MSEA'].iloc[i])\n"", + ""Mix_X = np.array(Mix_X)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 33, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""(271, 80)"" + ] + }, + ""execution_count"": 33, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""Mix_X.shape"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 34, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""array([[1. , 0. , 0. , ..., 0. , 0.9, 0. ],\n"", + "" [1. , 0.5, 0. , ..., 0. , 0.3, 0. ],\n"", + "" [1. , 0. , 0. , ..., 0. , 0.3, 0. ],\n"", + "" ...,\n"", + "" [1. , 0. , 0. , ..., 0.6, 0.4, 0. ],\n"", + "" [1. , 0. , 0. , ..., 0.6, 0.4, 0. ],\n"", + "" [1. , 0. , 0. , ..., 0.7, 0.3, 0. ]])"" + ] + }, + ""execution_count"": 34, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""Mix_X"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 35, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""x_train, x_test, y_train, y_test = train_test_split(Mix_X, DF_MRI[Flag]['19F NMR Signal-to-Noise Ratioa'].astype(np.float64), test_size=0.2, random_state=11)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 36, + ""metadata"": { + ""scrolled"": true + }, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 1/1000\n"", + ""2/2 - 0s - loss: 5149.1191 - mean_squared_error: 5149.1191 - val_loss: 6177.8447 - val_mean_squared_error: 6177.8447\n"", + ""Epoch 2/1000\n"", + ""2/2 - 0s - loss: 5120.7524 - mean_squared_error: 5120.7524 - val_loss: 6142.8306 - val_mean_squared_error: 6142.8306\n"", + ""Epoch 3/1000\n"", + ""2/2 - 0s - loss: 5089.5396 - mean_squared_error: 5089.5396 - val_loss: 6103.1748 - val_mean_squared_error: 6103.1748\n"", + ""Epoch 4/1000\n"", + ""2/2 - 0s - loss: 5054.0806 - mean_squared_error: 5054.0806 - val_loss: 6060.0840 - val_mean_squared_error: 6060.0840\n"", + ""Epoch 5/1000\n"", + ""2/2 - 0s - loss: 5015.7417 - mean_squared_error: 5015.7417 - val_loss: 6013.5454 - val_mean_squared_error: 6013.5454\n"", + ""Epoch 6/1000\n"", + ""2/2 - 0s - loss: 4973.3491 - mean_squared_error: 4973.3496 - val_loss: 5962.4546 - val_mean_squared_error: 5962.4546\n"", + ""Epoch 7/1000\n"", + ""2/2 - 0s - loss: 4928.0342 - mean_squared_error: 4928.0342 - val_loss: 5906.1084 - val_mean_squared_error: 5906.1084\n"", + ""Epoch 8/1000\n"", + ""2/2 - 0s - loss: 4877.9551 - mean_squared_error: 4877.9551 - val_loss: 5843.7559 - val_mean_squared_error: 5843.7559\n"", + ""Epoch 9/1000\n"", + ""2/2 - 0s - loss: 4822.3130 - mean_squared_error: 4822.3130 - val_loss: 5774.5547 - val_mean_squared_error: 5774.5547\n"", + ""Epoch 10/1000\n"", + ""2/2 - 0s - loss: 4760.1934 - mean_squared_error: 4760.1934 - val_loss: 5697.3521 - val_mean_squared_error: 5697.3521\n"", + ""Epoch 11/1000\n"", + ""2/2 - 0s - loss: 4692.7178 - mean_squared_error: 4692.7178 - val_loss: 5611.7490 - val_mean_squared_error: 5611.7490\n"", + ""Epoch 12/1000\n"", + ""2/2 - 0s - loss: 4615.8169 - mean_squared_error: 4615.8169 - val_loss: 5517.5396 - val_mean_squared_error: 5517.5396\n"", + ""Epoch 13/1000\n"", + ""2/2 - 0s - loss: 4531.8589 - mean_squared_error: 4531.8589 - val_loss: 5415.3843 - val_mean_squared_error: 5415.3843\n"", + ""Epoch 14/1000\n"", + ""2/2 - 0s - loss: 4442.8506 - mean_squared_error: 4442.8506 - val_loss: 5304.5737 - val_mean_squared_error: 5304.5737\n"", + ""Epoch 15/1000\n"", + ""2/2 - 0s - loss: 4342.1475 - mean_squared_error: 4342.1475 - val_loss: 5184.6089 - val_mean_squared_error: 5184.6089\n"", + ""Epoch 16/1000\n"", + ""2/2 - 0s - loss: 4236.1470 - mean_squared_error: 4236.1470 - val_loss: 5054.8398 - val_mean_squared_error: 5054.8398\n"", + ""Epoch 17/1000\n"", + ""2/2 - 0s - loss: 4120.8872 - mean_squared_error: 4120.8872 - val_loss: 4915.1494 - val_mean_squared_error: 4915.1494\n"", + ""Epoch 18/1000\n"", + ""2/2 - 0s - loss: 3999.0808 - mean_squared_error: 3999.0808 - val_loss: 4765.1797 - val_mean_squared_error: 4765.1797\n"", + ""Epoch 19/1000\n"", + ""2/2 - 0s - loss: 3867.7178 - mean_squared_error: 3867.7178 - val_loss: 4605.1489 - val_mean_squared_error: 4605.1489\n"", + ""Epoch 20/1000\n"", + ""2/2 - 0s - loss: 3724.2834 - mean_squared_error: 3724.2834 - val_loss: 4435.1797 - val_mean_squared_error: 4435.1797\n"", + ""Epoch 21/1000\n"", + ""2/2 - 0s - loss: 3575.1213 - mean_squared_error: 3575.1213 - val_loss: 4255.3452 - val_mean_squared_error: 4255.3452\n"", + ""Epoch 22/1000\n"", + ""2/2 - 0s - loss: 3416.0942 - mean_squared_error: 3416.0942 - val_loss: 4066.2581 - val_mean_squared_error: 4066.2581\n"", + ""Epoch 23/1000\n"", + ""2/2 - 0s - loss: 3253.2559 - mean_squared_error: 3253.2559 - val_loss: 3868.0903 - val_mean_squared_error: 3868.0903\n"", + ""Epoch 24/1000\n"", + ""2/2 - 0s - loss: 3083.7012 - mean_squared_error: 3083.7012 - val_loss: 3661.9312 - val_mean_squared_error: 3661.9312\n"", + ""Epoch 25/1000\n"", + ""2/2 - 0s - loss: 2903.0134 - mean_squared_error: 2903.0134 - val_loss: 3449.2466 - val_mean_squared_error: 3449.2466\n"", + ""Epoch 26/1000\n"", + ""2/2 - 0s - loss: 2720.3418 - mean_squared_error: 2720.3418 - val_loss: 3230.6296 - val_mean_squared_error: 3230.6296\n"", + ""Epoch 27/1000\n"", + ""2/2 - 0s - loss: 2534.5454 - mean_squared_error: 2534.5454 - val_loss: 3007.4773 - val_mean_squared_error: 3007.4773\n"", + ""Epoch 28/1000\n"", + ""2/2 - 0s - loss: 2344.5442 - mean_squared_error: 2344.5442 - val_loss: 2781.6267 - val_mean_squared_error: 2781.6267\n"", + ""Epoch 29/1000\n"", + ""2/2 - 0s - loss: 2150.7407 - mean_squared_error: 2150.7407 - val_loss: 2554.8887 - val_mean_squared_error: 2554.8887\n"", + ""Epoch 30/1000\n"", + ""2/2 - 0s - loss: 1961.4364 - mean_squared_error: 1961.4364 - val_loss: 2328.4814 - val_mean_squared_error: 2328.4814\n"", + ""Epoch 31/1000\n"", + ""2/2 - 0s - loss: 1774.9170 - mean_squared_error: 1774.9170 - val_loss: 2104.6194 - val_mean_squared_error: 2104.6194\n"", + ""Epoch 32/1000\n"", + ""2/2 - 0s - loss: 1590.3171 - mean_squared_error: 1590.3171 - val_loss: 1885.7941 - val_mean_squared_error: 1885.7941\n"", + ""Epoch 33/1000\n"", + ""2/2 - 0s - loss: 1414.3568 - mean_squared_error: 1414.3568 - val_loss: 1673.9542 - val_mean_squared_error: 1673.9542\n"", + ""Epoch 34/1000\n"", + ""2/2 - 0s - loss: 1244.2909 - mean_squared_error: 1244.2909 - val_loss: 1471.8049 - val_mean_squared_error: 1471.8049\n"", + ""Epoch 35/1000\n"", + ""2/2 - 0s - loss: 1088.4524 - mean_squared_error: 1088.4524 - val_loss: 1281.2037 - val_mean_squared_error: 1281.2037\n"", + ""Epoch 36/1000\n"", + ""2/2 - 0s - loss: 937.5427 - mean_squared_error: 937.5427 - val_loss: 1105.0385 - val_mean_squared_error: 1105.0385\n"", + ""Epoch 37/1000\n"", + ""2/2 - 0s - loss: 801.7444 - mean_squared_error: 801.7444 - val_loss: 944.3652 - val_mean_squared_error: 944.3652\n"", + ""Epoch 38/1000\n"", + ""2/2 - 0s - loss: 696.2554 - mean_squared_error: 696.2554 - val_loss: 799.4504 - val_mean_squared_error: 799.4504\n"", + ""Epoch 39/1000\n"", + ""2/2 - 0s - loss: 585.8349 - mean_squared_error: 585.8349 - val_loss: 674.4681 - val_mean_squared_error: 674.4681\n"", + ""Epoch 40/1000\n"", + ""2/2 - 0s - loss: 509.5052 - mean_squared_error: 509.5052 - val_loss: 567.2712 - val_mean_squared_error: 567.2712\n"", + ""Epoch 41/1000\n"", + ""2/2 - 0s - loss: 439.4625 - mean_squared_error: 439.4625 - val_loss: 479.4211 - val_mean_squared_error: 479.4211\n"", + ""Epoch 42/1000\n"", + ""2/2 - 0s - loss: 388.0716 - mean_squared_error: 388.0716 - val_loss: 409.2782 - val_mean_squared_error: 409.2782\n"", + ""Epoch 43/1000\n"", + ""2/2 - 0s - loss: 351.4087 - mean_squared_error: 351.4087 - val_loss: 355.2188 - val_mean_squared_error: 355.2188\n"", + ""Epoch 44/1000\n"", + ""2/2 - 0s - loss: 331.2639 - mean_squared_error: 331.2639 - val_loss: 314.9450 - val_mean_squared_error: 314.9450\n"", + ""Epoch 45/1000\n"", + ""2/2 - 0s - loss: 317.1364 - mean_squared_error: 317.1364 - val_loss: 286.7158 - val_mean_squared_error: 286.7158\n"", + ""Epoch 46/1000\n"", + ""2/2 - 0s - loss: 312.7882 - mean_squared_error: 312.7882 - val_loss: 267.6418 - val_mean_squared_error: 267.6418\n"", + ""Epoch 47/1000\n"", + ""2/2 - 0s - loss: 314.1220 - mean_squared_error: 314.1220 - val_loss: 255.3335 - val_mean_squared_error: 255.3335\n"", + ""Epoch 48/1000\n"", + ""2/2 - 0s - loss: 317.0514 - mean_squared_error: 317.0514 - val_loss: 247.8265 - val_mean_squared_error: 247.8265\n"", + ""Epoch 49/1000\n"", + ""2/2 - 0s - loss: 320.8808 - mean_squared_error: 320.8808 - val_loss: 243.3530 - val_mean_squared_error: 243.3530\n"", + ""Epoch 50/1000\n"", + ""2/2 - 0s - loss: 323.7249 - mean_squared_error: 323.7249 - val_loss: 240.7406 - val_mean_squared_error: 240.7406\n"", + ""Epoch 51/1000\n"", + ""2/2 - 0s - loss: 325.1654 - mean_squared_error: 325.1654 - val_loss: 239.2487 - val_mean_squared_error: 239.2487\n"", + ""Epoch 52/1000\n"", + ""2/2 - 0s - loss: 324.6110 - mean_squared_error: 324.6110 - val_loss: 238.6147 - val_mean_squared_error: 238.6147\n"", + ""Epoch 53/1000\n"", + ""2/2 - 0s - loss: 322.5756 - mean_squared_error: 322.5756 - val_loss: 238.6118 - val_mean_squared_error: 238.6118\n"", + ""Epoch 54/1000\n"", + ""2/2 - 0s - loss: 319.2070 - mean_squared_error: 319.2070 - val_loss: 239.2584 - val_mean_squared_error: 239.2584\n"", + ""Epoch 55/1000\n"", + ""2/2 - 0s - loss: 315.5746 - mean_squared_error: 315.5746 - val_loss: 240.7841 - val_mean_squared_error: 240.7841\n"", + ""Epoch 56/1000\n"", + ""2/2 - 0s - loss: 311.9094 - mean_squared_error: 311.9094 - val_loss: 243.1805 - val_mean_squared_error: 243.1805\n"", + ""Epoch 57/1000\n"", + ""2/2 - 0s - loss: 308.1163 - mean_squared_error: 308.1163 - val_loss: 246.1814 - val_mean_squared_error: 246.1814\n"", + ""Epoch 58/1000\n"", + ""2/2 - 0s - loss: 304.5397 - mean_squared_error: 304.5397 - val_loss: 249.5910 - val_mean_squared_error: 249.5910\n"", + ""Epoch 59/1000\n"", + ""2/2 - 0s - loss: 302.1785 - mean_squared_error: 302.1785 - val_loss: 253.2409 - val_mean_squared_error: 253.2409\n"", + ""Epoch 60/1000\n"", + ""2/2 - 0s - loss: 299.5296 - mean_squared_error: 299.5296 - val_loss: 256.6636 - val_mean_squared_error: 256.6636\n"", + ""Epoch 61/1000\n"", + ""2/2 - 0s - loss: 298.0937 - mean_squared_error: 298.0937 - val_loss: 259.9944 - val_mean_squared_error: 259.9944\n"", + ""Epoch 62/1000\n"", + ""2/2 - 0s - loss: 297.1676 - mean_squared_error: 297.1676 - val_loss: 262.9512 - val_mean_squared_error: 262.9512\n"", + ""Epoch 63/1000\n"", + ""2/2 - 0s - loss: 295.6101 - mean_squared_error: 295.6100 - val_loss: 264.8963 - val_mean_squared_error: 264.8963\n"", + ""Epoch 64/1000\n"", + ""2/2 - 0s - loss: 294.6912 - mean_squared_error: 294.6912 - val_loss: 266.2988 - val_mean_squared_error: 266.2988\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 65/1000\n"", + ""2/2 - 0s - loss: 294.0992 - mean_squared_error: 294.0992 - val_loss: 267.2735 - val_mean_squared_error: 267.2735\n"", + ""Epoch 66/1000\n"", + ""2/2 - 0s - loss: 293.0361 - mean_squared_error: 293.0361 - val_loss: 267.1699 - val_mean_squared_error: 267.1699\n"", + ""Epoch 67/1000\n"", + ""2/2 - 0s - loss: 292.1739 - mean_squared_error: 292.1738 - val_loss: 266.5024 - val_mean_squared_error: 266.5024\n"", + ""Epoch 68/1000\n"", + ""2/2 - 0s - loss: 291.2907 - mean_squared_error: 291.2907 - val_loss: 265.1890 - val_mean_squared_error: 265.1890\n"", + ""Epoch 69/1000\n"", + ""2/2 - 0s - loss: 290.2918 - mean_squared_error: 290.2918 - val_loss: 263.6664 - val_mean_squared_error: 263.6664\n"", + ""Epoch 70/1000\n"", + ""2/2 - 0s - loss: 289.2190 - mean_squared_error: 289.2190 - val_loss: 262.1450 - val_mean_squared_error: 262.1450\n"", + ""Epoch 71/1000\n"", + ""2/2 - 0s - loss: 288.2454 - mean_squared_error: 288.2454 - val_loss: 260.4456 - val_mean_squared_error: 260.4456\n"", + ""Epoch 72/1000\n"", + ""2/2 - 0s - loss: 287.2667 - mean_squared_error: 287.2667 - val_loss: 258.7424 - val_mean_squared_error: 258.7424\n"", + ""Epoch 73/1000\n"", + ""2/2 - 0s - loss: 286.2891 - mean_squared_error: 286.2891 - val_loss: 256.8386 - val_mean_squared_error: 256.8386\n"", + ""Epoch 74/1000\n"", + ""2/2 - 0s - loss: 285.3771 - mean_squared_error: 285.3771 - val_loss: 254.9666 - val_mean_squared_error: 254.9666\n"", + ""Epoch 75/1000\n"", + ""2/2 - 0s - loss: 284.3593 - mean_squared_error: 284.3593 - val_loss: 253.4392 - val_mean_squared_error: 253.4392\n"", + ""Epoch 76/1000\n"", + ""2/2 - 0s - loss: 283.4557 - mean_squared_error: 283.4557 - val_loss: 251.4800 - val_mean_squared_error: 251.4800\n"", + ""Epoch 77/1000\n"", + ""2/2 - 0s - loss: 282.5875 - mean_squared_error: 282.5875 - val_loss: 249.5881 - val_mean_squared_error: 249.5881\n"", + ""Epoch 78/1000\n"", + ""2/2 - 0s - loss: 281.7100 - mean_squared_error: 281.7101 - val_loss: 247.9022 - val_mean_squared_error: 247.9022\n"", + ""Epoch 79/1000\n"", + ""2/2 - 0s - loss: 280.7662 - mean_squared_error: 280.7662 - val_loss: 246.6282 - val_mean_squared_error: 246.6282\n"", + ""Epoch 80/1000\n"", + ""2/2 - 0s - loss: 279.9336 - mean_squared_error: 279.9336 - val_loss: 245.6106 - val_mean_squared_error: 245.6106\n"", + ""Epoch 81/1000\n"", + ""2/2 - 0s - loss: 279.0918 - mean_squared_error: 279.0918 - val_loss: 244.4803 - val_mean_squared_error: 244.4803\n"", + ""Epoch 82/1000\n"", + ""2/2 - 0s - loss: 278.2283 - mean_squared_error: 278.2283 - val_loss: 243.3755 - val_mean_squared_error: 243.3755\n"", + ""Epoch 83/1000\n"", + ""2/2 - 0s - loss: 277.3907 - mean_squared_error: 277.3907 - val_loss: 242.4260 - val_mean_squared_error: 242.4260\n"", + ""Epoch 84/1000\n"", + ""2/2 - 0s - loss: 276.6010 - mean_squared_error: 276.6010 - val_loss: 241.3809 - val_mean_squared_error: 241.3809\n"", + ""Epoch 85/1000\n"", + ""2/2 - 0s - loss: 275.7487 - mean_squared_error: 275.7487 - val_loss: 240.7776 - val_mean_squared_error: 240.7776\n"", + ""Epoch 86/1000\n"", + ""2/2 - 0s - loss: 275.0005 - mean_squared_error: 275.0005 - val_loss: 240.3598 - val_mean_squared_error: 240.3598\n"", + ""Epoch 87/1000\n"", + ""2/2 - 0s - loss: 274.1666 - mean_squared_error: 274.1666 - val_loss: 239.4396 - val_mean_squared_error: 239.4396\n"", + ""Epoch 88/1000\n"", + ""2/2 - 0s - loss: 273.3304 - mean_squared_error: 273.3304 - val_loss: 238.7506 - val_mean_squared_error: 238.7506\n"", + ""Epoch 89/1000\n"", + ""2/2 - 0s - loss: 272.5827 - mean_squared_error: 272.5827 - val_loss: 238.2672 - val_mean_squared_error: 238.2672\n"", + ""Epoch 90/1000\n"", + ""2/2 - 0s - loss: 271.7516 - mean_squared_error: 271.7516 - val_loss: 237.6061 - val_mean_squared_error: 237.6061\n"", + ""Epoch 91/1000\n"", + ""2/2 - 0s - loss: 271.0161 - mean_squared_error: 271.0161 - val_loss: 236.5694 - val_mean_squared_error: 236.5694\n"", + ""Epoch 92/1000\n"", + ""2/2 - 0s - loss: 270.2089 - mean_squared_error: 270.2089 - val_loss: 235.8646 - val_mean_squared_error: 235.8646\n"", + ""Epoch 93/1000\n"", + ""2/2 - 0s - loss: 269.4536 - mean_squared_error: 269.4536 - val_loss: 235.1588 - val_mean_squared_error: 235.1588\n"", + ""Epoch 94/1000\n"", + ""2/2 - 0s - loss: 268.7091 - mean_squared_error: 268.7091 - val_loss: 234.3652 - val_mean_squared_error: 234.3652\n"", + ""Epoch 95/1000\n"", + ""2/2 - 0s - loss: 268.0160 - mean_squared_error: 268.0160 - val_loss: 233.5497 - val_mean_squared_error: 233.5497\n"", + ""Epoch 96/1000\n"", + ""2/2 - 0s - loss: 267.2446 - mean_squared_error: 267.2446 - val_loss: 233.0772 - val_mean_squared_error: 233.0772\n"", + ""Epoch 97/1000\n"", + ""2/2 - 0s - loss: 266.5324 - mean_squared_error: 266.5324 - val_loss: 232.6412 - val_mean_squared_error: 232.6412\n"", + ""Epoch 98/1000\n"", + ""2/2 - 0s - loss: 265.8255 - mean_squared_error: 265.8255 - val_loss: 232.4097 - val_mean_squared_error: 232.4097\n"", + ""Epoch 99/1000\n"", + ""2/2 - 0s - loss: 265.0601 - mean_squared_error: 265.0601 - val_loss: 232.2511 - val_mean_squared_error: 232.2511\n"", + ""Epoch 100/1000\n"", + ""2/2 - 0s - loss: 264.4430 - mean_squared_error: 264.4430 - val_loss: 232.1611 - val_mean_squared_error: 232.1611\n"", + ""Epoch 101/1000\n"", + ""2/2 - 0s - loss: 263.7436 - mean_squared_error: 263.7436 - val_loss: 231.6810 - val_mean_squared_error: 231.6810\n"", + ""Epoch 102/1000\n"", + ""2/2 - 0s - loss: 263.0905 - mean_squared_error: 263.0905 - val_loss: 230.8741 - val_mean_squared_error: 230.8741\n"", + ""Epoch 103/1000\n"", + ""2/2 - 0s - loss: 262.3265 - mean_squared_error: 262.3265 - val_loss: 230.3550 - val_mean_squared_error: 230.3550\n"", + ""Epoch 104/1000\n"", + ""2/2 - 0s - loss: 261.7435 - mean_squared_error: 261.7435 - val_loss: 229.8029 - val_mean_squared_error: 229.8029\n"", + ""Epoch 105/1000\n"", + ""2/2 - 0s - loss: 261.0734 - mean_squared_error: 261.0734 - val_loss: 228.9147 - val_mean_squared_error: 228.9147\n"", + ""Epoch 106/1000\n"", + ""2/2 - 0s - loss: 260.3877 - mean_squared_error: 260.3877 - val_loss: 227.7958 - val_mean_squared_error: 227.7958\n"", + ""Epoch 107/1000\n"", + ""2/2 - 0s - loss: 259.7780 - mean_squared_error: 259.7780 - val_loss: 226.2015 - val_mean_squared_error: 226.2015\n"", + ""Epoch 108/1000\n"", + ""2/2 - 0s - loss: 259.0779 - mean_squared_error: 259.0779 - val_loss: 224.9898 - val_mean_squared_error: 224.9898\n"", + ""Epoch 109/1000\n"", + ""2/2 - 0s - loss: 258.4588 - mean_squared_error: 258.4588 - val_loss: 223.7741 - val_mean_squared_error: 223.7741\n"", + ""Epoch 110/1000\n"", + ""2/2 - 0s - loss: 257.9015 - mean_squared_error: 257.9015 - val_loss: 222.7280 - val_mean_squared_error: 222.7280\n"", + ""Epoch 111/1000\n"", + ""2/2 - 0s - loss: 257.1772 - mean_squared_error: 257.1772 - val_loss: 222.1597 - val_mean_squared_error: 222.1597\n"", + ""Epoch 112/1000\n"", + ""2/2 - 0s - loss: 256.6436 - mean_squared_error: 256.6436 - val_loss: 221.8186 - val_mean_squared_error: 221.8186\n"", + ""Epoch 113/1000\n"", + ""2/2 - 0s - loss: 255.9680 - mean_squared_error: 255.9680 - val_loss: 221.1383 - val_mean_squared_error: 221.1383\n"", + ""Epoch 114/1000\n"", + ""2/2 - 0s - loss: 255.3101 - mean_squared_error: 255.3101 - val_loss: 220.4696 - val_mean_squared_error: 220.4696\n"", + ""Epoch 115/1000\n"", + ""2/2 - 0s - loss: 254.8110 - mean_squared_error: 254.8110 - val_loss: 220.0155 - val_mean_squared_error: 220.0155\n"", + ""Epoch 116/1000\n"", + ""2/2 - 0s - loss: 254.1819 - mean_squared_error: 254.1819 - val_loss: 219.3425 - val_mean_squared_error: 219.3425\n"", + ""Epoch 117/1000\n"", + ""2/2 - 0s - loss: 253.6034 - mean_squared_error: 253.6034 - val_loss: 218.3591 - val_mean_squared_error: 218.3591\n"", + ""Epoch 118/1000\n"", + ""2/2 - 0s - loss: 253.0277 - mean_squared_error: 253.0277 - val_loss: 217.7372 - val_mean_squared_error: 217.7372\n"", + ""Epoch 119/1000\n"", + ""2/2 - 0s - loss: 252.4359 - mean_squared_error: 252.4359 - val_loss: 217.0288 - val_mean_squared_error: 217.0288\n"", + ""Epoch 120/1000\n"", + ""2/2 - 0s - loss: 251.8824 - mean_squared_error: 251.8824 - val_loss: 216.1938 - val_mean_squared_error: 216.1938\n"", + ""Epoch 121/1000\n"", + ""2/2 - 0s - loss: 251.3341 - mean_squared_error: 251.3341 - val_loss: 215.2463 - val_mean_squared_error: 215.2463\n"", + ""Epoch 122/1000\n"", + ""2/2 - 0s - loss: 250.8268 - mean_squared_error: 250.8269 - val_loss: 214.3117 - val_mean_squared_error: 214.3117\n"", + ""Epoch 123/1000\n"", + ""2/2 - 0s - loss: 250.3253 - mean_squared_error: 250.3253 - val_loss: 213.9868 - val_mean_squared_error: 213.9868\n"", + ""Epoch 124/1000\n"", + ""2/2 - 0s - loss: 249.7816 - mean_squared_error: 249.7816 - val_loss: 213.1724 - val_mean_squared_error: 213.1724\n"", + ""Epoch 125/1000\n"", + ""2/2 - 0s - loss: 249.1810 - mean_squared_error: 249.1810 - val_loss: 212.7913 - val_mean_squared_error: 212.7913\n"", + ""Epoch 126/1000\n"", + ""2/2 - 0s - loss: 248.6868 - mean_squared_error: 248.6868 - val_loss: 212.3846 - val_mean_squared_error: 212.3846\n"", + ""Epoch 127/1000\n"", + ""2/2 - 0s - loss: 248.1442 - mean_squared_error: 248.1442 - val_loss: 212.0434 - val_mean_squared_error: 212.0434\n"", + ""Epoch 128/1000\n"", + ""2/2 - 0s - loss: 247.6998 - mean_squared_error: 247.6998 - val_loss: 211.7859 - val_mean_squared_error: 211.7859\n"", + ""Epoch 129/1000\n"", + ""2/2 - 0s - loss: 247.1817 - mean_squared_error: 247.1817 - val_loss: 211.9305 - val_mean_squared_error: 211.9305\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 130/1000\n"", + ""2/2 - 0s - loss: 246.7040 - mean_squared_error: 246.7040 - val_loss: 211.9425 - val_mean_squared_error: 211.9425\n"", + ""Epoch 131/1000\n"", + ""2/2 - 0s - loss: 246.1660 - mean_squared_error: 246.1660 - val_loss: 211.5406 - val_mean_squared_error: 211.5406\n"", + ""Epoch 132/1000\n"", + ""2/2 - 0s - loss: 245.6883 - mean_squared_error: 245.6883 - val_loss: 211.1806 - val_mean_squared_error: 211.1806\n"", + ""Epoch 133/1000\n"", + ""2/2 - 0s - loss: 245.2231 - mean_squared_error: 245.2231 - val_loss: 211.0454 - val_mean_squared_error: 211.0454\n"", + ""Epoch 134/1000\n"", + ""2/2 - 0s - loss: 244.7470 - mean_squared_error: 244.7470 - val_loss: 210.6545 - val_mean_squared_error: 210.6545\n"", + ""Epoch 135/1000\n"", + ""2/2 - 0s - loss: 244.3302 - mean_squared_error: 244.3302 - val_loss: 210.2353 - val_mean_squared_error: 210.2353\n"", + ""Epoch 136/1000\n"", + ""2/2 - 0s - loss: 243.8458 - mean_squared_error: 243.8458 - val_loss: 210.2720 - val_mean_squared_error: 210.2720\n"", + ""Epoch 137/1000\n"", + ""2/2 - 0s - loss: 243.3546 - mean_squared_error: 243.3546 - val_loss: 210.1117 - val_mean_squared_error: 210.1117\n"", + ""Epoch 138/1000\n"", + ""2/2 - 0s - loss: 243.0417 - mean_squared_error: 243.0417 - val_loss: 209.9688 - val_mean_squared_error: 209.9688\n"", + ""Epoch 139/1000\n"", + ""2/2 - 0s - loss: 242.6213 - mean_squared_error: 242.6213 - val_loss: 208.9330 - val_mean_squared_error: 208.9330\n"", + ""Epoch 140/1000\n"", + ""2/2 - 0s - loss: 242.0505 - mean_squared_error: 242.0505 - val_loss: 208.5070 - val_mean_squared_error: 208.5070\n"", + ""Epoch 141/1000\n"", + ""2/2 - 0s - loss: 241.6619 - mean_squared_error: 241.6619 - val_loss: 207.7325 - val_mean_squared_error: 207.7325\n"", + ""Epoch 142/1000\n"", + ""2/2 - 0s - loss: 241.3038 - mean_squared_error: 241.3038 - val_loss: 207.1589 - val_mean_squared_error: 207.1589\n"", + ""Epoch 143/1000\n"", + ""2/2 - 0s - loss: 240.7254 - mean_squared_error: 240.7254 - val_loss: 207.1363 - val_mean_squared_error: 207.1363\n"", + ""Epoch 144/1000\n"", + ""2/2 - 0s - loss: 240.3514 - mean_squared_error: 240.3514 - val_loss: 207.2340 - val_mean_squared_error: 207.2340\n"", + ""Epoch 145/1000\n"", + ""2/2 - 0s - loss: 239.9590 - mean_squared_error: 239.9590 - val_loss: 207.2807 - val_mean_squared_error: 207.2807\n"", + ""Epoch 146/1000\n"", + ""2/2 - 0s - loss: 239.5711 - mean_squared_error: 239.5711 - val_loss: 206.9659 - val_mean_squared_error: 206.9659\n"", + ""Epoch 147/1000\n"", + ""2/2 - 0s - loss: 239.2021 - mean_squared_error: 239.2021 - val_loss: 206.6406 - val_mean_squared_error: 206.6406\n"", + ""Epoch 148/1000\n"", + ""2/2 - 0s - loss: 238.8062 - mean_squared_error: 238.8062 - val_loss: 205.7293 - val_mean_squared_error: 205.7293\n"", + ""Epoch 149/1000\n"", + ""2/2 - 0s - loss: 238.3374 - mean_squared_error: 238.3374 - val_loss: 204.9753 - val_mean_squared_error: 204.9753\n"", + ""Epoch 150/1000\n"", + ""2/2 - 0s - loss: 237.9738 - mean_squared_error: 237.9738 - val_loss: 204.1889 - val_mean_squared_error: 204.1889\n"", + ""Epoch 151/1000\n"", + ""2/2 - 0s - loss: 237.5788 - mean_squared_error: 237.5788 - val_loss: 203.3116 - val_mean_squared_error: 203.3116\n"", + ""Epoch 152/1000\n"", + ""2/2 - 0s - loss: 237.2421 - mean_squared_error: 237.2421 - val_loss: 202.1290 - val_mean_squared_error: 202.1290\n"", + ""Epoch 153/1000\n"", + ""2/2 - 0s - loss: 236.8861 - mean_squared_error: 236.8861 - val_loss: 201.0438 - val_mean_squared_error: 201.0438\n"", + ""Epoch 154/1000\n"", + ""2/2 - 0s - loss: 236.4911 - mean_squared_error: 236.4911 - val_loss: 200.4445 - val_mean_squared_error: 200.4445\n"", + ""Epoch 155/1000\n"", + ""2/2 - 0s - loss: 236.1690 - mean_squared_error: 236.1690 - val_loss: 199.9808 - val_mean_squared_error: 199.9808\n"", + ""Epoch 156/1000\n"", + ""2/2 - 0s - loss: 235.7535 - mean_squared_error: 235.7535 - val_loss: 199.8987 - val_mean_squared_error: 199.8987\n"", + ""Epoch 157/1000\n"", + ""2/2 - 0s - loss: 235.4288 - mean_squared_error: 235.4288 - val_loss: 199.7331 - val_mean_squared_error: 199.7331\n"", + ""Epoch 158/1000\n"", + ""2/2 - 0s - loss: 235.1043 - mean_squared_error: 235.1043 - val_loss: 199.6413 - val_mean_squared_error: 199.6413\n"", + ""Epoch 159/1000\n"", + ""2/2 - 0s - loss: 234.7689 - mean_squared_error: 234.7689 - val_loss: 199.2634 - val_mean_squared_error: 199.2634\n"", + ""Epoch 160/1000\n"", + ""2/2 - 0s - loss: 234.3832 - mean_squared_error: 234.3832 - val_loss: 198.4601 - val_mean_squared_error: 198.4601\n"", + ""Epoch 161/1000\n"", + ""2/2 - 0s - loss: 234.0925 - mean_squared_error: 234.0925 - val_loss: 197.7511 - val_mean_squared_error: 197.7511\n"", + ""Epoch 162/1000\n"", + ""2/2 - 0s - loss: 233.7434 - mean_squared_error: 233.7434 - val_loss: 197.0728 - val_mean_squared_error: 197.0728\n"", + ""Epoch 163/1000\n"", + ""2/2 - 0s - loss: 233.4154 - mean_squared_error: 233.4154 - val_loss: 196.5844 - val_mean_squared_error: 196.5844\n"", + ""Epoch 164/1000\n"", + ""2/2 - 0s - loss: 233.1516 - mean_squared_error: 233.1516 - val_loss: 196.4749 - val_mean_squared_error: 196.4749\n"", + ""Epoch 165/1000\n"", + ""2/2 - 0s - loss: 232.7586 - mean_squared_error: 232.7586 - val_loss: 195.9635 - val_mean_squared_error: 195.9635\n"", + ""Epoch 166/1000\n"", + ""2/2 - 0s - loss: 232.5283 - mean_squared_error: 232.5283 - val_loss: 195.4467 - val_mean_squared_error: 195.4467\n"", + ""Epoch 167/1000\n"", + ""2/2 - 0s - loss: 232.2244 - mean_squared_error: 232.2244 - val_loss: 195.3013 - val_mean_squared_error: 195.3013\n"", + ""Epoch 168/1000\n"", + ""2/2 - 0s - loss: 231.8307 - mean_squared_error: 231.8307 - val_loss: 194.8918 - val_mean_squared_error: 194.8918\n"", + ""Epoch 169/1000\n"", + ""2/2 - 0s - loss: 231.5979 - mean_squared_error: 231.5979 - val_loss: 194.3653 - val_mean_squared_error: 194.3653\n"", + ""Epoch 170/1000\n"", + ""2/2 - 0s - loss: 231.3178 - mean_squared_error: 231.3178 - val_loss: 194.1662 - val_mean_squared_error: 194.1662\n"", + ""Epoch 171/1000\n"", + ""2/2 - 0s - loss: 230.9747 - mean_squared_error: 230.9747 - val_loss: 193.7631 - val_mean_squared_error: 193.7631\n"", + ""Epoch 172/1000\n"", + ""2/2 - 0s - loss: 230.7225 - mean_squared_error: 230.7225 - val_loss: 193.4834 - val_mean_squared_error: 193.4834\n"", + ""Epoch 173/1000\n"", + ""2/2 - 0s - loss: 230.4353 - mean_squared_error: 230.4353 - val_loss: 193.5894 - val_mean_squared_error: 193.5894\n"", + ""Epoch 174/1000\n"", + ""2/2 - 0s - loss: 230.1334 - mean_squared_error: 230.1334 - val_loss: 193.3644 - val_mean_squared_error: 193.3644\n"", + ""Epoch 175/1000\n"", + ""2/2 - 0s - loss: 229.8992 - mean_squared_error: 229.8992 - val_loss: 193.3018 - val_mean_squared_error: 193.3018\n"", + ""Epoch 176/1000\n"", + ""2/2 - 0s - loss: 229.5992 - mean_squared_error: 229.5992 - val_loss: 192.8671 - val_mean_squared_error: 192.8671\n"", + ""Epoch 177/1000\n"", + ""2/2 - 0s - loss: 229.3600 - mean_squared_error: 229.3600 - val_loss: 192.3400 - val_mean_squared_error: 192.3400\n"", + ""Epoch 178/1000\n"", + ""2/2 - 0s - loss: 229.1318 - mean_squared_error: 229.1318 - val_loss: 192.0173 - val_mean_squared_error: 192.0173\n"", + ""Epoch 179/1000\n"", + ""2/2 - 0s - loss: 228.9411 - mean_squared_error: 228.9411 - val_loss: 192.4246 - val_mean_squared_error: 192.4246\n"", + ""Epoch 180/1000\n"", + ""2/2 - 0s - loss: 228.5189 - mean_squared_error: 228.5189 - val_loss: 192.0663 - val_mean_squared_error: 192.0663\n"", + ""Epoch 181/1000\n"", + ""2/2 - 0s - loss: 228.2788 - mean_squared_error: 228.2788 - val_loss: 191.6651 - val_mean_squared_error: 191.6651\n"", + ""Epoch 182/1000\n"", + ""2/2 - 0s - loss: 228.0656 - mean_squared_error: 228.0656 - val_loss: 191.0226 - val_mean_squared_error: 191.0226\n"", + ""Epoch 183/1000\n"", + ""2/2 - 0s - loss: 227.7759 - mean_squared_error: 227.7759 - val_loss: 190.6131 - val_mean_squared_error: 190.6131\n"", + ""Epoch 184/1000\n"", + ""2/2 - 0s - loss: 227.5048 - mean_squared_error: 227.5048 - val_loss: 189.9933 - val_mean_squared_error: 189.9933\n"", + ""Epoch 185/1000\n"", + ""2/2 - 0s - loss: 227.3849 - mean_squared_error: 227.3849 - val_loss: 189.2276 - val_mean_squared_error: 189.2276\n"", + ""Epoch 186/1000\n"", + ""2/2 - 0s - loss: 227.0198 - mean_squared_error: 227.0198 - val_loss: 189.1936 - val_mean_squared_error: 189.1936\n"", + ""Epoch 187/1000\n"", + ""2/2 - 0s - loss: 226.7950 - mean_squared_error: 226.7950 - val_loss: 189.0866 - val_mean_squared_error: 189.0866\n"", + ""Epoch 188/1000\n"", + ""2/2 - 0s - loss: 226.5342 - mean_squared_error: 226.5342 - val_loss: 188.8029 - val_mean_squared_error: 188.8029\n"", + ""Epoch 189/1000\n"", + ""2/2 - 0s - loss: 226.3508 - mean_squared_error: 226.3508 - val_loss: 188.5239 - val_mean_squared_error: 188.5239\n"", + ""Epoch 190/1000\n"", + ""2/2 - 0s - loss: 226.0817 - mean_squared_error: 226.0817 - val_loss: 188.7925 - val_mean_squared_error: 188.7925\n"", + ""Epoch 191/1000\n"", + ""2/2 - 0s - loss: 225.8408 - mean_squared_error: 225.8408 - val_loss: 188.8886 - val_mean_squared_error: 188.8886\n"", + ""Epoch 192/1000\n"", + ""2/2 - 0s - loss: 225.6371 - mean_squared_error: 225.6371 - val_loss: 188.9233 - val_mean_squared_error: 188.9233\n"", + ""Epoch 193/1000\n"", + ""2/2 - 0s - loss: 225.3994 - mean_squared_error: 225.3994 - val_loss: 188.5197 - val_mean_squared_error: 188.5197\n"", + ""Epoch 194/1000\n"", + ""2/2 - 0s - loss: 225.2084 - mean_squared_error: 225.2084 - val_loss: 188.4268 - val_mean_squared_error: 188.4268\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 195/1000\n"", + ""2/2 - 0s - loss: 224.9482 - mean_squared_error: 224.9482 - val_loss: 187.6868 - val_mean_squared_error: 187.6868\n"", + ""Epoch 196/1000\n"", + ""2/2 - 0s - loss: 224.7349 - mean_squared_error: 224.7349 - val_loss: 187.0304 - val_mean_squared_error: 187.0304\n"", + ""Epoch 197/1000\n"", + ""2/2 - 0s - loss: 224.4926 - mean_squared_error: 224.4926 - val_loss: 186.6628 - val_mean_squared_error: 186.6628\n"", + ""Epoch 198/1000\n"", + ""2/2 - 0s - loss: 224.3835 - mean_squared_error: 224.3835 - val_loss: 186.0186 - val_mean_squared_error: 186.0186\n"", + ""Epoch 199/1000\n"", + ""2/2 - 0s - loss: 224.0524 - mean_squared_error: 224.0524 - val_loss: 185.8984 - val_mean_squared_error: 185.8984\n"", + ""Epoch 200/1000\n"", + ""2/2 - 0s - loss: 223.9188 - mean_squared_error: 223.9188 - val_loss: 185.6880 - val_mean_squared_error: 185.6880\n"", + ""Epoch 201/1000\n"", + ""2/2 - 0s - loss: 223.6675 - mean_squared_error: 223.6675 - val_loss: 185.7718 - val_mean_squared_error: 185.7718\n"", + ""Epoch 202/1000\n"", + ""2/2 - 0s - loss: 223.4423 - mean_squared_error: 223.4423 - val_loss: 185.9151 - val_mean_squared_error: 185.9151\n"", + ""Epoch 203/1000\n"", + ""2/2 - 0s - loss: 223.2780 - mean_squared_error: 223.2780 - val_loss: 186.0306 - val_mean_squared_error: 186.0306\n"", + ""Epoch 204/1000\n"", + ""2/2 - 0s - loss: 223.0902 - mean_squared_error: 223.0902 - val_loss: 185.7968 - val_mean_squared_error: 185.7968\n"", + ""Epoch 205/1000\n"", + ""2/2 - 0s - loss: 222.8554 - mean_squared_error: 222.8554 - val_loss: 185.6023 - val_mean_squared_error: 185.6023\n"", + ""Epoch 206/1000\n"", + ""2/2 - 0s - loss: 222.6870 - mean_squared_error: 222.6870 - val_loss: 185.1980 - val_mean_squared_error: 185.1980\n"", + ""Epoch 207/1000\n"", + ""2/2 - 0s - loss: 222.5265 - mean_squared_error: 222.5265 - val_loss: 184.6832 - val_mean_squared_error: 184.6832\n"", + ""Epoch 208/1000\n"", + ""2/2 - 0s - loss: 222.3174 - mean_squared_error: 222.3174 - val_loss: 184.6007 - val_mean_squared_error: 184.6007\n"", + ""Epoch 209/1000\n"", + ""2/2 - 0s - loss: 222.0927 - mean_squared_error: 222.0927 - val_loss: 184.2227 - val_mean_squared_error: 184.2227\n"", + ""Epoch 210/1000\n"", + ""2/2 - 0s - loss: 221.9477 - mean_squared_error: 221.9477 - val_loss: 183.8792 - val_mean_squared_error: 183.8792\n"", + ""Epoch 211/1000\n"", + ""2/2 - 0s - loss: 221.7030 - mean_squared_error: 221.7030 - val_loss: 183.0833 - val_mean_squared_error: 183.0833\n"", + ""Epoch 212/1000\n"", + ""2/2 - 0s - loss: 221.5096 - mean_squared_error: 221.5096 - val_loss: 182.3466 - val_mean_squared_error: 182.3466\n"", + ""Epoch 213/1000\n"", + ""2/2 - 0s - loss: 221.3465 - mean_squared_error: 221.3465 - val_loss: 181.5027 - val_mean_squared_error: 181.5027\n"", + ""Epoch 214/1000\n"", + ""2/2 - 0s - loss: 221.1617 - mean_squared_error: 221.1617 - val_loss: 180.8170 - val_mean_squared_error: 180.8170\n"", + ""Epoch 215/1000\n"", + ""2/2 - 0s - loss: 221.0184 - mean_squared_error: 221.0184 - val_loss: 179.9768 - val_mean_squared_error: 179.9768\n"", + ""Epoch 216/1000\n"", + ""2/2 - 0s - loss: 220.8565 - mean_squared_error: 220.8565 - val_loss: 179.5083 - val_mean_squared_error: 179.5083\n"", + ""Epoch 217/1000\n"", + ""2/2 - 0s - loss: 220.6568 - mean_squared_error: 220.6568 - val_loss: 179.4553 - val_mean_squared_error: 179.4553\n"", + ""Epoch 218/1000\n"", + ""2/2 - 0s - loss: 220.4709 - mean_squared_error: 220.4709 - val_loss: 179.8138 - val_mean_squared_error: 179.8138\n"", + ""Epoch 219/1000\n"", + ""2/2 - 0s - loss: 220.2716 - mean_squared_error: 220.2716 - val_loss: 180.2135 - val_mean_squared_error: 180.2135\n"", + ""Epoch 220/1000\n"", + ""2/2 - 0s - loss: 220.1117 - mean_squared_error: 220.1117 - val_loss: 180.4285 - val_mean_squared_error: 180.4285\n"", + ""Epoch 221/1000\n"", + ""2/2 - 0s - loss: 219.9233 - mean_squared_error: 219.9233 - val_loss: 180.8868 - val_mean_squared_error: 180.8868\n"", + ""Epoch 222/1000\n"", + ""2/2 - 0s - loss: 219.7502 - mean_squared_error: 219.7502 - val_loss: 181.3656 - val_mean_squared_error: 181.3656\n"", + ""Epoch 223/1000\n"", + ""2/2 - 0s - loss: 219.6214 - mean_squared_error: 219.6214 - val_loss: 181.6403 - val_mean_squared_error: 181.6403\n"", + ""Epoch 224/1000\n"", + ""2/2 - 0s - loss: 219.4989 - mean_squared_error: 219.4989 - val_loss: 181.8790 - val_mean_squared_error: 181.8790\n"", + ""Epoch 225/1000\n"", + ""2/2 - 0s - loss: 219.3440 - mean_squared_error: 219.3440 - val_loss: 181.3301 - val_mean_squared_error: 181.3301\n"", + ""Epoch 226/1000\n"", + ""2/2 - 0s - loss: 219.1380 - mean_squared_error: 219.1380 - val_loss: 181.1310 - val_mean_squared_error: 181.1310\n"", + ""Epoch 227/1000\n"", + ""2/2 - 0s - loss: 218.9883 - mean_squared_error: 218.9883 - val_loss: 180.7295 - val_mean_squared_error: 180.7295\n"", + ""Epoch 228/1000\n"", + ""2/2 - 0s - loss: 218.8270 - mean_squared_error: 218.8270 - val_loss: 179.9314 - val_mean_squared_error: 179.9314\n"", + ""Epoch 229/1000\n"", + ""2/2 - 0s - loss: 218.6430 - mean_squared_error: 218.6430 - val_loss: 179.1961 - val_mean_squared_error: 179.1961\n"", + ""Epoch 230/1000\n"", + ""2/2 - 0s - loss: 218.4997 - mean_squared_error: 218.4997 - val_loss: 178.2847 - val_mean_squared_error: 178.2847\n"", + ""Epoch 231/1000\n"", + ""2/2 - 0s - loss: 218.3818 - mean_squared_error: 218.3818 - val_loss: 177.5445 - val_mean_squared_error: 177.5445\n"", + ""Epoch 232/1000\n"", + ""2/2 - 0s - loss: 218.2419 - mean_squared_error: 218.2419 - val_loss: 177.1660 - val_mean_squared_error: 177.1660\n"", + ""Epoch 233/1000\n"", + ""2/2 - 0s - loss: 218.1416 - mean_squared_error: 218.1416 - val_loss: 177.5281 - val_mean_squared_error: 177.5281\n"", + ""Epoch 234/1000\n"", + ""2/2 - 0s - loss: 217.8951 - mean_squared_error: 217.8951 - val_loss: 177.2680 - val_mean_squared_error: 177.2680\n"", + ""Epoch 235/1000\n"", + ""2/2 - 0s - loss: 217.7371 - mean_squared_error: 217.7371 - val_loss: 177.0607 - val_mean_squared_error: 177.0607\n"", + ""Epoch 236/1000\n"", + ""2/2 - 0s - loss: 217.6345 - mean_squared_error: 217.6345 - val_loss: 176.7234 - val_mean_squared_error: 176.7234\n"", + ""Epoch 237/1000\n"", + ""2/2 - 0s - loss: 217.4913 - mean_squared_error: 217.4913 - val_loss: 177.0253 - val_mean_squared_error: 177.0253\n"", + ""Epoch 238/1000\n"", + ""2/2 - 0s - loss: 217.3535 - mean_squared_error: 217.3535 - val_loss: 177.0861 - val_mean_squared_error: 177.0861\n"", + ""Epoch 239/1000\n"", + ""2/2 - 0s - loss: 217.1639 - mean_squared_error: 217.1639 - val_loss: 176.5987 - val_mean_squared_error: 176.5987\n"", + ""Epoch 240/1000\n"", + ""2/2 - 0s - loss: 216.9959 - mean_squared_error: 216.9959 - val_loss: 176.3453 - val_mean_squared_error: 176.3453\n"", + ""Epoch 241/1000\n"", + ""2/2 - 0s - loss: 216.8594 - mean_squared_error: 216.8594 - val_loss: 176.1257 - val_mean_squared_error: 176.1257\n"", + ""Epoch 242/1000\n"", + ""2/2 - 0s - loss: 216.7258 - mean_squared_error: 216.7258 - val_loss: 175.8761 - val_mean_squared_error: 175.8761\n"", + ""Epoch 243/1000\n"", + ""2/2 - 0s - loss: 216.5635 - mean_squared_error: 216.5635 - val_loss: 175.5763 - val_mean_squared_error: 175.5763\n"", + ""Epoch 244/1000\n"", + ""2/2 - 0s - loss: 216.5798 - mean_squared_error: 216.5798 - val_loss: 174.9774 - val_mean_squared_error: 174.9774\n"", + ""Epoch 245/1000\n"", + ""2/2 - 0s - loss: 216.4008 - mean_squared_error: 216.4008 - val_loss: 175.4396 - val_mean_squared_error: 175.4396\n"", + ""Epoch 246/1000\n"", + ""2/2 - 0s - loss: 216.1761 - mean_squared_error: 216.1761 - val_loss: 175.3409 - val_mean_squared_error: 175.3409\n"", + ""Epoch 247/1000\n"", + ""2/2 - 0s - loss: 216.0548 - mean_squared_error: 216.0548 - val_loss: 174.9576 - val_mean_squared_error: 174.9576\n"", + ""Epoch 248/1000\n"", + ""2/2 - 0s - loss: 215.8783 - mean_squared_error: 215.8783 - val_loss: 174.1557 - val_mean_squared_error: 174.1557\n"", + ""Epoch 249/1000\n"", + ""2/2 - 0s - loss: 215.7392 - mean_squared_error: 215.7392 - val_loss: 173.4572 - val_mean_squared_error: 173.4572\n"", + ""Epoch 250/1000\n"", + ""2/2 - 0s - loss: 215.6329 - mean_squared_error: 215.6329 - val_loss: 172.9558 - val_mean_squared_error: 172.9558\n"", + ""Epoch 251/1000\n"", + ""2/2 - 0s - loss: 215.5559 - mean_squared_error: 215.5559 - val_loss: 172.5586 - val_mean_squared_error: 172.5586\n"", + ""Epoch 252/1000\n"", + ""2/2 - 0s - loss: 215.3766 - mean_squared_error: 215.3766 - val_loss: 172.8285 - val_mean_squared_error: 172.8285\n"", + ""Epoch 253/1000\n"", + ""2/2 - 0s - loss: 215.2527 - mean_squared_error: 215.2527 - val_loss: 173.1314 - val_mean_squared_error: 173.1314\n"", + ""Epoch 254/1000\n"", + ""2/2 - 0s - loss: 215.0755 - mean_squared_error: 215.0755 - val_loss: 173.2844 - val_mean_squared_error: 173.2844\n"", + ""Epoch 255/1000\n"", + ""2/2 - 0s - loss: 214.9646 - mean_squared_error: 214.9646 - val_loss: 173.3251 - val_mean_squared_error: 173.3251\n"", + ""Epoch 256/1000\n"", + ""2/2 - 0s - loss: 214.8548 - mean_squared_error: 214.8548 - val_loss: 173.7775 - val_mean_squared_error: 173.7775\n"", + ""Epoch 257/1000\n"", + ""2/2 - 0s - loss: 214.7026 - mean_squared_error: 214.7026 - val_loss: 174.0090 - val_mean_squared_error: 174.0090\n"", + ""Epoch 258/1000\n"", + ""2/2 - 0s - loss: 214.6229 - mean_squared_error: 214.6229 - val_loss: 173.8223 - val_mean_squared_error: 173.8223\n"", + ""Epoch 259/1000\n"", + ""2/2 - 0s - loss: 214.4369 - mean_squared_error: 214.4369 - val_loss: 174.0665 - val_mean_squared_error: 174.0665\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 260/1000\n"", + ""2/2 - 0s - loss: 214.3379 - mean_squared_error: 214.3379 - val_loss: 174.2537 - val_mean_squared_error: 174.2537\n"", + ""Epoch 261/1000\n"", + ""2/2 - 0s - loss: 214.2279 - mean_squared_error: 214.2279 - val_loss: 174.3071 - val_mean_squared_error: 174.3071\n"", + ""Epoch 262/1000\n"", + ""2/2 - 0s - loss: 214.1971 - mean_squared_error: 214.1971 - val_loss: 174.2337 - val_mean_squared_error: 174.2337\n"", + ""Epoch 263/1000\n"", + ""2/2 - 0s - loss: 213.9671 - mean_squared_error: 213.9671 - val_loss: 173.2092 - val_mean_squared_error: 173.2092\n"", + ""Epoch 264/1000\n"", + ""2/2 - 0s - loss: 213.8352 - mean_squared_error: 213.8352 - val_loss: 172.5052 - val_mean_squared_error: 172.5052\n"", + ""Epoch 265/1000\n"", + ""2/2 - 0s - loss: 213.7164 - mean_squared_error: 213.7164 - val_loss: 171.5615 - val_mean_squared_error: 171.5615\n"", + ""Epoch 266/1000\n"", + ""2/2 - 0s - loss: 213.7769 - mean_squared_error: 213.7769 - val_loss: 170.1373 - val_mean_squared_error: 170.1373\n"", + ""Epoch 267/1000\n"", + ""2/2 - 0s - loss: 213.6057 - mean_squared_error: 213.6057 - val_loss: 169.5237 - val_mean_squared_error: 169.5237\n"", + ""Epoch 268/1000\n"", + ""2/2 - 0s - loss: 213.4192 - mean_squared_error: 213.4192 - val_loss: 169.6591 - val_mean_squared_error: 169.6591\n"", + ""Epoch 269/1000\n"", + ""2/2 - 0s - loss: 213.3204 - mean_squared_error: 213.3204 - val_loss: 170.3729 - val_mean_squared_error: 170.3729\n"", + ""Epoch 270/1000\n"", + ""2/2 - 0s - loss: 213.1435 - mean_squared_error: 213.1435 - val_loss: 170.6744 - val_mean_squared_error: 170.6744\n"", + ""Epoch 271/1000\n"", + ""2/2 - 0s - loss: 212.9952 - mean_squared_error: 212.9952 - val_loss: 170.8763 - val_mean_squared_error: 170.8763\n"", + ""Epoch 272/1000\n"", + ""2/2 - 0s - loss: 212.9807 - mean_squared_error: 212.9807 - val_loss: 171.3336 - val_mean_squared_error: 171.3336\n"", + ""Epoch 273/1000\n"", + ""2/2 - 0s - loss: 212.8111 - mean_squared_error: 212.8111 - val_loss: 171.2284 - val_mean_squared_error: 171.2284\n"", + ""Epoch 274/1000\n"", + ""2/2 - 0s - loss: 212.6763 - mean_squared_error: 212.6763 - val_loss: 170.8638 - val_mean_squared_error: 170.8638\n"", + ""Epoch 275/1000\n"", + ""2/2 - 0s - loss: 212.5777 - mean_squared_error: 212.5777 - val_loss: 170.5216 - val_mean_squared_error: 170.5216\n"", + ""Epoch 276/1000\n"", + ""2/2 - 0s - loss: 212.5290 - mean_squared_error: 212.5290 - val_loss: 169.6135 - val_mean_squared_error: 169.6135\n"", + ""Epoch 277/1000\n"", + ""2/2 - 0s - loss: 212.3538 - mean_squared_error: 212.3538 - val_loss: 169.3460 - val_mean_squared_error: 169.3460\n"", + ""Epoch 278/1000\n"", + ""2/2 - 0s - loss: 212.2509 - mean_squared_error: 212.2509 - val_loss: 169.2213 - val_mean_squared_error: 169.2213\n"", + ""Epoch 279/1000\n"", + ""2/2 - 0s - loss: 212.1356 - mean_squared_error: 212.1356 - val_loss: 168.8046 - val_mean_squared_error: 168.8046\n"", + ""Epoch 280/1000\n"", + ""2/2 - 0s - loss: 212.0123 - mean_squared_error: 212.0123 - val_loss: 168.4657 - val_mean_squared_error: 168.4657\n"", + ""Epoch 281/1000\n"", + ""2/2 - 0s - loss: 211.9997 - mean_squared_error: 211.9997 - val_loss: 168.0829 - val_mean_squared_error: 168.0829\n"", + ""Epoch 282/1000\n"", + ""2/2 - 0s - loss: 211.8376 - mean_squared_error: 211.8376 - val_loss: 168.4459 - val_mean_squared_error: 168.4459\n"", + ""Epoch 283/1000\n"", + ""2/2 - 0s - loss: 211.7117 - mean_squared_error: 211.7117 - val_loss: 168.7081 - val_mean_squared_error: 168.7081\n"", + ""Epoch 284/1000\n"", + ""2/2 - 0s - loss: 211.6447 - mean_squared_error: 211.6447 - val_loss: 169.0153 - val_mean_squared_error: 169.0153\n"", + ""Epoch 285/1000\n"", + ""2/2 - 0s - loss: 211.6290 - mean_squared_error: 211.6290 - val_loss: 168.6109 - val_mean_squared_error: 168.6109\n"", + ""Epoch 286/1000\n"", + ""2/2 - 0s - loss: 211.3987 - mean_squared_error: 211.3987 - val_loss: 169.0724 - val_mean_squared_error: 169.0724\n"", + ""Epoch 287/1000\n"", + ""2/2 - 0s - loss: 211.3080 - mean_squared_error: 211.3080 - val_loss: 169.3332 - val_mean_squared_error: 169.3332\n"", + ""Epoch 288/1000\n"", + ""2/2 - 0s - loss: 211.2222 - mean_squared_error: 211.2221 - val_loss: 169.3138 - val_mean_squared_error: 169.3138\n"", + ""Epoch 289/1000\n"", + ""2/2 - 0s - loss: 211.1231 - mean_squared_error: 211.1231 - val_loss: 169.3528 - val_mean_squared_error: 169.3528\n"", + ""Epoch 290/1000\n"", + ""2/2 - 0s - loss: 211.0230 - mean_squared_error: 211.0230 - val_loss: 169.1421 - val_mean_squared_error: 169.1421\n"", + ""Epoch 291/1000\n"", + ""2/2 - 0s - loss: 210.9373 - mean_squared_error: 210.9373 - val_loss: 168.9454 - val_mean_squared_error: 168.9454\n"", + ""Epoch 292/1000\n"", + ""2/2 - 0s - loss: 210.9361 - mean_squared_error: 210.9361 - val_loss: 168.2957 - val_mean_squared_error: 168.2957\n"", + ""Epoch 293/1000\n"", + ""2/2 - 0s - loss: 210.7345 - mean_squared_error: 210.7345 - val_loss: 168.3867 - val_mean_squared_error: 168.3867\n"", + ""Epoch 294/1000\n"", + ""2/2 - 0s - loss: 210.6754 - mean_squared_error: 210.6754 - val_loss: 168.1070 - val_mean_squared_error: 168.1070\n"", + ""Epoch 295/1000\n"", + ""2/2 - 0s - loss: 210.5551 - mean_squared_error: 210.5551 - val_loss: 168.2640 - val_mean_squared_error: 168.2640\n"", + ""Epoch 296/1000\n"", + ""2/2 - 0s - loss: 210.4614 - mean_squared_error: 210.4614 - val_loss: 168.1689 - val_mean_squared_error: 168.1689\n"", + ""Epoch 297/1000\n"", + ""2/2 - 0s - loss: 210.3791 - mean_squared_error: 210.3791 - val_loss: 167.9526 - val_mean_squared_error: 167.9526\n"", + ""Epoch 298/1000\n"", + ""2/2 - 0s - loss: 210.2922 - mean_squared_error: 210.2922 - val_loss: 167.6058 - val_mean_squared_error: 167.6058\n"", + ""Epoch 299/1000\n"", + ""2/2 - 0s - loss: 210.2133 - mean_squared_error: 210.2133 - val_loss: 167.2085 - val_mean_squared_error: 167.2085\n"", + ""Epoch 300/1000\n"", + ""2/2 - 0s - loss: 210.1266 - mean_squared_error: 210.1266 - val_loss: 166.8103 - val_mean_squared_error: 166.8103\n"", + ""Epoch 301/1000\n"", + ""2/2 - 0s - loss: 210.0274 - mean_squared_error: 210.0274 - val_loss: 166.6790 - val_mean_squared_error: 166.6790\n"", + ""Epoch 302/1000\n"", + ""2/2 - 0s - loss: 209.9337 - mean_squared_error: 209.9337 - val_loss: 166.8653 - val_mean_squared_error: 166.8653\n"", + ""Epoch 303/1000\n"", + ""2/2 - 0s - loss: 209.8740 - mean_squared_error: 209.8740 - val_loss: 167.0554 - val_mean_squared_error: 167.0554\n"", + ""Epoch 304/1000\n"", + ""2/2 - 0s - loss: 209.7646 - mean_squared_error: 209.7646 - val_loss: 166.7352 - val_mean_squared_error: 166.7352\n"", + ""Epoch 305/1000\n"", + ""2/2 - 0s - loss: 209.6897 - mean_squared_error: 209.6897 - val_loss: 166.5391 - val_mean_squared_error: 166.5391\n"", + ""Epoch 306/1000\n"", + ""2/2 - 0s - loss: 209.6044 - mean_squared_error: 209.6044 - val_loss: 165.9187 - val_mean_squared_error: 165.9187\n"", + ""Epoch 307/1000\n"", + ""2/2 - 0s - loss: 209.5364 - mean_squared_error: 209.5364 - val_loss: 165.4345 - val_mean_squared_error: 165.4345\n"", + ""Epoch 308/1000\n"", + ""2/2 - 0s - loss: 209.5173 - mean_squared_error: 209.5173 - val_loss: 165.2414 - val_mean_squared_error: 165.2414\n"", + ""Epoch 309/1000\n"", + ""2/2 - 0s - loss: 209.3822 - mean_squared_error: 209.3822 - val_loss: 165.8991 - val_mean_squared_error: 165.8991\n"", + ""Epoch 310/1000\n"", + ""2/2 - 0s - loss: 209.2568 - mean_squared_error: 209.2568 - val_loss: 166.0915 - val_mean_squared_error: 166.0915\n"", + ""Epoch 311/1000\n"", + ""2/2 - 0s - loss: 209.1871 - mean_squared_error: 209.1871 - val_loss: 166.3142 - val_mean_squared_error: 166.3142\n"", + ""Epoch 312/1000\n"", + ""2/2 - 0s - loss: 209.1416 - mean_squared_error: 209.1416 - val_loss: 166.1799 - val_mean_squared_error: 166.1799\n"", + ""Epoch 313/1000\n"", + ""2/2 - 0s - loss: 209.0503 - mean_squared_error: 209.0503 - val_loss: 166.5208 - val_mean_squared_error: 166.5208\n"", + ""Epoch 314/1000\n"", + ""2/2 - 0s - loss: 208.9651 - mean_squared_error: 208.9651 - val_loss: 166.4342 - val_mean_squared_error: 166.4342\n"", + ""Epoch 315/1000\n"", + ""2/2 - 0s - loss: 208.8815 - mean_squared_error: 208.8815 - val_loss: 166.2651 - val_mean_squared_error: 166.2651\n"", + ""Epoch 316/1000\n"", + ""2/2 - 0s - loss: 208.8077 - mean_squared_error: 208.8077 - val_loss: 166.0386 - val_mean_squared_error: 166.0386\n"", + ""Epoch 317/1000\n"", + ""2/2 - 0s - loss: 208.7186 - mean_squared_error: 208.7186 - val_loss: 165.7498 - val_mean_squared_error: 165.7498\n"", + ""Epoch 318/1000\n"", + ""2/2 - 0s - loss: 208.6595 - mean_squared_error: 208.6595 - val_loss: 165.4381 - val_mean_squared_error: 165.4381\n"", + ""Epoch 319/1000\n"", + ""2/2 - 0s - loss: 208.5729 - mean_squared_error: 208.5729 - val_loss: 164.9045 - val_mean_squared_error: 164.9045\n"", + ""Epoch 320/1000\n"", + ""2/2 - 0s - loss: 208.5008 - mean_squared_error: 208.5008 - val_loss: 164.2865 - val_mean_squared_error: 164.2865\n"", + ""Epoch 321/1000\n"", + ""2/2 - 0s - loss: 208.4238 - mean_squared_error: 208.4238 - val_loss: 163.4474 - val_mean_squared_error: 163.4474\n"", + ""Epoch 322/1000\n"", + ""2/2 - 0s - loss: 208.4773 - mean_squared_error: 208.4773 - val_loss: 162.1179 - val_mean_squared_error: 162.1179\n"", + ""Epoch 323/1000\n"", + ""2/2 - 0s - loss: 208.3973 - mean_squared_error: 208.3973 - val_loss: 161.6108 - val_mean_squared_error: 161.6108\n"", + ""Epoch 324/1000\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""2/2 - 0s - loss: 208.2645 - mean_squared_error: 208.2645 - val_loss: 161.8808 - val_mean_squared_error: 161.8808\n"", + ""Epoch 325/1000\n"", + ""2/2 - 0s - loss: 208.3968 - mean_squared_error: 208.3968 - val_loss: 162.8774 - val_mean_squared_error: 162.8774\n"", + ""Epoch 326/1000\n"", + ""2/2 - 0s - loss: 208.0976 - mean_squared_error: 208.0976 - val_loss: 162.9883 - val_mean_squared_error: 162.9883\n"", + ""Epoch 327/1000\n"", + ""2/2 - 0s - loss: 208.0257 - mean_squared_error: 208.0257 - val_loss: 162.6336 - val_mean_squared_error: 162.6336\n"", + ""Epoch 328/1000\n"", + ""2/2 - 0s - loss: 207.9230 - mean_squared_error: 207.9230 - val_loss: 162.8690 - val_mean_squared_error: 162.8690\n"", + ""Epoch 329/1000\n"", + ""2/2 - 0s - loss: 207.8528 - mean_squared_error: 207.8528 - val_loss: 163.1048 - val_mean_squared_error: 163.1048\n"", + ""Epoch 330/1000\n"", + ""2/2 - 0s - loss: 207.7822 - mean_squared_error: 207.7822 - val_loss: 163.2477 - val_mean_squared_error: 163.2477\n"", + ""Epoch 331/1000\n"", + ""2/2 - 0s - loss: 207.7022 - mean_squared_error: 207.7022 - val_loss: 163.0523 - val_mean_squared_error: 163.0523\n"", + ""Epoch 332/1000\n"", + ""2/2 - 0s - loss: 207.6257 - mean_squared_error: 207.6257 - val_loss: 162.8512 - val_mean_squared_error: 162.8512\n"", + ""Epoch 333/1000\n"", + ""2/2 - 0s - loss: 207.5773 - mean_squared_error: 207.5773 - val_loss: 162.7064 - val_mean_squared_error: 162.7064\n"", + ""Epoch 334/1000\n"", + ""2/2 - 0s - loss: 207.4957 - mean_squared_error: 207.4957 - val_loss: 162.4618 - val_mean_squared_error: 162.4618\n"", + ""Epoch 335/1000\n"", + ""2/2 - 0s - loss: 207.4841 - mean_squared_error: 207.4841 - val_loss: 161.7108 - val_mean_squared_error: 161.7108\n"", + ""Epoch 336/1000\n"", + ""2/2 - 0s - loss: 207.3692 - mean_squared_error: 207.3692 - val_loss: 161.4986 - val_mean_squared_error: 161.4986\n"", + ""Epoch 337/1000\n"", + ""2/2 - 0s - loss: 207.2887 - mean_squared_error: 207.2887 - val_loss: 161.6784 - val_mean_squared_error: 161.6784\n"", + ""Epoch 338/1000\n"", + ""2/2 - 0s - loss: 207.2363 - mean_squared_error: 207.2363 - val_loss: 161.8229 - val_mean_squared_error: 161.8229\n"", + ""Epoch 339/1000\n"", + ""2/2 - 0s - loss: 207.1704 - mean_squared_error: 207.1704 - val_loss: 161.5394 - val_mean_squared_error: 161.5394\n"", + ""Epoch 340/1000\n"", + ""2/2 - 0s - loss: 207.0865 - mean_squared_error: 207.0865 - val_loss: 161.5918 - val_mean_squared_error: 161.5918\n"", + ""Epoch 341/1000\n"", + ""2/2 - 0s - loss: 207.1045 - mean_squared_error: 207.1045 - val_loss: 161.3751 - val_mean_squared_error: 161.3751\n"", + ""Epoch 342/1000\n"", + ""2/2 - 0s - loss: 206.9586 - mean_squared_error: 206.9586 - val_loss: 162.0019 - val_mean_squared_error: 162.0019\n"", + ""Epoch 343/1000\n"", + ""2/2 - 0s - loss: 206.8990 - mean_squared_error: 206.8990 - val_loss: 162.2092 - val_mean_squared_error: 162.2092\n"", + ""Epoch 344/1000\n"", + ""2/2 - 0s - loss: 206.9383 - mean_squared_error: 206.9383 - val_loss: 162.8638 - val_mean_squared_error: 162.8638\n"", + ""Epoch 345/1000\n"", + ""2/2 - 0s - loss: 206.7893 - mean_squared_error: 206.7893 - val_loss: 162.6383 - val_mean_squared_error: 162.6383\n"", + ""Epoch 346/1000\n"", + ""2/2 - 0s - loss: 206.7214 - mean_squared_error: 206.7214 - val_loss: 162.3805 - val_mean_squared_error: 162.3805\n"", + ""Epoch 347/1000\n"", + ""2/2 - 0s - loss: 206.7147 - mean_squared_error: 206.7147 - val_loss: 161.7872 - val_mean_squared_error: 161.7872\n"", + ""Epoch 348/1000\n"", + ""2/2 - 0s - loss: 206.5998 - mean_squared_error: 206.5998 - val_loss: 161.6932 - val_mean_squared_error: 161.6932\n"", + ""Epoch 349/1000\n"", + ""2/2 - 0s - loss: 206.5431 - mean_squared_error: 206.5431 - val_loss: 161.5845 - val_mean_squared_error: 161.5845\n"", + ""Epoch 350/1000\n"", + ""2/2 - 0s - loss: 206.4740 - mean_squared_error: 206.4740 - val_loss: 161.4094 - val_mean_squared_error: 161.4094\n"", + ""Epoch 351/1000\n"", + ""2/2 - 0s - loss: 206.4747 - mean_squared_error: 206.4747 - val_loss: 161.2713 - val_mean_squared_error: 161.2713\n"", + ""Epoch 352/1000\n"", + ""2/2 - 0s - loss: 206.3698 - mean_squared_error: 206.3698 - val_loss: 160.5292 - val_mean_squared_error: 160.5292\n"", + ""Epoch 353/1000\n"", + ""2/2 - 0s - loss: 206.3487 - mean_squared_error: 206.3487 - val_loss: 159.8598 - val_mean_squared_error: 159.8598\n"", + ""Epoch 354/1000\n"", + ""2/2 - 0s - loss: 206.2715 - mean_squared_error: 206.2715 - val_loss: 159.8333 - val_mean_squared_error: 159.8333\n"", + ""Epoch 355/1000\n"", + ""2/2 - 0s - loss: 206.2123 - mean_squared_error: 206.2123 - val_loss: 159.6227 - val_mean_squared_error: 159.6227\n"", + ""Epoch 356/1000\n"", + ""2/2 - 0s - loss: 206.1573 - mean_squared_error: 206.1573 - val_loss: 159.3798 - val_mean_squared_error: 159.3798\n"", + ""Epoch 357/1000\n"", + ""2/2 - 0s - loss: 206.1778 - mean_squared_error: 206.1778 - val_loss: 159.2288 - val_mean_squared_error: 159.2288\n"", + ""Epoch 358/1000\n"", + ""2/2 - 0s - loss: 206.1515 - mean_squared_error: 206.1515 - val_loss: 160.1416 - val_mean_squared_error: 160.1416\n"", + ""Epoch 359/1000\n"", + ""2/2 - 0s - loss: 205.9780 - mean_squared_error: 205.9780 - val_loss: 160.3081 - val_mean_squared_error: 160.3081\n"", + ""Epoch 360/1000\n"", + ""2/2 - 0s - loss: 205.9945 - mean_squared_error: 205.9945 - val_loss: 160.1836 - val_mean_squared_error: 160.1836\n"", + ""Epoch 361/1000\n"", + ""2/2 - 0s - loss: 205.9146 - mean_squared_error: 205.9146 - val_loss: 160.7735 - val_mean_squared_error: 160.7735\n"", + ""Epoch 362/1000\n"", + ""2/2 - 0s - loss: 205.8470 - mean_squared_error: 205.8470 - val_loss: 160.8906 - val_mean_squared_error: 160.8906\n"", + ""Epoch 363/1000\n"", + ""2/2 - 0s - loss: 205.8141 - mean_squared_error: 205.8141 - val_loss: 160.5076 - val_mean_squared_error: 160.5076\n"", + ""Epoch 364/1000\n"", + ""2/2 - 0s - loss: 205.7310 - mean_squared_error: 205.7310 - val_loss: 160.5540 - val_mean_squared_error: 160.5540\n"", + ""Epoch 365/1000\n"", + ""2/2 - 0s - loss: 205.7094 - mean_squared_error: 205.7094 - val_loss: 160.1772 - val_mean_squared_error: 160.1772\n"", + ""Epoch 366/1000\n"", + ""2/2 - 0s - loss: 205.6545 - mean_squared_error: 205.6545 - val_loss: 160.1978 - val_mean_squared_error: 160.1978\n"", + ""Epoch 367/1000\n"", + ""2/2 - 0s - loss: 205.5855 - mean_squared_error: 205.5855 - val_loss: 159.8984 - val_mean_squared_error: 159.8984\n"", + ""Epoch 368/1000\n"", + ""2/2 - 0s - loss: 205.5339 - mean_squared_error: 205.5339 - val_loss: 159.4584 - val_mean_squared_error: 159.4584\n"", + ""Epoch 369/1000\n"", + ""2/2 - 0s - loss: 205.4935 - mean_squared_error: 205.4935 - val_loss: 158.8551 - val_mean_squared_error: 158.8551\n"", + ""Epoch 370/1000\n"", + ""2/2 - 0s - loss: 205.4503 - mean_squared_error: 205.4503 - val_loss: 157.9119 - val_mean_squared_error: 157.9119\n"", + ""Epoch 371/1000\n"", + ""2/2 - 0s - loss: 205.6791 - mean_squared_error: 205.6791 - val_loss: 156.9494 - val_mean_squared_error: 156.9494\n"", + ""Epoch 372/1000\n"", + ""2/2 - 0s - loss: 205.4720 - mean_squared_error: 205.4720 - val_loss: 157.6128 - val_mean_squared_error: 157.6128\n"", + ""Epoch 373/1000\n"", + ""2/2 - 0s - loss: 205.3469 - mean_squared_error: 205.3469 - val_loss: 157.8261 - val_mean_squared_error: 157.8261\n"", + ""Epoch 374/1000\n"", + ""2/2 - 0s - loss: 205.3732 - mean_squared_error: 205.3732 - val_loss: 157.5518 - val_mean_squared_error: 157.5518\n"", + ""Epoch 375/1000\n"", + ""2/2 - 0s - loss: 205.2444 - mean_squared_error: 205.2444 - val_loss: 158.1262 - val_mean_squared_error: 158.1262\n"", + ""Epoch 376/1000\n"", + ""2/2 - 0s - loss: 205.1995 - mean_squared_error: 205.1995 - val_loss: 158.4964 - val_mean_squared_error: 158.4964\n"", + ""Epoch 377/1000\n"", + ""2/2 - 0s - loss: 205.1721 - mean_squared_error: 205.1721 - val_loss: 159.4063 - val_mean_squared_error: 159.4063\n"", + ""Epoch 378/1000\n"", + ""2/2 - 0s - loss: 205.1144 - mean_squared_error: 205.1144 - val_loss: 159.7956 - val_mean_squared_error: 159.7956\n"", + ""Epoch 379/1000\n"", + ""2/2 - 0s - loss: 205.0711 - mean_squared_error: 205.0711 - val_loss: 159.8991 - val_mean_squared_error: 159.8991\n"", + ""Epoch 380/1000\n"", + ""2/2 - 0s - loss: 205.0447 - mean_squared_error: 205.0447 - val_loss: 159.4530 - val_mean_squared_error: 159.4530\n"", + ""Epoch 381/1000\n"", + ""2/2 - 0s - loss: 204.9765 - mean_squared_error: 204.9765 - val_loss: 159.2693 - val_mean_squared_error: 159.2693\n"", + ""Epoch 382/1000\n"", + ""2/2 - 0s - loss: 204.9326 - mean_squared_error: 204.9326 - val_loss: 158.9349 - val_mean_squared_error: 158.9349\n"", + ""Epoch 383/1000\n"", + ""2/2 - 0s - loss: 204.8807 - mean_squared_error: 204.8807 - val_loss: 158.4100 - val_mean_squared_error: 158.4100\n"", + ""Epoch 384/1000\n"", + ""2/2 - 0s - loss: 204.8592 - mean_squared_error: 204.8592 - val_loss: 157.6088 - val_mean_squared_error: 157.6088\n"", + ""Epoch 385/1000\n"", + ""2/2 - 0s - loss: 204.9299 - mean_squared_error: 204.9299 - val_loss: 156.8340 - val_mean_squared_error: 156.8340\n"", + ""Epoch 386/1000\n"", + ""2/2 - 0s - loss: 204.9505 - mean_squared_error: 204.9505 - val_loss: 157.3223 - val_mean_squared_error: 157.3223\n"", + ""Epoch 387/1000\n"", + ""2/2 - 0s - loss: 204.7337 - mean_squared_error: 204.7337 - val_loss: 156.9825 - val_mean_squared_error: 156.9825\n"", + ""Epoch 388/1000\n"", + ""2/2 - 0s - loss: 204.6933 - mean_squared_error: 204.6933 - val_loss: 156.5525 - val_mean_squared_error: 156.5525\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 389/1000\n"", + ""2/2 - 0s - loss: 204.8432 - mean_squared_error: 204.8432 - val_loss: 155.8755 - val_mean_squared_error: 155.8755\n"", + ""Epoch 390/1000\n"", + ""2/2 - 0s - loss: 204.6465 - mean_squared_error: 204.6465 - val_loss: 156.3097 - val_mean_squared_error: 156.3097\n"", + ""Epoch 391/1000\n"", + ""2/2 - 0s - loss: 204.6181 - mean_squared_error: 204.6181 - val_loss: 157.3149 - val_mean_squared_error: 157.3149\n"", + ""Epoch 392/1000\n"", + ""2/2 - 0s - loss: 204.5581 - mean_squared_error: 204.5581 - val_loss: 157.8628 - val_mean_squared_error: 157.8628\n"", + ""Epoch 393/1000\n"", + ""2/2 - 0s - loss: 204.8031 - mean_squared_error: 204.8031 - val_loss: 158.8740 - val_mean_squared_error: 158.8740\n"", + ""Epoch 394/1000\n"", + ""2/2 - 0s - loss: 204.4831 - mean_squared_error: 204.4831 - val_loss: 158.3983 - val_mean_squared_error: 158.3983\n"", + ""Epoch 395/1000\n"", + ""2/2 - 0s - loss: 204.4489 - mean_squared_error: 204.4489 - val_loss: 157.7287 - val_mean_squared_error: 157.7287\n"", + ""Epoch 396/1000\n"", + ""2/2 - 0s - loss: 204.4064 - mean_squared_error: 204.4064 - val_loss: 157.1824 - val_mean_squared_error: 157.1824\n"", + ""Epoch 397/1000\n"", + ""2/2 - 0s - loss: 204.3738 - mean_squared_error: 204.3738 - val_loss: 156.2694 - val_mean_squared_error: 156.2694\n"", + ""Epoch 398/1000\n"", + ""2/2 - 0s - loss: 204.3393 - mean_squared_error: 204.3393 - val_loss: 155.7388 - val_mean_squared_error: 155.7388\n"", + ""Epoch 399/1000\n"", + ""2/2 - 0s - loss: 204.3317 - mean_squared_error: 204.3317 - val_loss: 155.2323 - val_mean_squared_error: 155.2323\n"", + ""Epoch 400/1000\n"", + ""2/2 - 0s - loss: 204.3170 - mean_squared_error: 204.3170 - val_loss: 155.3537 - val_mean_squared_error: 155.3537\n"", + ""Epoch 401/1000\n"", + ""2/2 - 0s - loss: 204.2761 - mean_squared_error: 204.2761 - val_loss: 155.3476 - val_mean_squared_error: 155.3476\n"", + ""Epoch 402/1000\n"", + ""2/2 - 0s - loss: 204.2439 - mean_squared_error: 204.2439 - val_loss: 155.2662 - val_mean_squared_error: 155.2662\n"", + ""Epoch 403/1000\n"", + ""2/2 - 0s - loss: 204.2151 - mean_squared_error: 204.2151 - val_loss: 155.1771 - val_mean_squared_error: 155.1771\n"", + ""Epoch 404/1000\n"", + ""2/2 - 0s - loss: 204.1798 - mean_squared_error: 204.1798 - val_loss: 154.9215 - val_mean_squared_error: 154.9215\n"", + ""Epoch 405/1000\n"", + ""2/2 - 0s - loss: 204.1395 - mean_squared_error: 204.1395 - val_loss: 154.6028 - val_mean_squared_error: 154.6028\n"", + ""Epoch 406/1000\n"", + ""2/2 - 0s - loss: 204.1779 - mean_squared_error: 204.1779 - val_loss: 154.0313 - val_mean_squared_error: 154.0313\n"", + ""Epoch 407/1000\n"", + ""2/2 - 0s - loss: 204.1072 - mean_squared_error: 204.1072 - val_loss: 154.4580 - val_mean_squared_error: 154.4580\n"", + ""Epoch 408/1000\n"", + ""2/2 - 0s - loss: 204.0453 - mean_squared_error: 204.0453 - val_loss: 154.8816 - val_mean_squared_error: 154.8816\n"", + ""Epoch 409/1000\n"", + ""2/2 - 0s - loss: 204.0549 - mean_squared_error: 204.0549 - val_loss: 155.4529 - val_mean_squared_error: 155.4529\n"", + ""Epoch 410/1000\n"", + ""2/2 - 0s - loss: 204.0372 - mean_squared_error: 204.0372 - val_loss: 155.2666 - val_mean_squared_error: 155.2666\n"", + ""Epoch 411/1000\n"", + ""2/2 - 0s - loss: 203.9197 - mean_squared_error: 203.9197 - val_loss: 155.9623 - val_mean_squared_error: 155.9623\n"", + ""Epoch 412/1000\n"", + ""2/2 - 0s - loss: 203.8904 - mean_squared_error: 203.8904 - val_loss: 156.6243 - val_mean_squared_error: 156.6243\n"", + ""Epoch 413/1000\n"", + ""2/2 - 0s - loss: 203.8911 - mean_squared_error: 203.8911 - val_loss: 157.1593 - val_mean_squared_error: 157.1593\n"", + ""Epoch 414/1000\n"", + ""2/2 - 0s - loss: 203.8719 - mean_squared_error: 203.8719 - val_loss: 157.1338 - val_mean_squared_error: 157.1338\n"", + ""Epoch 415/1000\n"", + ""2/2 - 0s - loss: 203.8573 - mean_squared_error: 203.8573 - val_loss: 157.5428 - val_mean_squared_error: 157.5428\n"", + ""Epoch 416/1000\n"", + ""2/2 - 0s - loss: 203.8165 - mean_squared_error: 203.8165 - val_loss: 157.3784 - val_mean_squared_error: 157.3784\n"", + ""Epoch 417/1000\n"", + ""2/2 - 0s - loss: 203.7742 - mean_squared_error: 203.7742 - val_loss: 156.7327 - val_mean_squared_error: 156.7327\n"", + ""Epoch 418/1000\n"", + ""2/2 - 0s - loss: 203.7358 - mean_squared_error: 203.7358 - val_loss: 156.0767 - val_mean_squared_error: 156.0767\n"", + ""Epoch 419/1000\n"", + ""2/2 - 0s - loss: 203.7213 - mean_squared_error: 203.7213 - val_loss: 155.3893 - val_mean_squared_error: 155.3893\n"", + ""Epoch 420/1000\n"", + ""2/2 - 0s - loss: 203.9221 - mean_squared_error: 203.9221 - val_loss: 155.4439 - val_mean_squared_error: 155.4439\n"", + ""Epoch 421/1000\n"", + ""2/2 - 0s - loss: 204.0807 - mean_squared_error: 204.0807 - val_loss: 153.7262 - val_mean_squared_error: 153.7262\n"", + ""Epoch 422/1000\n"", + ""2/2 - 0s - loss: 203.6799 - mean_squared_error: 203.6799 - val_loss: 153.9271 - val_mean_squared_error: 153.9271\n"", + ""Epoch 423/1000\n"", + ""2/2 - 0s - loss: 203.6673 - mean_squared_error: 203.6673 - val_loss: 153.8806 - val_mean_squared_error: 153.8806\n"", + ""Epoch 424/1000\n"", + ""2/2 - 0s - loss: 203.6178 - mean_squared_error: 203.6178 - val_loss: 154.5187 - val_mean_squared_error: 154.5187\n"", + ""Epoch 425/1000\n"", + ""2/2 - 0s - loss: 203.8347 - mean_squared_error: 203.8347 - val_loss: 155.5973 - val_mean_squared_error: 155.5973\n"", + ""Epoch 426/1000\n"", + ""2/2 - 0s - loss: 203.5591 - mean_squared_error: 203.5591 - val_loss: 155.4581 - val_mean_squared_error: 155.4581\n"", + ""Epoch 427/1000\n"", + ""2/2 - 0s - loss: 203.5039 - mean_squared_error: 203.5039 - val_loss: 155.0695 - val_mean_squared_error: 155.0695\n"", + ""Epoch 428/1000\n"", + ""2/2 - 0s - loss: 203.5039 - mean_squared_error: 203.5039 - val_loss: 154.7977 - val_mean_squared_error: 154.7977\n"", + ""Epoch 429/1000\n"", + ""2/2 - 0s - loss: 203.4625 - mean_squared_error: 203.4625 - val_loss: 154.2391 - val_mean_squared_error: 154.2391\n"", + ""Epoch 430/1000\n"", + ""2/2 - 0s - loss: 203.4655 - mean_squared_error: 203.4655 - val_loss: 153.9539 - val_mean_squared_error: 153.9539\n"", + ""Epoch 431/1000\n"", + ""2/2 - 0s - loss: 203.4695 - mean_squared_error: 203.4695 - val_loss: 153.8317 - val_mean_squared_error: 153.8317\n"", + ""Epoch 432/1000\n"", + ""2/2 - 0s - loss: 203.5198 - mean_squared_error: 203.5198 - val_loss: 153.0974 - val_mean_squared_error: 153.0974\n"", + ""Epoch 433/1000\n"", + ""2/2 - 0s - loss: 203.4206 - mean_squared_error: 203.4206 - val_loss: 153.4253 - val_mean_squared_error: 153.4253\n"", + ""Epoch 434/1000\n"", + ""2/2 - 0s - loss: 203.3742 - mean_squared_error: 203.3742 - val_loss: 153.8183 - val_mean_squared_error: 153.8183\n"", + ""Epoch 435/1000\n"", + ""2/2 - 0s - loss: 203.3309 - mean_squared_error: 203.3309 - val_loss: 154.5331 - val_mean_squared_error: 154.5331\n"", + ""Epoch 436/1000\n"", + ""2/2 - 0s - loss: 203.2966 - mean_squared_error: 203.2966 - val_loss: 155.3949 - val_mean_squared_error: 155.3949\n"", + ""Epoch 437/1000\n"", + ""2/2 - 0s - loss: 203.2789 - mean_squared_error: 203.2789 - val_loss: 156.3117 - val_mean_squared_error: 156.3117\n"", + ""Epoch 438/1000\n"", + ""2/2 - 0s - loss: 203.3341 - mean_squared_error: 203.3341 - val_loss: 157.1507 - val_mean_squared_error: 157.1507\n"", + ""Epoch 439/1000\n"", + ""2/2 - 0s - loss: 203.3694 - mean_squared_error: 203.3694 - val_loss: 157.3471 - val_mean_squared_error: 157.3471\n"", + ""Epoch 440/1000\n"", + ""2/2 - 0s - loss: 203.2751 - mean_squared_error: 203.2751 - val_loss: 156.5785 - val_mean_squared_error: 156.5785\n"", + ""Epoch 441/1000\n"", + ""2/2 - 0s - loss: 203.2254 - mean_squared_error: 203.2254 - val_loss: 155.1671 - val_mean_squared_error: 155.1671\n"", + ""Epoch 442/1000\n"", + ""2/2 - 0s - loss: 203.1813 - mean_squared_error: 203.1813 - val_loss: 154.1430 - val_mean_squared_error: 154.1430\n"", + ""Epoch 443/1000\n"", + ""2/2 - 0s - loss: 203.1895 - mean_squared_error: 203.1895 - val_loss: 152.9841 - val_mean_squared_error: 152.9841\n"", + ""Epoch 444/1000\n"", + ""2/2 - 0s - loss: 203.3694 - mean_squared_error: 203.3694 - val_loss: 152.1931 - val_mean_squared_error: 152.1931\n"", + ""Epoch 445/1000\n"", + ""2/2 - 0s - loss: 203.1755 - mean_squared_error: 203.1755 - val_loss: 152.7316 - val_mean_squared_error: 152.7316\n"", + ""Epoch 446/1000\n"", + ""2/2 - 0s - loss: 203.2106 - mean_squared_error: 203.2106 - val_loss: 153.1585 - val_mean_squared_error: 153.1585\n"", + ""Epoch 447/1000\n"", + ""2/2 - 0s - loss: 203.0988 - mean_squared_error: 203.0988 - val_loss: 154.3540 - val_mean_squared_error: 154.3540\n"", + ""Epoch 448/1000\n"", + ""2/2 - 0s - loss: 203.0139 - mean_squared_error: 203.0139 - val_loss: 156.2365 - val_mean_squared_error: 156.2365\n"", + ""Epoch 449/1000\n"", + ""2/2 - 0s - loss: 203.0860 - mean_squared_error: 203.0860 - val_loss: 158.0202 - val_mean_squared_error: 158.0202\n"", + ""Epoch 450/1000\n"", + ""2/2 - 0s - loss: 203.1148 - mean_squared_error: 203.1148 - val_loss: 158.9128 - val_mean_squared_error: 158.9128\n"", + ""Epoch 451/1000\n"", + ""2/2 - 0s - loss: 203.2445 - mean_squared_error: 203.2445 - val_loss: 159.4846 - val_mean_squared_error: 159.4846\n"", + ""Epoch 452/1000\n"", + ""2/2 - 0s - loss: 203.1892 - mean_squared_error: 203.1892 - val_loss: 158.6469 - val_mean_squared_error: 158.6469\n"", + ""Epoch 453/1000\n"", + ""2/2 - 0s - loss: 203.1041 - mean_squared_error: 203.1041 - val_loss: 157.6252 - val_mean_squared_error: 157.6252\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 454/1000\n"", + ""2/2 - 0s - loss: 203.0369 - mean_squared_error: 203.0369 - val_loss: 156.2416 - val_mean_squared_error: 156.2416\n"", + ""Epoch 455/1000\n"", + ""2/2 - 0s - loss: 202.9681 - mean_squared_error: 202.9681 - val_loss: 154.8365 - val_mean_squared_error: 154.8365\n"", + ""Epoch 456/1000\n"", + ""2/2 - 0s - loss: 202.9883 - mean_squared_error: 202.9883 - val_loss: 153.5151 - val_mean_squared_error: 153.5151\n"", + ""Epoch 457/1000\n"", + ""2/2 - 0s - loss: 202.9800 - mean_squared_error: 202.9800 - val_loss: 152.7471 - val_mean_squared_error: 152.7471\n"", + ""Epoch 458/1000\n"", + ""2/2 - 0s - loss: 202.9399 - mean_squared_error: 202.9399 - val_loss: 152.7801 - val_mean_squared_error: 152.7801\n"", + ""Epoch 459/1000\n"", + ""2/2 - 0s - loss: 202.9351 - mean_squared_error: 202.9351 - val_loss: 152.8466 - val_mean_squared_error: 152.8466\n"", + ""Epoch 460/1000\n"", + ""2/2 - 0s - loss: 202.9048 - mean_squared_error: 202.9048 - val_loss: 152.5773 - val_mean_squared_error: 152.5773\n"", + ""Epoch 461/1000\n"", + ""2/2 - 0s - loss: 202.9452 - mean_squared_error: 202.9452 - val_loss: 152.5178 - val_mean_squared_error: 152.5178\n"", + ""Epoch 462/1000\n"", + ""2/2 - 0s - loss: 202.8760 - mean_squared_error: 202.8760 - val_loss: 153.1271 - val_mean_squared_error: 153.1271\n"", + ""Epoch 463/1000\n"", + ""2/2 - 0s - loss: 202.8516 - mean_squared_error: 202.8516 - val_loss: 154.2946 - val_mean_squared_error: 154.2946\n"", + ""Epoch 464/1000\n"", + ""2/2 - 0s - loss: 202.8247 - mean_squared_error: 202.8247 - val_loss: 155.1914 - val_mean_squared_error: 155.1914\n"", + ""Epoch 465/1000\n"", + ""2/2 - 0s - loss: 202.8355 - mean_squared_error: 202.8355 - val_loss: 155.6092 - val_mean_squared_error: 155.6092\n"", + ""Epoch 466/1000\n"", + ""2/2 - 0s - loss: 202.9754 - mean_squared_error: 202.9754 - val_loss: 156.4581 - val_mean_squared_error: 156.4581\n"", + ""Epoch 467/1000\n"", + ""2/2 - 0s - loss: 202.8667 - mean_squared_error: 202.8667 - val_loss: 156.1114 - val_mean_squared_error: 156.1114\n"", + ""Epoch 468/1000\n"", + ""2/2 - 0s - loss: 202.7987 - mean_squared_error: 202.7987 - val_loss: 155.0422 - val_mean_squared_error: 155.0422\n"", + ""Epoch 469/1000\n"", + ""2/2 - 0s - loss: 202.7604 - mean_squared_error: 202.7604 - val_loss: 153.7798 - val_mean_squared_error: 153.7798\n"", + ""Epoch 470/1000\n"", + ""2/2 - 0s - loss: 202.7684 - mean_squared_error: 202.7684 - val_loss: 152.4411 - val_mean_squared_error: 152.4411\n"", + ""Epoch 471/1000\n"", + ""2/2 - 0s - loss: 202.7806 - mean_squared_error: 202.7806 - val_loss: 151.8734 - val_mean_squared_error: 151.8734\n"", + ""Epoch 472/1000\n"", + ""2/2 - 0s - loss: 202.8098 - mean_squared_error: 202.8098 - val_loss: 150.8000 - val_mean_squared_error: 150.8000\n"", + ""Epoch 473/1000\n"", + ""2/2 - 0s - loss: 202.8295 - mean_squared_error: 202.8295 - val_loss: 150.5092 - val_mean_squared_error: 150.5092\n"", + ""Epoch 474/1000\n"", + ""2/2 - 0s - loss: 202.7820 - mean_squared_error: 202.7820 - val_loss: 151.1965 - val_mean_squared_error: 151.1965\n"", + ""Epoch 475/1000\n"", + ""2/2 - 0s - loss: 202.7333 - mean_squared_error: 202.7333 - val_loss: 151.8960 - val_mean_squared_error: 151.8960\n"", + ""Epoch 476/1000\n"", + ""2/2 - 0s - loss: 202.7193 - mean_squared_error: 202.7193 - val_loss: 152.8903 - val_mean_squared_error: 152.8903\n"", + ""Epoch 477/1000\n"", + ""2/2 - 0s - loss: 202.7408 - mean_squared_error: 202.7408 - val_loss: 153.8028 - val_mean_squared_error: 153.8028\n"", + ""Epoch 478/1000\n"", + ""2/2 - 0s - loss: 202.7185 - mean_squared_error: 202.7185 - val_loss: 154.1555 - val_mean_squared_error: 154.1555\n"", + ""Epoch 479/1000\n"", + ""2/2 - 0s - loss: 202.6606 - mean_squared_error: 202.6606 - val_loss: 153.7634 - val_mean_squared_error: 153.7634\n"", + ""Epoch 480/1000\n"", + ""2/2 - 0s - loss: 202.6611 - mean_squared_error: 202.6611 - val_loss: 153.4223 - val_mean_squared_error: 153.4223\n"", + ""Epoch 481/1000\n"", + ""2/2 - 0s - loss: 202.7321 - mean_squared_error: 202.7321 - val_loss: 153.6686 - val_mean_squared_error: 153.6686\n"", + ""Epoch 482/1000\n"", + ""2/2 - 0s - loss: 202.6483 - mean_squared_error: 202.6483 - val_loss: 152.8451 - val_mean_squared_error: 152.8451\n"", + ""Epoch 483/1000\n"", + ""2/2 - 0s - loss: 202.6081 - mean_squared_error: 202.6081 - val_loss: 152.4989 - val_mean_squared_error: 152.4989\n"", + ""Epoch 484/1000\n"", + ""2/2 - 0s - loss: 202.6030 - mean_squared_error: 202.6030 - val_loss: 152.3600 - val_mean_squared_error: 152.3600\n"", + ""Epoch 485/1000\n"", + ""2/2 - 0s - loss: 202.6433 - mean_squared_error: 202.6433 - val_loss: 152.5517 - val_mean_squared_error: 152.5517\n"", + ""Epoch 486/1000\n"", + ""2/2 - 0s - loss: 202.5998 - mean_squared_error: 202.5998 - val_loss: 152.4327 - val_mean_squared_error: 152.4327\n"", + ""Epoch 487/1000\n"", + ""2/2 - 0s - loss: 202.5923 - mean_squared_error: 202.5923 - val_loss: 152.0860 - val_mean_squared_error: 152.0860\n"", + ""Epoch 488/1000\n"", + ""2/2 - 0s - loss: 202.6458 - mean_squared_error: 202.6458 - val_loss: 151.2459 - val_mean_squared_error: 151.2459\n"", + ""Epoch 489/1000\n"", + ""2/2 - 0s - loss: 202.6907 - mean_squared_error: 202.6907 - val_loss: 151.6056 - val_mean_squared_error: 151.6056\n"", + ""Epoch 490/1000\n"", + ""2/2 - 0s - loss: 202.6402 - mean_squared_error: 202.6402 - val_loss: 151.0283 - val_mean_squared_error: 151.0283\n"", + ""Epoch 491/1000\n"", + ""2/2 - 0s - loss: 202.5681 - mean_squared_error: 202.5681 - val_loss: 151.4035 - val_mean_squared_error: 151.4035\n"", + ""Epoch 492/1000\n"", + ""2/2 - 0s - loss: 202.5917 - mean_squared_error: 202.5917 - val_loss: 152.1989 - val_mean_squared_error: 152.1989\n"", + ""Epoch 493/1000\n"", + ""2/2 - 0s - loss: 202.5260 - mean_squared_error: 202.5260 - val_loss: 152.5270 - val_mean_squared_error: 152.5270\n"", + ""Epoch 494/1000\n"", + ""2/2 - 0s - loss: 202.5319 - mean_squared_error: 202.5319 - val_loss: 153.2178 - val_mean_squared_error: 153.2178\n"", + ""Epoch 495/1000\n"", + ""2/2 - 0s - loss: 202.5136 - mean_squared_error: 202.5136 - val_loss: 153.5796 - val_mean_squared_error: 153.5796\n"", + ""Epoch 496/1000\n"", + ""2/2 - 0s - loss: 202.5754 - mean_squared_error: 202.5754 - val_loss: 153.4670 - val_mean_squared_error: 153.4670\n"", + ""Epoch 497/1000\n"", + ""2/2 - 0s - loss: 202.4884 - mean_squared_error: 202.4884 - val_loss: 154.0547 - val_mean_squared_error: 154.0547\n"", + ""Epoch 498/1000\n"", + ""2/2 - 0s - loss: 202.5040 - mean_squared_error: 202.5040 - val_loss: 154.4295 - val_mean_squared_error: 154.4295\n"", + ""Epoch 499/1000\n"", + ""2/2 - 0s - loss: 202.5108 - mean_squared_error: 202.5108 - val_loss: 154.7979 - val_mean_squared_error: 154.7979\n"", + ""Epoch 500/1000\n"", + ""2/2 - 0s - loss: 202.6560 - mean_squared_error: 202.6560 - val_loss: 155.6766 - val_mean_squared_error: 155.6766\n"", + ""Epoch 501/1000\n"", + ""2/2 - 0s - loss: 202.5495 - mean_squared_error: 202.5495 - val_loss: 155.2989 - val_mean_squared_error: 155.2989\n"", + ""Epoch 502/1000\n"", + ""2/2 - 0s - loss: 202.6196 - mean_squared_error: 202.6196 - val_loss: 153.8038 - val_mean_squared_error: 153.8038\n"", + ""Epoch 503/1000\n"", + ""2/2 - 0s - loss: 202.8092 - mean_squared_error: 202.8092 - val_loss: 152.6762 - val_mean_squared_error: 152.6762\n"", + ""Epoch 504/1000\n"", + ""2/2 - 0s - loss: 202.4473 - mean_squared_error: 202.4473 - val_loss: 153.1654 - val_mean_squared_error: 153.1654\n"", + ""Epoch 505/1000\n"", + ""2/2 - 0s - loss: 202.7534 - mean_squared_error: 202.7534 - val_loss: 154.1064 - val_mean_squared_error: 154.1064\n"", + ""Epoch 506/1000\n"", + ""2/2 - 0s - loss: 202.5166 - mean_squared_error: 202.5166 - val_loss: 153.1143 - val_mean_squared_error: 153.1143\n"", + ""Epoch 507/1000\n"", + ""2/2 - 0s - loss: 202.5289 - mean_squared_error: 202.5289 - val_loss: 152.5675 - val_mean_squared_error: 152.5675\n"", + ""Epoch 508/1000\n"", + ""2/2 - 0s - loss: 202.4774 - mean_squared_error: 202.4774 - val_loss: 153.0588 - val_mean_squared_error: 153.0588\n"", + ""Epoch 509/1000\n"", + ""2/2 - 0s - loss: 202.4847 - mean_squared_error: 202.4847 - val_loss: 153.1232 - val_mean_squared_error: 153.1232\n"", + ""Epoch 510/1000\n"", + ""2/2 - 0s - loss: 202.4354 - mean_squared_error: 202.4354 - val_loss: 152.3161 - val_mean_squared_error: 152.3161\n"", + ""Epoch 511/1000\n"", + ""2/2 - 0s - loss: 202.4788 - mean_squared_error: 202.4788 - val_loss: 152.2219 - val_mean_squared_error: 152.2219\n"", + ""Epoch 512/1000\n"", + ""2/2 - 0s - loss: 202.4025 - mean_squared_error: 202.4025 - val_loss: 151.5329 - val_mean_squared_error: 151.5329\n"", + ""Epoch 513/1000\n"", + ""2/2 - 0s - loss: 202.4053 - mean_squared_error: 202.4053 - val_loss: 150.7279 - val_mean_squared_error: 150.7279\n"", + ""Epoch 514/1000\n"", + ""2/2 - 0s - loss: 202.4151 - mean_squared_error: 202.4151 - val_loss: 149.7016 - val_mean_squared_error: 149.7016\n"", + ""Epoch 515/1000\n"", + ""2/2 - 0s - loss: 202.4914 - mean_squared_error: 202.4914 - val_loss: 149.0679 - val_mean_squared_error: 149.0679\n"", + ""Epoch 516/1000\n"", + ""2/2 - 0s - loss: 202.4718 - mean_squared_error: 202.4718 - val_loss: 149.4033 - val_mean_squared_error: 149.4033\n"", + ""Epoch 517/1000\n"", + ""2/2 - 0s - loss: 202.6195 - mean_squared_error: 202.6195 - val_loss: 150.4915 - val_mean_squared_error: 150.4915\n"", + ""Epoch 518/1000\n"", + ""2/2 - 0s - loss: 202.4194 - mean_squared_error: 202.4194 - val_loss: 150.8599 - val_mean_squared_error: 150.8599\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 519/1000\n"", + ""2/2 - 0s - loss: 202.3841 - mean_squared_error: 202.3841 - val_loss: 150.9349 - val_mean_squared_error: 150.9349\n"", + ""Epoch 520/1000\n"", + ""2/2 - 0s - loss: 202.3731 - mean_squared_error: 202.3731 - val_loss: 151.4474 - val_mean_squared_error: 151.4474\n"", + ""Epoch 521/1000\n"", + ""2/2 - 0s - loss: 202.3454 - mean_squared_error: 202.3454 - val_loss: 152.0626 - val_mean_squared_error: 152.0626\n"", + ""Epoch 522/1000\n"", + ""2/2 - 0s - loss: 202.4184 - mean_squared_error: 202.4184 - val_loss: 152.8539 - val_mean_squared_error: 152.8539\n"", + ""Epoch 523/1000\n"", + ""2/2 - 0s - loss: 202.5845 - mean_squared_error: 202.5845 - val_loss: 152.3679 - val_mean_squared_error: 152.3679\n"", + ""Epoch 524/1000\n"", + ""2/2 - 0s - loss: 202.3484 - mean_squared_error: 202.3484 - val_loss: 153.0911 - val_mean_squared_error: 153.0911\n"", + ""Epoch 525/1000\n"", + ""2/2 - 0s - loss: 202.3091 - mean_squared_error: 202.3091 - val_loss: 154.4227 - val_mean_squared_error: 154.4227\n"", + ""Epoch 526/1000\n"", + ""2/2 - 0s - loss: 202.4319 - mean_squared_error: 202.4319 - val_loss: 155.5426 - val_mean_squared_error: 155.5426\n"", + ""Epoch 527/1000\n"", + ""2/2 - 0s - loss: 202.4897 - mean_squared_error: 202.4897 - val_loss: 155.7119 - val_mean_squared_error: 155.7119\n"", + ""Epoch 528/1000\n"", + ""2/2 - 0s - loss: 202.3696 - mean_squared_error: 202.3696 - val_loss: 154.5556 - val_mean_squared_error: 154.5556\n"", + ""Epoch 529/1000\n"", + ""2/2 - 0s - loss: 202.2965 - mean_squared_error: 202.2965 - val_loss: 153.0094 - val_mean_squared_error: 153.0094\n"", + ""Epoch 530/1000\n"", + ""2/2 - 0s - loss: 202.2564 - mean_squared_error: 202.2564 - val_loss: 151.4370 - val_mean_squared_error: 151.4370\n"", + ""Epoch 531/1000\n"", + ""2/2 - 0s - loss: 202.3072 - mean_squared_error: 202.3072 - val_loss: 149.6436 - val_mean_squared_error: 149.6436\n"", + ""Epoch 532/1000\n"", + ""2/2 - 0s - loss: 202.3413 - mean_squared_error: 202.3413 - val_loss: 148.6883 - val_mean_squared_error: 148.6883\n"", + ""Epoch 533/1000\n"", + ""2/2 - 0s - loss: 202.5752 - mean_squared_error: 202.5752 - val_loss: 148.0661 - val_mean_squared_error: 148.0661\n"", + ""Epoch 534/1000\n"", + ""2/2 - 0s - loss: 202.5156 - mean_squared_error: 202.5156 - val_loss: 148.7849 - val_mean_squared_error: 148.7849\n"", + ""Epoch 535/1000\n"", + ""2/2 - 0s - loss: 202.4699 - mean_squared_error: 202.4699 - val_loss: 151.2432 - val_mean_squared_error: 151.2432\n"", + ""Epoch 536/1000\n"", + ""2/2 - 0s - loss: 202.3915 - mean_squared_error: 202.3915 - val_loss: 153.1851 - val_mean_squared_error: 153.1851\n"", + ""Epoch 537/1000\n"", + ""2/2 - 0s - loss: 202.3663 - mean_squared_error: 202.3663 - val_loss: 154.2537 - val_mean_squared_error: 154.2537\n"", + ""Epoch 538/1000\n"", + ""2/2 - 0s - loss: 202.3027 - mean_squared_error: 202.3027 - val_loss: 154.2857 - val_mean_squared_error: 154.2857\n"", + ""Epoch 539/1000\n"", + ""2/2 - 0s - loss: 202.3392 - mean_squared_error: 202.3392 - val_loss: 153.5310 - val_mean_squared_error: 153.5310\n"", + ""Epoch 540/1000\n"", + ""2/2 - 0s - loss: 202.3228 - mean_squared_error: 202.3228 - val_loss: 153.0654 - val_mean_squared_error: 153.0654\n"", + ""Epoch 541/1000\n"", + ""2/2 - 0s - loss: 202.3810 - mean_squared_error: 202.3810 - val_loss: 153.3611 - val_mean_squared_error: 153.3611\n"", + ""Epoch 542/1000\n"", + ""2/2 - 0s - loss: 202.5199 - mean_squared_error: 202.5199 - val_loss: 152.0874 - val_mean_squared_error: 152.0874\n"", + ""Epoch 543/1000\n"", + ""2/2 - 0s - loss: 202.3045 - mean_squared_error: 202.3045 - val_loss: 152.4536 - val_mean_squared_error: 152.4536\n"", + ""Epoch 544/1000\n"", + ""2/2 - 0s - loss: 202.3023 - mean_squared_error: 202.3023 - val_loss: 151.8354 - val_mean_squared_error: 151.8354\n"", + ""Epoch 545/1000\n"", + ""2/2 - 0s - loss: 202.3209 - mean_squared_error: 202.3209 - val_loss: 152.2146 - val_mean_squared_error: 152.2146\n"", + ""Epoch 546/1000\n"", + ""2/2 - 0s - loss: 202.2301 - mean_squared_error: 202.2301 - val_loss: 151.7552 - val_mean_squared_error: 151.7552\n"", + ""Epoch 547/1000\n"", + ""2/2 - 0s - loss: 202.2803 - mean_squared_error: 202.2803 - val_loss: 151.3491 - val_mean_squared_error: 151.3491\n"", + ""Epoch 548/1000\n"", + ""2/2 - 0s - loss: 202.2874 - mean_squared_error: 202.2874 - val_loss: 150.0516 - val_mean_squared_error: 150.0516\n"", + ""Epoch 549/1000\n"", + ""2/2 - 0s - loss: 202.2419 - mean_squared_error: 202.2419 - val_loss: 149.7142 - val_mean_squared_error: 149.7142\n"", + ""Epoch 550/1000\n"", + ""2/2 - 0s - loss: 202.2502 - mean_squared_error: 202.2502 - val_loss: 149.5860 - val_mean_squared_error: 149.5860\n"", + ""Epoch 551/1000\n"", + ""2/2 - 0s - loss: 202.2792 - mean_squared_error: 202.2792 - val_loss: 149.6918 - val_mean_squared_error: 149.6918\n"", + ""Epoch 552/1000\n"", + ""2/2 - 0s - loss: 202.2604 - mean_squared_error: 202.2604 - val_loss: 149.6990 - val_mean_squared_error: 149.6990\n"", + ""Epoch 553/1000\n"", + ""2/2 - 0s - loss: 202.2559 - mean_squared_error: 202.2559 - val_loss: 149.4824 - val_mean_squared_error: 149.4824\n"", + ""Epoch 554/1000\n"", + ""2/2 - 0s - loss: 202.2640 - mean_squared_error: 202.2640 - val_loss: 149.6541 - val_mean_squared_error: 149.6541\n"", + ""Epoch 555/1000\n"", + ""2/2 - 0s - loss: 202.2538 - mean_squared_error: 202.2538 - val_loss: 150.6326 - val_mean_squared_error: 150.6326\n"", + ""Epoch 556/1000\n"", + ""2/2 - 0s - loss: 202.2414 - mean_squared_error: 202.2414 - val_loss: 151.1181 - val_mean_squared_error: 151.1181\n"", + ""Epoch 557/1000\n"", + ""2/2 - 0s - loss: 202.1886 - mean_squared_error: 202.1886 - val_loss: 152.2756 - val_mean_squared_error: 152.2756\n"", + ""Epoch 558/1000\n"", + ""2/2 - 0s - loss: 202.2488 - mean_squared_error: 202.2488 - val_loss: 153.0208 - val_mean_squared_error: 153.0208\n"", + ""Epoch 559/1000\n"", + ""2/2 - 0s - loss: 202.2135 - mean_squared_error: 202.2135 - val_loss: 154.4946 - val_mean_squared_error: 154.4946\n"", + ""Epoch 560/1000\n"", + ""2/2 - 0s - loss: 202.2688 - mean_squared_error: 202.2688 - val_loss: 155.2995 - val_mean_squared_error: 155.2995\n"", + ""Epoch 561/1000\n"", + ""2/2 - 0s - loss: 202.3863 - mean_squared_error: 202.3863 - val_loss: 155.5653 - val_mean_squared_error: 155.5653\n"", + ""Epoch 562/1000\n"", + ""2/2 - 0s - loss: 202.2997 - mean_squared_error: 202.2997 - val_loss: 154.3676 - val_mean_squared_error: 154.3676\n"", + ""Epoch 563/1000\n"", + ""2/2 - 0s - loss: 202.2129 - mean_squared_error: 202.2129 - val_loss: 152.9785 - val_mean_squared_error: 152.9785\n"", + ""Epoch 564/1000\n"", + ""2/2 - 0s - loss: 202.1513 - mean_squared_error: 202.1513 - val_loss: 151.3695 - val_mean_squared_error: 151.3695\n"", + ""Epoch 565/1000\n"", + ""2/2 - 0s - loss: 202.1357 - mean_squared_error: 202.1357 - val_loss: 149.5488 - val_mean_squared_error: 149.5488\n"", + ""Epoch 566/1000\n"", + ""2/2 - 0s - loss: 202.1911 - mean_squared_error: 202.1911 - val_loss: 148.0706 - val_mean_squared_error: 148.0706\n"", + ""Epoch 567/1000\n"", + ""2/2 - 0s - loss: 202.3804 - mean_squared_error: 202.3804 - val_loss: 147.0791 - val_mean_squared_error: 147.0791\n"", + ""Epoch 568/1000\n"", + ""2/2 - 0s - loss: 202.3374 - mean_squared_error: 202.3374 - val_loss: 147.6214 - val_mean_squared_error: 147.6214\n"", + ""Epoch 569/1000\n"", + ""2/2 - 0s - loss: 202.2872 - mean_squared_error: 202.2872 - val_loss: 148.5058 - val_mean_squared_error: 148.5058\n"", + ""Epoch 570/1000\n"", + ""2/2 - 0s - loss: 202.2193 - mean_squared_error: 202.2193 - val_loss: 149.4139 - val_mean_squared_error: 149.4139\n"", + ""Epoch 571/1000\n"", + ""2/2 - 0s - loss: 202.1637 - mean_squared_error: 202.1637 - val_loss: 150.7338 - val_mean_squared_error: 150.7338\n"", + ""Epoch 572/1000\n"", + ""2/2 - 0s - loss: 202.2556 - mean_squared_error: 202.2556 - val_loss: 152.4904 - val_mean_squared_error: 152.4904\n"", + ""Epoch 573/1000\n"", + ""2/2 - 0s - loss: 202.1791 - mean_squared_error: 202.1791 - val_loss: 153.2154 - val_mean_squared_error: 153.2154\n"", + ""Epoch 574/1000\n"", + ""2/2 - 0s - loss: 202.1871 - mean_squared_error: 202.1871 - val_loss: 153.4937 - val_mean_squared_error: 153.4937\n"", + ""Epoch 575/1000\n"", + ""2/2 - 0s - loss: 202.1913 - mean_squared_error: 202.1913 - val_loss: 153.7210 - val_mean_squared_error: 153.7210\n"", + ""Epoch 576/1000\n"", + ""2/2 - 0s - loss: 202.2226 - mean_squared_error: 202.2226 - val_loss: 153.6013 - val_mean_squared_error: 153.6013\n"", + ""Epoch 577/1000\n"", + ""2/2 - 0s - loss: 202.3334 - mean_squared_error: 202.3334 - val_loss: 154.0585 - val_mean_squared_error: 154.0585\n"", + ""Epoch 578/1000\n"", + ""2/2 - 0s - loss: 202.1969 - mean_squared_error: 202.1969 - val_loss: 153.0050 - val_mean_squared_error: 153.0050\n"", + ""Epoch 579/1000\n"", + ""2/2 - 0s - loss: 202.2084 - mean_squared_error: 202.2084 - val_loss: 151.6741 - val_mean_squared_error: 151.6741\n"", + ""Epoch 580/1000\n"", + ""2/2 - 0s - loss: 202.1480 - mean_squared_error: 202.1480 - val_loss: 150.9197 - val_mean_squared_error: 150.9197\n"", + ""Epoch 581/1000\n"", + ""2/2 - 0s - loss: 202.1674 - mean_squared_error: 202.1674 - val_loss: 150.5693 - val_mean_squared_error: 150.5693\n"", + ""Epoch 582/1000\n"", + ""2/2 - 0s - loss: 202.1479 - mean_squared_error: 202.1479 - val_loss: 149.7876 - val_mean_squared_error: 149.7876\n"", + ""Epoch 583/1000\n"", + ""2/2 - 0s - loss: 202.2633 - mean_squared_error: 202.2633 - val_loss: 149.0844 - val_mean_squared_error: 149.0844\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 584/1000\n"", + ""2/2 - 0s - loss: 202.1733 - mean_squared_error: 202.1733 - val_loss: 149.5513 - val_mean_squared_error: 149.5513\n"", + ""Epoch 585/1000\n"", + ""2/2 - 0s - loss: 202.1858 - mean_squared_error: 202.1858 - val_loss: 150.5110 - val_mean_squared_error: 150.5110\n"", + ""Epoch 586/1000\n"", + ""2/2 - 0s - loss: 202.1494 - mean_squared_error: 202.1494 - val_loss: 151.1703 - val_mean_squared_error: 151.1703\n"", + ""Epoch 587/1000\n"", + ""2/2 - 0s - loss: 202.2120 - mean_squared_error: 202.2120 - val_loss: 151.8465 - val_mean_squared_error: 151.8465\n"", + ""Epoch 588/1000\n"", + ""2/2 - 0s - loss: 202.1414 - mean_squared_error: 202.1414 - val_loss: 151.7297 - val_mean_squared_error: 151.7297\n"", + ""Epoch 589/1000\n"", + ""2/2 - 0s - loss: 202.1366 - mean_squared_error: 202.1366 - val_loss: 151.2733 - val_mean_squared_error: 151.2733\n"", + ""Epoch 590/1000\n"", + ""2/2 - 0s - loss: 202.1972 - mean_squared_error: 202.1972 - val_loss: 150.6754 - val_mean_squared_error: 150.6754\n"", + ""Epoch 591/1000\n"", + ""2/2 - 0s - loss: 202.1480 - mean_squared_error: 202.1480 - val_loss: 150.7558 - val_mean_squared_error: 150.7558\n"", + ""Epoch 592/1000\n"", + ""2/2 - 0s - loss: 202.1388 - mean_squared_error: 202.1388 - val_loss: 151.3955 - val_mean_squared_error: 151.3955\n"", + ""Epoch 593/1000\n"", + ""2/2 - 0s - loss: 202.1572 - mean_squared_error: 202.1572 - val_loss: 151.8148 - val_mean_squared_error: 151.8148\n"", + ""Epoch 594/1000\n"", + ""2/2 - 0s - loss: 202.1314 - mean_squared_error: 202.1314 - val_loss: 151.6597 - val_mean_squared_error: 151.6597\n"", + ""Epoch 595/1000\n"", + ""2/2 - 0s - loss: 202.1275 - mean_squared_error: 202.1275 - val_loss: 151.5851 - val_mean_squared_error: 151.5851\n"", + ""Epoch 596/1000\n"", + ""2/2 - 0s - loss: 202.1642 - mean_squared_error: 202.1642 - val_loss: 151.6154 - val_mean_squared_error: 151.6154\n"", + ""Epoch 597/1000\n"", + ""2/2 - 0s - loss: 202.2645 - mean_squared_error: 202.2645 - val_loss: 150.6540 - val_mean_squared_error: 150.6540\n"", + ""Epoch 598/1000\n"", + ""2/2 - 0s - loss: 202.1276 - mean_squared_error: 202.1276 - val_loss: 150.7845 - val_mean_squared_error: 150.7845\n"", + ""Epoch 599/1000\n"", + ""2/2 - 0s - loss: 202.1410 - mean_squared_error: 202.1410 - val_loss: 150.9205 - val_mean_squared_error: 150.9205\n"", + ""Epoch 600/1000\n"", + ""2/2 - 0s - loss: 202.1498 - mean_squared_error: 202.1498 - val_loss: 151.6094 - val_mean_squared_error: 151.6094\n"", + ""Epoch 601/1000\n"", + ""2/2 - 0s - loss: 202.1310 - mean_squared_error: 202.1310 - val_loss: 151.7267 - val_mean_squared_error: 151.7267\n"", + ""Epoch 602/1000\n"", + ""2/2 - 0s - loss: 202.1275 - mean_squared_error: 202.1275 - val_loss: 151.8329 - val_mean_squared_error: 151.8329\n"", + ""Epoch 603/1000\n"", + ""2/2 - 0s - loss: 202.1525 - mean_squared_error: 202.1525 - val_loss: 152.0365 - val_mean_squared_error: 152.0365\n"", + ""Epoch 604/1000\n"", + ""2/2 - 0s - loss: 202.2299 - mean_squared_error: 202.2299 - val_loss: 151.4343 - val_mean_squared_error: 151.4343\n"", + ""Epoch 605/1000\n"", + ""2/2 - 0s - loss: 202.1386 - mean_squared_error: 202.1386 - val_loss: 151.5489 - val_mean_squared_error: 151.5489\n"", + ""Epoch 606/1000\n"", + ""2/2 - 0s - loss: 202.1216 - mean_squared_error: 202.1216 - val_loss: 151.9380 - val_mean_squared_error: 151.9380\n"", + ""Epoch 607/1000\n"", + ""2/2 - 0s - loss: 202.1259 - mean_squared_error: 202.1259 - val_loss: 152.2478 - val_mean_squared_error: 152.2478\n"", + ""Epoch 608/1000\n"", + ""2/2 - 0s - loss: 202.1635 - mean_squared_error: 202.1635 - val_loss: 152.0009 - val_mean_squared_error: 152.0009\n"", + ""Epoch 609/1000\n"", + ""2/2 - 0s - loss: 202.1365 - mean_squared_error: 202.1365 - val_loss: 152.2758 - val_mean_squared_error: 152.2758\n"", + ""Epoch 610/1000\n"", + ""2/2 - 0s - loss: 202.1822 - mean_squared_error: 202.1822 - val_loss: 152.1810 - val_mean_squared_error: 152.1810\n"", + ""Epoch 611/1000\n"", + ""2/2 - 0s - loss: 202.2840 - mean_squared_error: 202.2840 - val_loss: 150.7937 - val_mean_squared_error: 150.7937\n"", + ""Epoch 612/1000\n"", + ""2/2 - 0s - loss: 202.1332 - mean_squared_error: 202.1332 - val_loss: 150.4114 - val_mean_squared_error: 150.4114\n"", + ""Epoch 613/1000\n"", + ""2/2 - 0s - loss: 202.1240 - mean_squared_error: 202.1240 - val_loss: 150.4860 - val_mean_squared_error: 150.4860\n"", + ""Epoch 614/1000\n"", + ""2/2 - 0s - loss: 202.1904 - mean_squared_error: 202.1904 - val_loss: 150.6203 - val_mean_squared_error: 150.6203\n"", + ""Epoch 615/1000\n"", + ""2/2 - 0s - loss: 202.1060 - mean_squared_error: 202.1061 - val_loss: 151.5538 - val_mean_squared_error: 151.5538\n"", + ""Epoch 616/1000\n"", + ""2/2 - 0s - loss: 202.3079 - mean_squared_error: 202.3079 - val_loss: 153.3115 - val_mean_squared_error: 153.3115\n"", + ""Epoch 617/1000\n"", + ""2/2 - 0s - loss: 202.1820 - mean_squared_error: 202.1820 - val_loss: 153.5200 - val_mean_squared_error: 153.5200\n"", + ""Epoch 618/1000\n"", + ""2/2 - 0s - loss: 202.2136 - mean_squared_error: 202.2136 - val_loss: 152.9999 - val_mean_squared_error: 152.9999\n"", + ""Epoch 619/1000\n"", + ""2/2 - 0s - loss: 202.1352 - mean_squared_error: 202.1352 - val_loss: 151.2055 - val_mean_squared_error: 151.2055\n"", + ""Epoch 620/1000\n"", + ""2/2 - 0s - loss: 202.0768 - mean_squared_error: 202.0768 - val_loss: 149.9448 - val_mean_squared_error: 149.9448\n"", + ""Epoch 621/1000\n"", + ""2/2 - 0s - loss: 202.2104 - mean_squared_error: 202.2104 - val_loss: 148.3638 - val_mean_squared_error: 148.3638\n"", + ""Epoch 622/1000\n"", + ""2/2 - 0s - loss: 202.1451 - mean_squared_error: 202.1451 - val_loss: 148.1115 - val_mean_squared_error: 148.1115\n"", + ""Epoch 623/1000\n"", + ""2/2 - 0s - loss: 202.1526 - mean_squared_error: 202.1526 - val_loss: 148.2686 - val_mean_squared_error: 148.2686\n"", + ""Epoch 624/1000\n"", + ""2/2 - 0s - loss: 202.1453 - mean_squared_error: 202.1453 - val_loss: 148.9377 - val_mean_squared_error: 148.9377\n"", + ""Epoch 625/1000\n"", + ""2/2 - 0s - loss: 202.3091 - mean_squared_error: 202.3091 - val_loss: 149.9653 - val_mean_squared_error: 149.9653\n"", + ""Epoch 626/1000\n"", + ""2/2 - 0s - loss: 202.2250 - mean_squared_error: 202.2250 - val_loss: 150.1470 - val_mean_squared_error: 150.1470\n"", + ""Epoch 627/1000\n"", + ""2/2 - 0s - loss: 202.0844 - mean_squared_error: 202.0844 - val_loss: 149.3073 - val_mean_squared_error: 149.3073\n"", + ""Epoch 628/1000\n"", + ""2/2 - 0s - loss: 202.2352 - mean_squared_error: 202.2352 - val_loss: 148.3743 - val_mean_squared_error: 148.3743\n"", + ""Epoch 629/1000\n"", + ""2/2 - 0s - loss: 202.1824 - mean_squared_error: 202.1824 - val_loss: 149.0000 - val_mean_squared_error: 149.0000\n"", + ""Epoch 630/1000\n"", + ""2/2 - 0s - loss: 202.1135 - mean_squared_error: 202.1135 - val_loss: 149.2007 - val_mean_squared_error: 149.2007\n"", + ""Epoch 631/1000\n"", + ""2/2 - 0s - loss: 202.1459 - mean_squared_error: 202.1459 - val_loss: 149.9234 - val_mean_squared_error: 149.9234\n"", + ""Epoch 632/1000\n"", + ""2/2 - 0s - loss: 202.1007 - mean_squared_error: 202.1007 - val_loss: 150.2223 - val_mean_squared_error: 150.2223\n"", + ""Epoch 633/1000\n"", + ""2/2 - 0s - loss: 202.1249 - mean_squared_error: 202.1249 - val_loss: 150.5592 - val_mean_squared_error: 150.5592\n"", + ""Epoch 634/1000\n"", + ""2/2 - 0s - loss: 202.1966 - mean_squared_error: 202.1966 - val_loss: 150.6593 - val_mean_squared_error: 150.6593\n"", + ""Epoch 635/1000\n"", + ""2/2 - 0s - loss: 202.1185 - mean_squared_error: 202.1185 - val_loss: 149.9572 - val_mean_squared_error: 149.9572\n"", + ""Epoch 636/1000\n"", + ""2/2 - 0s - loss: 202.0738 - mean_squared_error: 202.0738 - val_loss: 148.8385 - val_mean_squared_error: 148.8385\n"", + ""Epoch 637/1000\n"", + ""2/2 - 0s - loss: 202.1122 - mean_squared_error: 202.1122 - val_loss: 147.7197 - val_mean_squared_error: 147.7197\n"", + ""Epoch 638/1000\n"", + ""2/2 - 0s - loss: 202.1902 - mean_squared_error: 202.1902 - val_loss: 147.1327 - val_mean_squared_error: 147.1327\n"", + ""Epoch 639/1000\n"", + ""2/2 - 0s - loss: 202.2118 - mean_squared_error: 202.2118 - val_loss: 147.4651 - val_mean_squared_error: 147.4651\n"", + ""Epoch 640/1000\n"", + ""2/2 - 0s - loss: 202.1868 - mean_squared_error: 202.1867 - val_loss: 148.1920 - val_mean_squared_error: 148.1920\n"", + ""Epoch 641/1000\n"", + ""2/2 - 0s - loss: 202.1507 - mean_squared_error: 202.1507 - val_loss: 149.1324 - val_mean_squared_error: 149.1324\n"", + ""Epoch 642/1000\n"", + ""2/2 - 0s - loss: 202.1121 - mean_squared_error: 202.1121 - val_loss: 150.1813 - val_mean_squared_error: 150.1813\n"", + ""Epoch 643/1000\n"", + ""2/2 - 0s - loss: 202.0849 - mean_squared_error: 202.0849 - val_loss: 151.0176 - val_mean_squared_error: 151.0176\n"", + ""Epoch 644/1000\n"", + ""2/2 - 0s - loss: 202.1162 - mean_squared_error: 202.1162 - val_loss: 151.9593 - val_mean_squared_error: 151.9593\n"", + ""Epoch 645/1000\n"", + ""2/2 - 0s - loss: 202.0941 - mean_squared_error: 202.0941 - val_loss: 152.1752 - val_mean_squared_error: 152.1752\n"", + ""Epoch 646/1000\n"", + ""2/2 - 0s - loss: 202.1900 - mean_squared_error: 202.1900 - val_loss: 152.0518 - val_mean_squared_error: 152.0518\n"", + ""Epoch 647/1000\n"", + ""2/2 - 0s - loss: 202.1521 - mean_squared_error: 202.1521 - val_loss: 152.9232 - val_mean_squared_error: 152.9232\n"", + ""Epoch 648/1000\n"", + ""2/2 - 0s - loss: 202.3073 - mean_squared_error: 202.3073 - val_loss: 153.1748 - val_mean_squared_error: 153.1748\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 649/1000\n"", + ""2/2 - 0s - loss: 202.1043 - mean_squared_error: 202.1043 - val_loss: 151.7087 - val_mean_squared_error: 151.7087\n"", + ""Epoch 650/1000\n"", + ""2/2 - 0s - loss: 202.0816 - mean_squared_error: 202.0816 - val_loss: 150.2634 - val_mean_squared_error: 150.2634\n"", + ""Epoch 651/1000\n"", + ""2/2 - 0s - loss: 202.1824 - mean_squared_error: 202.1824 - val_loss: 148.8937 - val_mean_squared_error: 148.8937\n"", + ""Epoch 652/1000\n"", + ""2/2 - 0s - loss: 202.2218 - mean_squared_error: 202.2218 - val_loss: 149.0583 - val_mean_squared_error: 149.0583\n"", + ""Epoch 653/1000\n"", + ""2/2 - 0s - loss: 202.1607 - mean_squared_error: 202.1607 - val_loss: 148.2895 - val_mean_squared_error: 148.2895\n"", + ""Epoch 654/1000\n"", + ""2/2 - 0s - loss: 202.1440 - mean_squared_error: 202.1440 - val_loss: 148.5263 - val_mean_squared_error: 148.5263\n"", + ""Epoch 655/1000\n"", + ""2/2 - 0s - loss: 202.2338 - mean_squared_error: 202.2338 - val_loss: 149.2133 - val_mean_squared_error: 149.2133\n"", + ""Epoch 656/1000\n"", + ""2/2 - 0s - loss: 202.1704 - mean_squared_error: 202.1704 - val_loss: 148.9843 - val_mean_squared_error: 148.9843\n"", + ""Epoch 657/1000\n"", + ""2/2 - 0s - loss: 202.0998 - mean_squared_error: 202.0998 - val_loss: 149.7690 - val_mean_squared_error: 149.7690\n"", + ""Epoch 658/1000\n"", + ""2/2 - 0s - loss: 202.1511 - mean_squared_error: 202.1511 - val_loss: 150.9170 - val_mean_squared_error: 150.9170\n"", + ""Epoch 659/1000\n"", + ""2/2 - 0s - loss: 202.2291 - mean_squared_error: 202.2291 - val_loss: 151.6138 - val_mean_squared_error: 151.6138\n"", + ""Epoch 660/1000\n"", + ""2/2 - 0s - loss: 202.1674 - mean_squared_error: 202.1674 - val_loss: 151.2986 - val_mean_squared_error: 151.2986\n"", + ""Epoch 661/1000\n"", + ""2/2 - 0s - loss: 202.1154 - mean_squared_error: 202.1154 - val_loss: 149.8040 - val_mean_squared_error: 149.8040\n"", + ""Epoch 662/1000\n"", + ""2/2 - 0s - loss: 202.0837 - mean_squared_error: 202.0837 - val_loss: 149.0354 - val_mean_squared_error: 149.0354\n"", + ""Epoch 663/1000\n"", + ""2/2 - 0s - loss: 202.1882 - mean_squared_error: 202.1882 - val_loss: 148.8381 - val_mean_squared_error: 148.8381\n"", + ""Epoch 664/1000\n"", + ""2/2 - 0s - loss: 202.2005 - mean_squared_error: 202.2005 - val_loss: 147.7129 - val_mean_squared_error: 147.7129\n"", + ""Epoch 665/1000\n"", + ""2/2 - 0s - loss: 202.3978 - mean_squared_error: 202.3978 - val_loss: 148.3493 - val_mean_squared_error: 148.3493\n"", + ""Epoch 666/1000\n"", + ""2/2 - 0s - loss: 202.1745 - mean_squared_error: 202.1745 - val_loss: 147.6386 - val_mean_squared_error: 147.6386\n"", + ""Epoch 667/1000\n"", + ""2/2 - 0s - loss: 202.1853 - mean_squared_error: 202.1853 - val_loss: 147.8113 - val_mean_squared_error: 147.8113\n"", + ""Epoch 668/1000\n"", + ""2/2 - 0s - loss: 202.1239 - mean_squared_error: 202.1239 - val_loss: 149.0111 - val_mean_squared_error: 149.0111\n"", + ""Epoch 669/1000\n"", + ""2/2 - 0s - loss: 202.0966 - mean_squared_error: 202.0966 - val_loss: 150.4442 - val_mean_squared_error: 150.4442\n"", + ""Epoch 670/1000\n"", + ""2/2 - 0s - loss: 202.1503 - mean_squared_error: 202.1503 - val_loss: 151.2283 - val_mean_squared_error: 151.2283\n"", + ""Epoch 671/1000\n"", + ""2/2 - 0s - loss: 202.0910 - mean_squared_error: 202.0910 - val_loss: 152.9898 - val_mean_squared_error: 152.9898\n"", + ""Epoch 672/1000\n"", + ""2/2 - 0s - loss: 202.1373 - mean_squared_error: 202.1373 - val_loss: 153.8002 - val_mean_squared_error: 153.8002\n"", + ""Epoch 673/1000\n"", + ""2/2 - 0s - loss: 202.2065 - mean_squared_error: 202.2065 - val_loss: 154.5698 - val_mean_squared_error: 154.5698\n"", + ""Epoch 674/1000\n"", + ""2/2 - 0s - loss: 202.4677 - mean_squared_error: 202.4677 - val_loss: 153.6064 - val_mean_squared_error: 153.6064\n"", + ""Epoch 675/1000\n"", + ""2/2 - 0s - loss: 202.2076 - mean_squared_error: 202.2076 - val_loss: 153.9949 - val_mean_squared_error: 153.9949\n"", + ""Epoch 676/1000\n"", + ""2/2 - 0s - loss: 202.1615 - mean_squared_error: 202.1615 - val_loss: 153.1512 - val_mean_squared_error: 153.1512\n"", + ""Epoch 677/1000\n"", + ""2/2 - 0s - loss: 202.1094 - mean_squared_error: 202.1094 - val_loss: 151.7852 - val_mean_squared_error: 151.7852\n"", + ""Epoch 678/1000\n"", + ""2/2 - 0s - loss: 202.0821 - mean_squared_error: 202.0821 - val_loss: 150.2465 - val_mean_squared_error: 150.2465\n"", + ""Epoch 679/1000\n"", + ""2/2 - 0s - loss: 202.1467 - mean_squared_error: 202.1467 - val_loss: 148.6149 - val_mean_squared_error: 148.6149\n"", + ""Epoch 680/1000\n"", + ""2/2 - 0s - loss: 202.1171 - mean_squared_error: 202.1171 - val_loss: 148.2415 - val_mean_squared_error: 148.2415\n"", + ""Epoch 681/1000\n"", + ""2/2 - 0s - loss: 202.1651 - mean_squared_error: 202.1651 - val_loss: 147.5257 - val_mean_squared_error: 147.5257\n"", + ""Epoch 682/1000\n"", + ""2/2 - 0s - loss: 202.1395 - mean_squared_error: 202.1395 - val_loss: 147.9196 - val_mean_squared_error: 147.9196\n"", + ""Epoch 683/1000\n"", + ""2/2 - 0s - loss: 202.2144 - mean_squared_error: 202.2144 - val_loss: 148.8418 - val_mean_squared_error: 148.8418\n"", + ""Epoch 684/1000\n"", + ""2/2 - 0s - loss: 202.0995 - mean_squared_error: 202.0995 - val_loss: 149.0433 - val_mean_squared_error: 149.0433\n"", + ""Epoch 685/1000\n"", + ""2/2 - 0s - loss: 202.0813 - mean_squared_error: 202.0813 - val_loss: 149.6744 - val_mean_squared_error: 149.6744\n"", + ""Epoch 686/1000\n"", + ""2/2 - 0s - loss: 202.1410 - mean_squared_error: 202.1410 - val_loss: 150.6398 - val_mean_squared_error: 150.6398\n"", + ""Epoch 687/1000\n"", + ""2/2 - 0s - loss: 202.0921 - mean_squared_error: 202.0921 - val_loss: 150.7460 - val_mean_squared_error: 150.7460\n"", + ""Epoch 688/1000\n"", + ""2/2 - 0s - loss: 202.5664 - mean_squared_error: 202.5664 - val_loss: 151.7155 - val_mean_squared_error: 151.7155\n"", + ""Epoch 689/1000\n"", + ""2/2 - 0s - loss: 202.0833 - mean_squared_error: 202.0833 - val_loss: 150.1384 - val_mean_squared_error: 150.1384\n"", + ""Epoch 690/1000\n"", + ""2/2 - 0s - loss: 202.0808 - mean_squared_error: 202.0808 - val_loss: 149.2327 - val_mean_squared_error: 149.2327\n"", + ""Epoch 691/1000\n"", + ""2/2 - 0s - loss: 202.4819 - mean_squared_error: 202.4819 - val_loss: 147.3933 - val_mean_squared_error: 147.3933\n"", + ""Epoch 692/1000\n"", + ""2/2 - 0s - loss: 202.1516 - mean_squared_error: 202.1516 - val_loss: 147.8071 - val_mean_squared_error: 147.8071\n"", + ""Epoch 693/1000\n"", + ""2/2 - 0s - loss: 202.1900 - mean_squared_error: 202.1900 - val_loss: 149.1287 - val_mean_squared_error: 149.1287\n"", + ""Epoch 694/1000\n"", + ""2/2 - 0s - loss: 202.0795 - mean_squared_error: 202.0795 - val_loss: 149.7631 - val_mean_squared_error: 149.7631\n"", + ""Epoch 695/1000\n"", + ""2/2 - 0s - loss: 202.1661 - mean_squared_error: 202.1661 - val_loss: 150.9577 - val_mean_squared_error: 150.9577\n"", + ""Epoch 696/1000\n"", + ""2/2 - 0s - loss: 202.0907 - mean_squared_error: 202.0907 - val_loss: 151.1866 - val_mean_squared_error: 151.1866\n"", + ""Epoch 697/1000\n"", + ""2/2 - 0s - loss: 202.1485 - mean_squared_error: 202.1485 - val_loss: 151.2743 - val_mean_squared_error: 151.2743\n"", + ""Epoch 698/1000\n"", + ""2/2 - 0s - loss: 202.1310 - mean_squared_error: 202.1310 - val_loss: 150.5581 - val_mean_squared_error: 150.5581\n"", + ""Epoch 699/1000\n"", + ""2/2 - 0s - loss: 202.0619 - mean_squared_error: 202.0619 - val_loss: 149.2612 - val_mean_squared_error: 149.2612\n"", + ""Epoch 700/1000\n"", + ""2/2 - 0s - loss: 202.0545 - mean_squared_error: 202.0545 - val_loss: 147.5782 - val_mean_squared_error: 147.5782\n"", + ""Epoch 701/1000\n"", + ""2/2 - 0s - loss: 202.1425 - mean_squared_error: 202.1425 - val_loss: 146.4339 - val_mean_squared_error: 146.4339\n"", + ""Epoch 702/1000\n"", + ""2/2 - 0s - loss: 202.1891 - mean_squared_error: 202.1891 - val_loss: 146.2926 - val_mean_squared_error: 146.2926\n"", + ""Epoch 703/1000\n"", + ""2/2 - 0s - loss: 202.2139 - mean_squared_error: 202.2139 - val_loss: 146.8936 - val_mean_squared_error: 146.8936\n"", + ""Epoch 704/1000\n"", + ""2/2 - 0s - loss: 202.1712 - mean_squared_error: 202.1712 - val_loss: 147.8068 - val_mean_squared_error: 147.8068\n"", + ""Epoch 705/1000\n"", + ""2/2 - 0s - loss: 202.3440 - mean_squared_error: 202.3440 - val_loss: 149.1452 - val_mean_squared_error: 149.1452\n"", + ""Epoch 706/1000\n"", + ""2/2 - 0s - loss: 202.1713 - mean_squared_error: 202.1713 - val_loss: 149.4758 - val_mean_squared_error: 149.4758\n"", + ""Epoch 707/1000\n"", + ""2/2 - 0s - loss: 202.0744 - mean_squared_error: 202.0744 - val_loss: 148.9662 - val_mean_squared_error: 148.9662\n"", + ""Epoch 708/1000\n"", + ""2/2 - 0s - loss: 202.1205 - mean_squared_error: 202.1205 - val_loss: 148.6769 - val_mean_squared_error: 148.6769\n"", + ""Epoch 709/1000\n"", + ""2/2 - 0s - loss: 202.1454 - mean_squared_error: 202.1454 - val_loss: 148.9962 - val_mean_squared_error: 148.9962\n"", + ""Epoch 710/1000\n"", + ""2/2 - 0s - loss: 202.0896 - mean_squared_error: 202.0896 - val_loss: 150.4396 - val_mean_squared_error: 150.4396\n"", + ""Epoch 711/1000\n"", + ""2/2 - 0s - loss: 202.1071 - mean_squared_error: 202.1071 - val_loss: 151.1678 - val_mean_squared_error: 151.1678\n"", + ""Epoch 712/1000\n"", + ""2/2 - 0s - loss: 202.0613 - mean_squared_error: 202.0613 - val_loss: 152.6203 - val_mean_squared_error: 152.6203\n"", + ""Epoch 713/1000\n"", + ""2/2 - 0s - loss: 202.1847 - mean_squared_error: 202.1847 - val_loss: 153.8151 - val_mean_squared_error: 153.8151\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 714/1000\n"", + ""2/2 - 0s - loss: 202.1774 - mean_squared_error: 202.1774 - val_loss: 153.5364 - val_mean_squared_error: 153.5364\n"", + ""Epoch 715/1000\n"", + ""2/2 - 0s - loss: 202.1811 - mean_squared_error: 202.1811 - val_loss: 153.0305 - val_mean_squared_error: 153.0305\n"", + ""Epoch 716/1000\n"", + ""2/2 - 0s - loss: 202.1140 - mean_squared_error: 202.1140 - val_loss: 151.1728 - val_mean_squared_error: 151.1728\n"", + ""Epoch 717/1000\n"", + ""2/2 - 0s - loss: 202.3583 - mean_squared_error: 202.3583 - val_loss: 149.2529 - val_mean_squared_error: 149.2529\n"", + ""Epoch 718/1000\n"", + ""2/2 - 0s - loss: 202.0834 - mean_squared_error: 202.0834 - val_loss: 149.2579 - val_mean_squared_error: 149.2579\n"", + ""Epoch 719/1000\n"", + ""2/2 - 0s - loss: 202.2755 - mean_squared_error: 202.2755 - val_loss: 148.9082 - val_mean_squared_error: 148.9082\n"", + ""Epoch 720/1000\n"", + ""2/2 - 0s - loss: 202.0811 - mean_squared_error: 202.0811 - val_loss: 150.2691 - val_mean_squared_error: 150.2691\n"", + ""Epoch 721/1000\n"", + ""2/2 - 0s - loss: 202.0818 - mean_squared_error: 202.0818 - val_loss: 151.5621 - val_mean_squared_error: 151.5621\n"", + ""Epoch 722/1000\n"", + ""2/2 - 0s - loss: 202.1159 - mean_squared_error: 202.1159 - val_loss: 152.4638 - val_mean_squared_error: 152.4638\n"", + ""Epoch 723/1000\n"", + ""2/2 - 0s - loss: 202.0987 - mean_squared_error: 202.0987 - val_loss: 152.4129 - val_mean_squared_error: 152.4129\n"", + ""Epoch 724/1000\n"", + ""2/2 - 0s - loss: 202.1151 - mean_squared_error: 202.1151 - val_loss: 152.2827 - val_mean_squared_error: 152.2827\n"", + ""Epoch 725/1000\n"", + ""2/2 - 0s - loss: 202.0766 - mean_squared_error: 202.0766 - val_loss: 151.3624 - val_mean_squared_error: 151.3624\n"", + ""Epoch 726/1000\n"", + ""2/2 - 0s - loss: 202.0562 - mean_squared_error: 202.0562 - val_loss: 150.2902 - val_mean_squared_error: 150.2902\n"", + ""Epoch 727/1000\n"", + ""2/2 - 0s - loss: 202.0529 - mean_squared_error: 202.0529 - val_loss: 149.1869 - val_mean_squared_error: 149.1869\n"", + ""Epoch 728/1000\n"", + ""2/2 - 0s - loss: 202.1361 - mean_squared_error: 202.1361 - val_loss: 148.1951 - val_mean_squared_error: 148.1951\n"", + ""Epoch 729/1000\n"", + ""2/2 - 0s - loss: 202.2077 - mean_squared_error: 202.2077 - val_loss: 146.3313 - val_mean_squared_error: 146.3313\n"", + ""Epoch 730/1000\n"", + ""2/2 - 0s - loss: 202.2236 - mean_squared_error: 202.2236 - val_loss: 146.2486 - val_mean_squared_error: 146.2486\n"", + ""Epoch 731/1000\n"", + ""2/2 - 0s - loss: 202.2475 - mean_squared_error: 202.2475 - val_loss: 146.6849 - val_mean_squared_error: 146.6849\n"", + ""Epoch 732/1000\n"", + ""2/2 - 0s - loss: 202.1864 - mean_squared_error: 202.1864 - val_loss: 147.3411 - val_mean_squared_error: 147.3411\n"", + ""Epoch 733/1000\n"", + ""2/2 - 0s - loss: 202.1978 - mean_squared_error: 202.1978 - val_loss: 148.6341 - val_mean_squared_error: 148.6341\n"", + ""Epoch 734/1000\n"", + ""2/2 - 0s - loss: 202.0895 - mean_squared_error: 202.0895 - val_loss: 149.6273 - val_mean_squared_error: 149.6273\n"", + ""Epoch 735/1000\n"", + ""2/2 - 0s - loss: 202.0764 - mean_squared_error: 202.0764 - val_loss: 150.6916 - val_mean_squared_error: 150.6916\n"", + ""Epoch 736/1000\n"", + ""2/2 - 0s - loss: 202.1207 - mean_squared_error: 202.1207 - val_loss: 151.6931 - val_mean_squared_error: 151.6931\n"", + ""Epoch 737/1000\n"", + ""2/2 - 0s - loss: 202.0774 - mean_squared_error: 202.0774 - val_loss: 151.7762 - val_mean_squared_error: 151.7762\n"", + ""Epoch 738/1000\n"", + ""2/2 - 0s - loss: 202.1175 - mean_squared_error: 202.1175 - val_loss: 151.5518 - val_mean_squared_error: 151.5518\n"", + ""Epoch 739/1000\n"", + ""2/2 - 0s - loss: 202.1000 - mean_squared_error: 202.1000 - val_loss: 151.9293 - val_mean_squared_error: 151.9293\n"", + ""Epoch 740/1000\n"", + ""2/2 - 0s - loss: 202.1583 - mean_squared_error: 202.1583 - val_loss: 151.9335 - val_mean_squared_error: 151.9335\n"", + ""Epoch 741/1000\n"", + ""2/2 - 0s - loss: 202.0693 - mean_squared_error: 202.0693 - val_loss: 150.6932 - val_mean_squared_error: 150.6932\n"", + ""Epoch 742/1000\n"", + ""2/2 - 0s - loss: 202.1144 - mean_squared_error: 202.1144 - val_loss: 150.0016 - val_mean_squared_error: 150.0016\n"", + ""Epoch 743/1000\n"", + ""2/2 - 0s - loss: 202.1986 - mean_squared_error: 202.1986 - val_loss: 148.2056 - val_mean_squared_error: 148.2056\n"", + ""Epoch 744/1000\n"", + ""2/2 - 0s - loss: 202.2245 - mean_squared_error: 202.2245 - val_loss: 147.6527 - val_mean_squared_error: 147.6527\n"", + ""Epoch 745/1000\n"", + ""2/2 - 0s - loss: 202.1363 - mean_squared_error: 202.1363 - val_loss: 148.6894 - val_mean_squared_error: 148.6894\n"", + ""Epoch 746/1000\n"", + ""2/2 - 0s - loss: 202.1319 - mean_squared_error: 202.1319 - val_loss: 149.9612 - val_mean_squared_error: 149.9612\n"", + ""Epoch 747/1000\n"", + ""2/2 - 0s - loss: 202.0861 - mean_squared_error: 202.0861 - val_loss: 150.5628 - val_mean_squared_error: 150.5628\n"", + ""Epoch 748/1000\n"", + ""2/2 - 0s - loss: 202.0825 - mean_squared_error: 202.0825 - val_loss: 151.7214 - val_mean_squared_error: 151.7214\n"", + ""Epoch 749/1000\n"", + ""2/2 - 0s - loss: 202.0904 - mean_squared_error: 202.0904 - val_loss: 152.2741 - val_mean_squared_error: 152.2741\n"", + ""Epoch 750/1000\n"", + ""2/2 - 0s - loss: 202.0890 - mean_squared_error: 202.0890 - val_loss: 152.2209 - val_mean_squared_error: 152.2209\n"", + ""Epoch 751/1000\n"", + ""2/2 - 0s - loss: 202.0819 - mean_squared_error: 202.0819 - val_loss: 151.8389 - val_mean_squared_error: 151.8389\n"", + ""Epoch 752/1000\n"", + ""2/2 - 0s - loss: 202.1346 - mean_squared_error: 202.1346 - val_loss: 151.0019 - val_mean_squared_error: 151.0019\n"", + ""Epoch 753/1000\n"", + ""2/2 - 0s - loss: 202.0820 - mean_squared_error: 202.0820 - val_loss: 150.8131 - val_mean_squared_error: 150.8131\n"", + ""Epoch 754/1000\n"", + ""2/2 - 0s - loss: 202.0798 - mean_squared_error: 202.0798 - val_loss: 151.0888 - val_mean_squared_error: 151.0888\n"", + ""Epoch 755/1000\n"", + ""2/2 - 0s - loss: 202.0727 - mean_squared_error: 202.0727 - val_loss: 150.9758 - val_mean_squared_error: 150.9758\n"", + ""Epoch 756/1000\n"", + ""2/2 - 0s - loss: 202.1575 - mean_squared_error: 202.1575 - val_loss: 151.0277 - val_mean_squared_error: 151.0277\n"", + ""Epoch 757/1000\n"", + ""2/2 - 0s - loss: 202.0682 - mean_squared_error: 202.0682 - val_loss: 150.1870 - val_mean_squared_error: 150.1870\n"", + ""Epoch 758/1000\n"", + ""2/2 - 0s - loss: 202.0673 - mean_squared_error: 202.0673 - val_loss: 148.9580 - val_mean_squared_error: 148.9580\n"", + ""Epoch 759/1000\n"", + ""2/2 - 0s - loss: 202.0939 - mean_squared_error: 202.0939 - val_loss: 148.4854 - val_mean_squared_error: 148.4854\n"", + ""Epoch 760/1000\n"", + ""2/2 - 0s - loss: 202.1784 - mean_squared_error: 202.1784 - val_loss: 147.8466 - val_mean_squared_error: 147.8466\n"", + ""Epoch 761/1000\n"", + ""2/2 - 0s - loss: 202.1268 - mean_squared_error: 202.1268 - val_loss: 148.4051 - val_mean_squared_error: 148.4051\n"", + ""Epoch 762/1000\n"", + ""2/2 - 0s - loss: 202.0871 - mean_squared_error: 202.0871 - val_loss: 149.5828 - val_mean_squared_error: 149.5828\n"", + ""Epoch 763/1000\n"", + ""2/2 - 0s - loss: 202.1328 - mean_squared_error: 202.1328 - val_loss: 151.2450 - val_mean_squared_error: 151.2450\n"", + ""Epoch 764/1000\n"", + ""2/2 - 0s - loss: 202.0733 - mean_squared_error: 202.0733 - val_loss: 152.0075 - val_mean_squared_error: 152.0075\n"", + ""Epoch 765/1000\n"", + ""2/2 - 0s - loss: 202.1299 - mean_squared_error: 202.1299 - val_loss: 152.4682 - val_mean_squared_error: 152.4682\n"", + ""Epoch 766/1000\n"", + ""2/2 - 0s - loss: 202.1095 - mean_squared_error: 202.1095 - val_loss: 152.0393 - val_mean_squared_error: 152.0393\n"", + ""Epoch 767/1000\n"", + ""2/2 - 0s - loss: 202.2422 - mean_squared_error: 202.2422 - val_loss: 150.4488 - val_mean_squared_error: 150.4488\n"", + ""Epoch 768/1000\n"", + ""2/2 - 0s - loss: 202.0700 - mean_squared_error: 202.0700 - val_loss: 150.2531 - val_mean_squared_error: 150.2531\n"", + ""Epoch 769/1000\n"", + ""2/2 - 0s - loss: 202.0643 - mean_squared_error: 202.0643 - val_loss: 149.7903 - val_mean_squared_error: 149.7903\n"", + ""Epoch 770/1000\n"", + ""2/2 - 0s - loss: 202.6427 - mean_squared_error: 202.6427 - val_loss: 148.6999 - val_mean_squared_error: 148.6999\n"", + ""Epoch 771/1000\n"", + ""2/2 - 0s - loss: 202.2653 - mean_squared_error: 202.2653 - val_loss: 150.7400 - val_mean_squared_error: 150.7400\n"", + ""Epoch 772/1000\n"", + ""2/2 - 0s - loss: 202.0700 - mean_squared_error: 202.0700 - val_loss: 151.2335 - val_mean_squared_error: 151.2335\n"", + ""Epoch 773/1000\n"", + ""2/2 - 0s - loss: 202.2314 - mean_squared_error: 202.2314 - val_loss: 151.4268 - val_mean_squared_error: 151.4268\n"", + ""Epoch 774/1000\n"", + ""2/2 - 0s - loss: 202.1861 - mean_squared_error: 202.1861 - val_loss: 153.1965 - val_mean_squared_error: 153.1965\n"", + ""Epoch 775/1000\n"", + ""2/2 - 0s - loss: 202.1315 - mean_squared_error: 202.1315 - val_loss: 153.3008 - val_mean_squared_error: 153.3008\n"", + ""Epoch 776/1000\n"", + ""2/2 - 0s - loss: 202.1310 - mean_squared_error: 202.1310 - val_loss: 153.0512 - val_mean_squared_error: 153.0512\n"", + ""Epoch 777/1000\n"", + ""2/2 - 0s - loss: 202.1221 - mean_squared_error: 202.1221 - val_loss: 152.3680 - val_mean_squared_error: 152.3680\n"", + ""Epoch 778/1000\n"", + ""2/2 - 0s - loss: 202.0699 - mean_squared_error: 202.0699 - val_loss: 151.0321 - val_mean_squared_error: 151.0321\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 779/1000\n"", + ""2/2 - 0s - loss: 202.2716 - mean_squared_error: 202.2716 - val_loss: 148.9991 - val_mean_squared_error: 148.9991\n"", + ""Epoch 780/1000\n"", + ""2/2 - 0s - loss: 202.1855 - mean_squared_error: 202.1855 - val_loss: 149.0150 - val_mean_squared_error: 149.0150\n"", + ""Epoch 781/1000\n"", + ""2/2 - 0s - loss: 202.0917 - mean_squared_error: 202.0917 - val_loss: 148.3359 - val_mean_squared_error: 148.3359\n"", + ""Epoch 782/1000\n"", + ""2/2 - 0s - loss: 202.1996 - mean_squared_error: 202.1996 - val_loss: 147.2208 - val_mean_squared_error: 147.2208\n"", + ""Epoch 783/1000\n"", + ""2/2 - 0s - loss: 202.1664 - mean_squared_error: 202.1664 - val_loss: 147.4771 - val_mean_squared_error: 147.4771\n"", + ""Epoch 784/1000\n"", + ""2/2 - 0s - loss: 202.1602 - mean_squared_error: 202.1602 - val_loss: 148.9103 - val_mean_squared_error: 148.9103\n"", + ""Epoch 785/1000\n"", + ""2/2 - 0s - loss: 202.0902 - mean_squared_error: 202.0902 - val_loss: 149.7959 - val_mean_squared_error: 149.7959\n"", + ""Epoch 786/1000\n"", + ""2/2 - 0s - loss: 202.0458 - mean_squared_error: 202.0458 - val_loss: 151.3179 - val_mean_squared_error: 151.3179\n"", + ""Epoch 787/1000\n"", + ""2/2 - 0s - loss: 202.0686 - mean_squared_error: 202.0686 - val_loss: 153.1290 - val_mean_squared_error: 153.1290\n"", + ""Epoch 788/1000\n"", + ""2/2 - 0s - loss: 202.1787 - mean_squared_error: 202.1787 - val_loss: 154.2703 - val_mean_squared_error: 154.2703\n"", + ""Epoch 789/1000\n"", + ""2/2 - 0s - loss: 202.1775 - mean_squared_error: 202.1775 - val_loss: 153.8059 - val_mean_squared_error: 153.8059\n"", + ""Epoch 790/1000\n"", + ""2/2 - 0s - loss: 202.1358 - mean_squared_error: 202.1358 - val_loss: 153.2297 - val_mean_squared_error: 153.2297\n"", + ""Epoch 791/1000\n"", + ""2/2 - 0s - loss: 202.1361 - mean_squared_error: 202.1361 - val_loss: 151.8564 - val_mean_squared_error: 151.8564\n"", + ""Epoch 792/1000\n"", + ""2/2 - 0s - loss: 202.2626 - mean_squared_error: 202.2626 - val_loss: 150.4022 - val_mean_squared_error: 150.4022\n"", + ""Epoch 793/1000\n"", + ""2/2 - 0s - loss: 202.1101 - mean_squared_error: 202.1101 - val_loss: 150.6041 - val_mean_squared_error: 150.6041\n"", + ""Epoch 794/1000\n"", + ""2/2 - 0s - loss: 202.0800 - mean_squared_error: 202.0800 - val_loss: 150.0810 - val_mean_squared_error: 150.0810\n"", + ""Epoch 795/1000\n"", + ""2/2 - 0s - loss: 202.0809 - mean_squared_error: 202.0809 - val_loss: 149.8701 - val_mean_squared_error: 149.8701\n"", + ""Epoch 796/1000\n"", + ""2/2 - 0s - loss: 202.0802 - mean_squared_error: 202.0802 - val_loss: 150.2115 - val_mean_squared_error: 150.2115\n"", + ""Epoch 797/1000\n"", + ""2/2 - 0s - loss: 202.0893 - mean_squared_error: 202.0893 - val_loss: 150.4983 - val_mean_squared_error: 150.4983\n"", + ""Epoch 798/1000\n"", + ""2/2 - 0s - loss: 202.0855 - mean_squared_error: 202.0855 - val_loss: 150.3205 - val_mean_squared_error: 150.3205\n"", + ""Epoch 799/1000\n"", + ""2/2 - 0s - loss: 202.0846 - mean_squared_error: 202.0846 - val_loss: 150.1929 - val_mean_squared_error: 150.1929\n"", + ""Epoch 800/1000\n"", + ""2/2 - 0s - loss: 202.0666 - mean_squared_error: 202.0666 - val_loss: 150.5544 - val_mean_squared_error: 150.5544\n"", + ""Epoch 801/1000\n"", + ""2/2 - 0s - loss: 202.1531 - mean_squared_error: 202.1531 - val_loss: 150.5608 - val_mean_squared_error: 150.5608\n"", + ""Epoch 802/1000\n"", + ""2/2 - 0s - loss: 202.0791 - mean_squared_error: 202.0791 - val_loss: 151.6115 - val_mean_squared_error: 151.6115\n"", + ""Epoch 803/1000\n"", + ""2/2 - 0s - loss: 202.0973 - mean_squared_error: 202.0973 - val_loss: 151.9576 - val_mean_squared_error: 151.9576\n"", + ""Epoch 804/1000\n"", + ""2/2 - 0s - loss: 202.2369 - mean_squared_error: 202.2369 - val_loss: 153.0553 - val_mean_squared_error: 153.0553\n"", + ""Epoch 805/1000\n"", + ""2/2 - 0s - loss: 202.1080 - mean_squared_error: 202.1080 - val_loss: 152.4489 - val_mean_squared_error: 152.4489\n"", + ""Epoch 806/1000\n"", + ""2/2 - 0s - loss: 202.1552 - mean_squared_error: 202.1552 - val_loss: 151.6832 - val_mean_squared_error: 151.6832\n"", + ""Epoch 807/1000\n"", + ""2/2 - 0s - loss: 202.3302 - mean_squared_error: 202.3302 - val_loss: 149.2435 - val_mean_squared_error: 149.2435\n"", + ""Epoch 808/1000\n"", + ""2/2 - 0s - loss: 202.0814 - mean_squared_error: 202.0814 - val_loss: 148.7170 - val_mean_squared_error: 148.7170\n"", + ""Epoch 809/1000\n"", + ""2/2 - 0s - loss: 202.1569 - mean_squared_error: 202.1569 - val_loss: 148.9590 - val_mean_squared_error: 148.9590\n"", + ""Epoch 810/1000\n"", + ""2/2 - 0s - loss: 202.1165 - mean_squared_error: 202.1165 - val_loss: 148.5395 - val_mean_squared_error: 148.5395\n"", + ""Epoch 811/1000\n"", + ""2/2 - 0s - loss: 202.1487 - mean_squared_error: 202.1487 - val_loss: 149.2133 - val_mean_squared_error: 149.2133\n"", + ""Epoch 812/1000\n"", + ""2/2 - 0s - loss: 202.1101 - mean_squared_error: 202.1101 - val_loss: 149.5530 - val_mean_squared_error: 149.5530\n"", + ""Epoch 813/1000\n"", + ""2/2 - 0s - loss: 202.1622 - mean_squared_error: 202.1622 - val_loss: 149.8123 - val_mean_squared_error: 149.8123\n"", + ""Epoch 814/1000\n"", + ""2/2 - 0s - loss: 202.0723 - mean_squared_error: 202.0723 - val_loss: 149.1557 - val_mean_squared_error: 149.1557\n"", + ""Epoch 815/1000\n"", + ""2/2 - 0s - loss: 202.1057 - mean_squared_error: 202.1057 - val_loss: 149.1559 - val_mean_squared_error: 149.1559\n"", + ""Epoch 816/1000\n"", + ""2/2 - 0s - loss: 202.0818 - mean_squared_error: 202.0818 - val_loss: 148.8497 - val_mean_squared_error: 148.8497\n"", + ""Epoch 817/1000\n"", + ""2/2 - 0s - loss: 202.1088 - mean_squared_error: 202.1088 - val_loss: 148.8462 - val_mean_squared_error: 148.8462\n"", + ""Epoch 818/1000\n"", + ""2/2 - 0s - loss: 202.1351 - mean_squared_error: 202.1351 - val_loss: 149.7501 - val_mean_squared_error: 149.7501\n"", + ""Epoch 819/1000\n"", + ""2/2 - 0s - loss: 202.0849 - mean_squared_error: 202.0849 - val_loss: 150.1204 - val_mean_squared_error: 150.1204\n"", + ""Epoch 820/1000\n"", + ""2/2 - 0s - loss: 202.1386 - mean_squared_error: 202.1386 - val_loss: 150.7135 - val_mean_squared_error: 150.7135\n"", + ""Epoch 821/1000\n"", + ""2/2 - 0s - loss: 202.1284 - mean_squared_error: 202.1284 - val_loss: 150.6509 - val_mean_squared_error: 150.6509\n"", + ""Epoch 822/1000\n"", + ""2/2 - 0s - loss: 202.0593 - mean_squared_error: 202.0593 - val_loss: 149.6863 - val_mean_squared_error: 149.6863\n"", + ""Epoch 823/1000\n"", + ""2/2 - 0s - loss: 202.1343 - mean_squared_error: 202.1343 - val_loss: 148.8222 - val_mean_squared_error: 148.8222\n"", + ""Epoch 824/1000\n"", + ""2/2 - 0s - loss: 202.1094 - mean_squared_error: 202.1094 - val_loss: 149.0306 - val_mean_squared_error: 149.0306\n"", + ""Epoch 825/1000\n"", + ""2/2 - 0s - loss: 202.1059 - mean_squared_error: 202.1059 - val_loss: 149.5950 - val_mean_squared_error: 149.5950\n"", + ""Epoch 826/1000\n"", + ""2/2 - 0s - loss: 202.0833 - mean_squared_error: 202.0833 - val_loss: 150.1505 - val_mean_squared_error: 150.1505\n"", + ""Epoch 827/1000\n"", + ""2/2 - 0s - loss: 202.1476 - mean_squared_error: 202.1476 - val_loss: 150.2437 - val_mean_squared_error: 150.2437\n"", + ""Epoch 828/1000\n"", + ""2/2 - 0s - loss: 202.0558 - mean_squared_error: 202.0558 - val_loss: 151.4021 - val_mean_squared_error: 151.4021\n"", + ""Epoch 829/1000\n"", + ""2/2 - 0s - loss: 202.0766 - mean_squared_error: 202.0766 - val_loss: 152.2462 - val_mean_squared_error: 152.2462\n"", + ""Epoch 830/1000\n"", + ""2/2 - 0s - loss: 202.1328 - mean_squared_error: 202.1328 - val_loss: 153.5210 - val_mean_squared_error: 153.5210\n"", + ""Epoch 831/1000\n"", + ""2/2 - 0s - loss: 202.2604 - mean_squared_error: 202.2604 - val_loss: 153.8938 - val_mean_squared_error: 153.8938\n"", + ""Epoch 832/1000\n"", + ""2/2 - 0s - loss: 202.1623 - mean_squared_error: 202.1623 - val_loss: 152.2145 - val_mean_squared_error: 152.2145\n"", + ""Epoch 833/1000\n"", + ""2/2 - 0s - loss: 202.1272 - mean_squared_error: 202.1272 - val_loss: 150.6489 - val_mean_squared_error: 150.6489\n"", + ""Epoch 834/1000\n"", + ""2/2 - 0s - loss: 202.5466 - mean_squared_error: 202.5466 - val_loss: 149.1772 - val_mean_squared_error: 149.1772\n"", + ""Epoch 835/1000\n"", + ""2/2 - 0s - loss: 202.0876 - mean_squared_error: 202.0876 - val_loss: 150.3270 - val_mean_squared_error: 150.3270\n"", + ""Epoch 836/1000\n"", + ""2/2 - 0s - loss: 202.0630 - mean_squared_error: 202.0630 - val_loss: 151.2431 - val_mean_squared_error: 151.2431\n"", + ""Epoch 837/1000\n"", + ""2/2 - 0s - loss: 202.1129 - mean_squared_error: 202.1129 - val_loss: 152.6382 - val_mean_squared_error: 152.6382\n"", + ""Epoch 838/1000\n"", + ""2/2 - 0s - loss: 202.1192 - mean_squared_error: 202.1192 - val_loss: 153.0495 - val_mean_squared_error: 153.0495\n"", + ""Epoch 839/1000\n"", + ""2/2 - 0s - loss: 202.1539 - mean_squared_error: 202.1539 - val_loss: 152.3972 - val_mean_squared_error: 152.3972\n"", + ""Epoch 840/1000\n"", + ""2/2 - 0s - loss: 202.0977 - mean_squared_error: 202.0977 - val_loss: 152.2455 - val_mean_squared_error: 152.2455\n"", + ""Epoch 841/1000\n"", + ""2/2 - 0s - loss: 202.1152 - mean_squared_error: 202.1152 - val_loss: 151.2520 - val_mean_squared_error: 151.2520\n"", + ""Epoch 842/1000\n"", + ""2/2 - 0s - loss: 202.0872 - mean_squared_error: 202.0872 - val_loss: 150.9403 - val_mean_squared_error: 150.9403\n"", + ""Epoch 843/1000\n"", + ""2/2 - 0s - loss: 202.0820 - mean_squared_error: 202.0820 - val_loss: 150.0597 - val_mean_squared_error: 150.0597\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 844/1000\n"", + ""2/2 - 0s - loss: 202.1962 - mean_squared_error: 202.1962 - val_loss: 150.1452 - val_mean_squared_error: 150.1452\n"", + ""Epoch 845/1000\n"", + ""2/2 - 0s - loss: 202.0743 - mean_squared_error: 202.0743 - val_loss: 149.0679 - val_mean_squared_error: 149.0679\n"", + ""Epoch 846/1000\n"", + ""2/2 - 0s - loss: 202.1367 - mean_squared_error: 202.1367 - val_loss: 148.6609 - val_mean_squared_error: 148.6609\n"", + ""Epoch 847/1000\n"", + ""2/2 - 0s - loss: 202.4124 - mean_squared_error: 202.4124 - val_loss: 147.3778 - val_mean_squared_error: 147.3778\n"", + ""Epoch 848/1000\n"", + ""2/2 - 0s - loss: 202.1959 - mean_squared_error: 202.1959 - val_loss: 148.7031 - val_mean_squared_error: 148.7031\n"", + ""Epoch 849/1000\n"", + ""2/2 - 0s - loss: 202.0945 - mean_squared_error: 202.0945 - val_loss: 149.7693 - val_mean_squared_error: 149.7693\n"", + ""Epoch 850/1000\n"", + ""2/2 - 0s - loss: 202.1221 - mean_squared_error: 202.1221 - val_loss: 151.0616 - val_mean_squared_error: 151.0616\n"", + ""Epoch 851/1000\n"", + ""2/2 - 0s - loss: 202.2927 - mean_squared_error: 202.2927 - val_loss: 151.0233 - val_mean_squared_error: 151.0233\n"", + ""Epoch 852/1000\n"", + ""2/2 - 0s - loss: 202.0928 - mean_squared_error: 202.0928 - val_loss: 152.8352 - val_mean_squared_error: 152.8352\n"", + ""Epoch 853/1000\n"", + ""2/2 - 0s - loss: 202.2014 - mean_squared_error: 202.2014 - val_loss: 153.8709 - val_mean_squared_error: 153.8709\n"", + ""Epoch 854/1000\n"", + ""2/2 - 0s - loss: 202.1346 - mean_squared_error: 202.1346 - val_loss: 153.2912 - val_mean_squared_error: 153.2912\n"", + ""Epoch 855/1000\n"", + ""2/2 - 0s - loss: 202.1356 - mean_squared_error: 202.1356 - val_loss: 152.2148 - val_mean_squared_error: 152.2148\n"", + ""Epoch 856/1000\n"", + ""2/2 - 0s - loss: 202.0705 - mean_squared_error: 202.0705 - val_loss: 149.9194 - val_mean_squared_error: 149.9194\n"", + ""Epoch 857/1000\n"", + ""2/2 - 0s - loss: 202.2131 - mean_squared_error: 202.2131 - val_loss: 148.0551 - val_mean_squared_error: 148.0551\n"", + ""Epoch 858/1000\n"", + ""2/2 - 0s - loss: 202.1250 - mean_squared_error: 202.1250 - val_loss: 147.8324 - val_mean_squared_error: 147.8324\n"", + ""Epoch 859/1000\n"", + ""2/2 - 0s - loss: 202.1170 - mean_squared_error: 202.1170 - val_loss: 148.4457 - val_mean_squared_error: 148.4457\n"", + ""Epoch 860/1000\n"", + ""2/2 - 0s - loss: 202.0889 - mean_squared_error: 202.0889 - val_loss: 149.3286 - val_mean_squared_error: 149.3286\n"", + ""Epoch 861/1000\n"", + ""2/2 - 0s - loss: 202.0615 - mean_squared_error: 202.0615 - val_loss: 150.6495 - val_mean_squared_error: 150.6495\n"", + ""Epoch 862/1000\n"", + ""2/2 - 0s - loss: 202.0762 - mean_squared_error: 202.0762 - val_loss: 151.6194 - val_mean_squared_error: 151.6194\n"", + ""Epoch 863/1000\n"", + ""2/2 - 0s - loss: 202.1425 - mean_squared_error: 202.1425 - val_loss: 152.4744 - val_mean_squared_error: 152.4744\n"", + ""Epoch 864/1000\n"", + ""2/2 - 0s - loss: 202.1951 - mean_squared_error: 202.1951 - val_loss: 154.3828 - val_mean_squared_error: 154.3828\n"", + ""Epoch 865/1000\n"", + ""2/2 - 0s - loss: 202.2580 - mean_squared_error: 202.2580 - val_loss: 154.6806 - val_mean_squared_error: 154.6806\n"", + ""Epoch 866/1000\n"", + ""2/2 - 0s - loss: 202.2634 - mean_squared_error: 202.2634 - val_loss: 153.4883 - val_mean_squared_error: 153.4883\n"", + ""Epoch 867/1000\n"", + ""2/2 - 0s - loss: 202.0541 - mean_squared_error: 202.0541 - val_loss: 150.6360 - val_mean_squared_error: 150.6360\n"", + ""Epoch 868/1000\n"", + ""2/2 - 0s - loss: 201.9798 - mean_squared_error: 201.9798 - val_loss: 147.9625 - val_mean_squared_error: 147.9625\n"", + ""Epoch 869/1000\n"", + ""2/2 - 0s - loss: 202.2918 - mean_squared_error: 202.2918 - val_loss: 145.5366 - val_mean_squared_error: 145.5366\n"", + ""Epoch 870/1000\n"", + ""2/2 - 0s - loss: 202.3077 - mean_squared_error: 202.3077 - val_loss: 145.6026 - val_mean_squared_error: 145.6026\n"", + ""Epoch 871/1000\n"", + ""2/2 - 0s - loss: 202.2413 - mean_squared_error: 202.2413 - val_loss: 145.7764 - val_mean_squared_error: 145.7764\n"", + ""Epoch 872/1000\n"", + ""2/2 - 0s - loss: 202.2899 - mean_squared_error: 202.2899 - val_loss: 146.4940 - val_mean_squared_error: 146.4940\n"", + ""Epoch 873/1000\n"", + ""2/2 - 0s - loss: 202.1148 - mean_squared_error: 202.1148 - val_loss: 148.8670 - val_mean_squared_error: 148.8670\n"", + ""Epoch 874/1000\n"", + ""2/2 - 0s - loss: 202.1911 - mean_squared_error: 202.1911 - val_loss: 152.0113 - val_mean_squared_error: 152.0113\n"", + ""Epoch 875/1000\n"", + ""2/2 - 0s - loss: 202.1927 - mean_squared_error: 202.1927 - val_loss: 153.8066 - val_mean_squared_error: 153.8066\n"", + ""Epoch 876/1000\n"", + ""2/2 - 0s - loss: 202.1796 - mean_squared_error: 202.1796 - val_loss: 153.6826 - val_mean_squared_error: 153.6826\n"", + ""Epoch 877/1000\n"", + ""2/2 - 0s - loss: 202.1784 - mean_squared_error: 202.1784 - val_loss: 153.3376 - val_mean_squared_error: 153.3376\n"", + ""Epoch 878/1000\n"", + ""2/2 - 0s - loss: 202.1228 - mean_squared_error: 202.1228 - val_loss: 151.7466 - val_mean_squared_error: 151.7466\n"", + ""Epoch 879/1000\n"", + ""2/2 - 0s - loss: 202.1612 - mean_squared_error: 202.1612 - val_loss: 149.8716 - val_mean_squared_error: 149.8716\n"", + ""Epoch 880/1000\n"", + ""2/2 - 0s - loss: 202.2072 - mean_squared_error: 202.2072 - val_loss: 148.7592 - val_mean_squared_error: 148.7592\n"", + ""Epoch 881/1000\n"", + ""2/2 - 0s - loss: 202.0937 - mean_squared_error: 202.0937 - val_loss: 149.0521 - val_mean_squared_error: 149.0521\n"", + ""Epoch 882/1000\n"", + ""2/2 - 0s - loss: 202.2645 - mean_squared_error: 202.2645 - val_loss: 150.1759 - val_mean_squared_error: 150.1759\n"", + ""Epoch 883/1000\n"", + ""2/2 - 0s - loss: 202.0611 - mean_squared_error: 202.0611 - val_loss: 149.8110 - val_mean_squared_error: 149.8110\n"", + ""Epoch 884/1000\n"", + ""2/2 - 0s - loss: 202.1646 - mean_squared_error: 202.1646 - val_loss: 149.9108 - val_mean_squared_error: 149.9108\n"", + ""Epoch 885/1000\n"", + ""2/2 - 0s - loss: 202.0503 - mean_squared_error: 202.0503 - val_loss: 148.9890 - val_mean_squared_error: 148.9890\n"", + ""Epoch 886/1000\n"", + ""2/2 - 0s - loss: 202.2109 - mean_squared_error: 202.2109 - val_loss: 147.9510 - val_mean_squared_error: 147.9510\n"", + ""Epoch 887/1000\n"", + ""2/2 - 0s - loss: 202.1109 - mean_squared_error: 202.1109 - val_loss: 148.5503 - val_mean_squared_error: 148.5503\n"", + ""Epoch 888/1000\n"", + ""2/2 - 0s - loss: 202.1481 - mean_squared_error: 202.1481 - val_loss: 149.6512 - val_mean_squared_error: 149.6512\n"", + ""Epoch 889/1000\n"", + ""2/2 - 0s - loss: 202.1045 - mean_squared_error: 202.1045 - val_loss: 150.2457 - val_mean_squared_error: 150.2457\n"", + ""Epoch 890/1000\n"", + ""2/2 - 0s - loss: 202.0985 - mean_squared_error: 202.0985 - val_loss: 150.0133 - val_mean_squared_error: 150.0133\n"", + ""Epoch 891/1000\n"", + ""2/2 - 0s - loss: 202.0735 - mean_squared_error: 202.0735 - val_loss: 150.4067 - val_mean_squared_error: 150.4067\n"", + ""Epoch 892/1000\n"", + ""2/2 - 0s - loss: 202.0887 - mean_squared_error: 202.0887 - val_loss: 150.6707 - val_mean_squared_error: 150.6707\n"", + ""Epoch 893/1000\n"", + ""2/2 - 0s - loss: 202.3347 - mean_squared_error: 202.3347 - val_loss: 152.0136 - val_mean_squared_error: 152.0136\n"", + ""Epoch 894/1000\n"", + ""2/2 - 0s - loss: 202.1179 - mean_squared_error: 202.1179 - val_loss: 151.0050 - val_mean_squared_error: 151.0050\n"", + ""Epoch 895/1000\n"", + ""2/2 - 0s - loss: 202.1239 - mean_squared_error: 202.1239 - val_loss: 150.2733 - val_mean_squared_error: 150.2733\n"", + ""Epoch 896/1000\n"", + ""2/2 - 0s - loss: 202.0905 - mean_squared_error: 202.0905 - val_loss: 150.2779 - val_mean_squared_error: 150.2779\n"", + ""Epoch 897/1000\n"", + ""2/2 - 0s - loss: 202.0707 - mean_squared_error: 202.0707 - val_loss: 150.5244 - val_mean_squared_error: 150.5244\n"", + ""Epoch 898/1000\n"", + ""2/2 - 0s - loss: 202.0723 - mean_squared_error: 202.0723 - val_loss: 150.9020 - val_mean_squared_error: 150.9020\n"", + ""Epoch 899/1000\n"", + ""2/2 - 0s - loss: 202.1646 - mean_squared_error: 202.1646 - val_loss: 151.7998 - val_mean_squared_error: 151.7998\n"", + ""Epoch 900/1000\n"", + ""2/2 - 0s - loss: 202.1366 - mean_squared_error: 202.1366 - val_loss: 151.0911 - val_mean_squared_error: 151.0911\n"", + ""Epoch 901/1000\n"", + ""2/2 - 0s - loss: 202.2249 - mean_squared_error: 202.2249 - val_loss: 150.6559 - val_mean_squared_error: 150.6559\n"", + ""Epoch 902/1000\n"", + ""2/2 - 0s - loss: 202.0575 - mean_squared_error: 202.0575 - val_loss: 151.4372 - val_mean_squared_error: 151.4372\n"", + ""Epoch 903/1000\n"", + ""2/2 - 0s - loss: 202.0949 - mean_squared_error: 202.0949 - val_loss: 152.4152 - val_mean_squared_error: 152.4152\n"", + ""Epoch 904/1000\n"", + ""2/2 - 0s - loss: 202.1516 - mean_squared_error: 202.1516 - val_loss: 152.7925 - val_mean_squared_error: 152.7925\n"", + ""Epoch 905/1000\n"", + ""2/2 - 0s - loss: 202.1233 - mean_squared_error: 202.1233 - val_loss: 151.7898 - val_mean_squared_error: 151.7898\n"", + ""Epoch 906/1000\n"", + ""2/2 - 0s - loss: 202.1051 - mean_squared_error: 202.1052 - val_loss: 150.7431 - val_mean_squared_error: 150.7431\n"", + ""Epoch 907/1000\n"", + ""2/2 - 0s - loss: 202.0680 - mean_squared_error: 202.0680 - val_loss: 150.1825 - val_mean_squared_error: 150.1825\n"", + ""Epoch 908/1000\n"", + ""2/2 - 0s - loss: 202.0683 - mean_squared_error: 202.0683 - val_loss: 149.6613 - val_mean_squared_error: 149.6613\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 909/1000\n"", + ""2/2 - 0s - loss: 202.2952 - mean_squared_error: 202.2952 - val_loss: 150.0308 - val_mean_squared_error: 150.0308\n"", + ""Epoch 910/1000\n"", + ""2/2 - 0s - loss: 202.0745 - mean_squared_error: 202.0745 - val_loss: 148.7169 - val_mean_squared_error: 148.7169\n"", + ""Epoch 911/1000\n"", + ""2/2 - 0s - loss: 202.6156 - mean_squared_error: 202.6156 - val_loss: 147.5413 - val_mean_squared_error: 147.5413\n"", + ""Epoch 912/1000\n"", + ""2/2 - 0s - loss: 202.2944 - mean_squared_error: 202.2944 - val_loss: 149.7357 - val_mean_squared_error: 149.7357\n"", + ""Epoch 913/1000\n"", + ""2/2 - 0s - loss: 202.1136 - mean_squared_error: 202.1136 - val_loss: 150.4112 - val_mean_squared_error: 150.4112\n"", + ""Epoch 914/1000\n"", + ""2/2 - 0s - loss: 202.1287 - mean_squared_error: 202.1287 - val_loss: 152.2666 - val_mean_squared_error: 152.2666\n"", + ""Epoch 915/1000\n"", + ""2/2 - 0s - loss: 202.0886 - mean_squared_error: 202.0886 - val_loss: 152.8852 - val_mean_squared_error: 152.8852\n"", + ""Epoch 916/1000\n"", + ""2/2 - 0s - loss: 202.1195 - mean_squared_error: 202.1195 - val_loss: 152.8876 - val_mean_squared_error: 152.8876\n"", + ""Epoch 917/1000\n"", + ""2/2 - 0s - loss: 202.1757 - mean_squared_error: 202.1757 - val_loss: 151.9896 - val_mean_squared_error: 151.9896\n"", + ""Epoch 918/1000\n"", + ""2/2 - 0s - loss: 202.2023 - mean_squared_error: 202.2023 - val_loss: 151.4222 - val_mean_squared_error: 151.4222\n"", + ""Epoch 919/1000\n"", + ""2/2 - 0s - loss: 202.1810 - mean_squared_error: 202.1810 - val_loss: 152.2262 - val_mean_squared_error: 152.2262\n"", + ""Epoch 920/1000\n"", + ""2/2 - 0s - loss: 202.0862 - mean_squared_error: 202.0862 - val_loss: 151.6622 - val_mean_squared_error: 151.6622\n"", + ""Epoch 921/1000\n"", + ""2/2 - 0s - loss: 202.1250 - mean_squared_error: 202.1250 - val_loss: 150.3737 - val_mean_squared_error: 150.3737\n"", + ""Epoch 922/1000\n"", + ""2/2 - 0s - loss: 202.1140 - mean_squared_error: 202.1140 - val_loss: 149.6699 - val_mean_squared_error: 149.6699\n"", + ""Epoch 923/1000\n"", + ""2/2 - 0s - loss: 202.1143 - mean_squared_error: 202.1143 - val_loss: 149.6570 - val_mean_squared_error: 149.6570\n"", + ""Epoch 924/1000\n"", + ""2/2 - 0s - loss: 202.1416 - mean_squared_error: 202.1416 - val_loss: 150.3045 - val_mean_squared_error: 150.3045\n"", + ""Epoch 925/1000\n"", + ""2/2 - 0s - loss: 202.3033 - mean_squared_error: 202.3033 - val_loss: 152.5033 - val_mean_squared_error: 152.5033\n"", + ""Epoch 926/1000\n"", + ""2/2 - 0s - loss: 202.1048 - mean_squared_error: 202.1048 - val_loss: 152.6580 - val_mean_squared_error: 152.6580\n"", + ""Epoch 927/1000\n"", + ""2/2 - 0s - loss: 202.1120 - mean_squared_error: 202.1120 - val_loss: 152.1200 - val_mean_squared_error: 152.1200\n"", + ""Epoch 928/1000\n"", + ""2/2 - 0s - loss: 202.0785 - mean_squared_error: 202.0785 - val_loss: 150.7728 - val_mean_squared_error: 150.7728\n"", + ""Epoch 929/1000\n"", + ""2/2 - 0s - loss: 202.1064 - mean_squared_error: 202.1064 - val_loss: 149.3751 - val_mean_squared_error: 149.3751\n"", + ""Epoch 930/1000\n"", + ""2/2 - 0s - loss: 202.0989 - mean_squared_error: 202.0989 - val_loss: 148.7702 - val_mean_squared_error: 148.7702\n"", + ""Epoch 931/1000\n"", + ""2/2 - 0s - loss: 202.0867 - mean_squared_error: 202.0867 - val_loss: 148.9628 - val_mean_squared_error: 148.9628\n"", + ""Epoch 932/1000\n"", + ""2/2 - 0s - loss: 202.1082 - mean_squared_error: 202.1082 - val_loss: 149.7798 - val_mean_squared_error: 149.7798\n"", + ""Epoch 933/1000\n"", + ""2/2 - 0s - loss: 202.2565 - mean_squared_error: 202.2565 - val_loss: 149.7248 - val_mean_squared_error: 149.7248\n"", + ""Epoch 934/1000\n"", + ""2/2 - 0s - loss: 202.0500 - mean_squared_error: 202.0500 - val_loss: 151.4591 - val_mean_squared_error: 151.4591\n"", + ""Epoch 935/1000\n"", + ""2/2 - 0s - loss: 202.0777 - mean_squared_error: 202.0777 - val_loss: 152.6874 - val_mean_squared_error: 152.6874\n"", + ""Epoch 936/1000\n"", + ""2/2 - 0s - loss: 202.0997 - mean_squared_error: 202.0997 - val_loss: 153.4424 - val_mean_squared_error: 153.4424\n"", + ""Epoch 937/1000\n"", + ""2/2 - 0s - loss: 202.1625 - mean_squared_error: 202.1625 - val_loss: 153.7264 - val_mean_squared_error: 153.7264\n"", + ""Epoch 938/1000\n"", + ""2/2 - 0s - loss: 202.2308 - mean_squared_error: 202.2308 - val_loss: 152.8151 - val_mean_squared_error: 152.8151\n"", + ""Epoch 939/1000\n"", + ""2/2 - 0s - loss: 202.1318 - mean_squared_error: 202.1318 - val_loss: 152.2510 - val_mean_squared_error: 152.2510\n"", + ""Epoch 940/1000\n"", + ""2/2 - 0s - loss: 202.5269 - mean_squared_error: 202.5269 - val_loss: 152.6138 - val_mean_squared_error: 152.6138\n"", + ""Epoch 941/1000\n"", + ""2/2 - 0s - loss: 202.0896 - mean_squared_error: 202.0896 - val_loss: 150.0086 - val_mean_squared_error: 150.0086\n"", + ""Epoch 942/1000\n"", + ""2/2 - 0s - loss: 202.2986 - mean_squared_error: 202.2986 - val_loss: 147.7899 - val_mean_squared_error: 147.7899\n"", + ""Epoch 943/1000\n"", + ""2/2 - 0s - loss: 202.1376 - mean_squared_error: 202.1376 - val_loss: 147.7065 - val_mean_squared_error: 147.7065\n"", + ""Epoch 944/1000\n"", + ""2/2 - 0s - loss: 202.1315 - mean_squared_error: 202.1315 - val_loss: 148.4766 - val_mean_squared_error: 148.4766\n"", + ""Epoch 945/1000\n"", + ""2/2 - 0s - loss: 202.1146 - mean_squared_error: 202.1146 - val_loss: 149.9803 - val_mean_squared_error: 149.9803\n"", + ""Epoch 946/1000\n"", + ""2/2 - 0s - loss: 202.1420 - mean_squared_error: 202.1420 - val_loss: 150.7507 - val_mean_squared_error: 150.7507\n"", + ""Epoch 947/1000\n"", + ""2/2 - 0s - loss: 202.0759 - mean_squared_error: 202.0759 - val_loss: 152.3508 - val_mean_squared_error: 152.3508\n"", + ""Epoch 948/1000\n"", + ""2/2 - 0s - loss: 202.2511 - mean_squared_error: 202.2511 - val_loss: 155.0338 - val_mean_squared_error: 155.0338\n"", + ""Epoch 949/1000\n"", + ""2/2 - 0s - loss: 202.3372 - mean_squared_error: 202.3372 - val_loss: 154.8418 - val_mean_squared_error: 154.8418\n"", + ""Epoch 950/1000\n"", + ""2/2 - 0s - loss: 202.2536 - mean_squared_error: 202.2536 - val_loss: 155.4863 - val_mean_squared_error: 155.4863\n"", + ""Epoch 951/1000\n"", + ""2/2 - 0s - loss: 202.5701 - mean_squared_error: 202.5701 - val_loss: 153.6416 - val_mean_squared_error: 153.6416\n"", + ""Epoch 952/1000\n"", + ""2/2 - 0s - loss: 202.1867 - mean_squared_error: 202.1867 - val_loss: 153.2806 - val_mean_squared_error: 153.2806\n"", + ""Epoch 953/1000\n"", + ""2/2 - 0s - loss: 202.2059 - mean_squared_error: 202.2059 - val_loss: 152.5402 - val_mean_squared_error: 152.5402\n"", + ""Epoch 954/1000\n"", + ""2/2 - 0s - loss: 202.1124 - mean_squared_error: 202.1124 - val_loss: 152.3713 - val_mean_squared_error: 152.3713\n"", + ""Epoch 955/1000\n"", + ""2/2 - 0s - loss: 202.3908 - mean_squared_error: 202.3908 - val_loss: 151.6905 - val_mean_squared_error: 151.6905\n"", + ""Epoch 956/1000\n"", + ""2/2 - 0s - loss: 202.1026 - mean_squared_error: 202.1026 - val_loss: 152.9768 - val_mean_squared_error: 152.9768\n"", + ""Epoch 957/1000\n"", + ""2/2 - 0s - loss: 202.1390 - mean_squared_error: 202.1390 - val_loss: 153.2544 - val_mean_squared_error: 153.2544\n"", + ""Epoch 958/1000\n"", + ""2/2 - 0s - loss: 202.1453 - mean_squared_error: 202.1453 - val_loss: 152.5370 - val_mean_squared_error: 152.5370\n"", + ""Epoch 959/1000\n"", + ""2/2 - 0s - loss: 202.1440 - mean_squared_error: 202.1440 - val_loss: 151.8163 - val_mean_squared_error: 151.8163\n"", + ""Epoch 960/1000\n"", + ""2/2 - 0s - loss: 202.0948 - mean_squared_error: 202.0948 - val_loss: 151.2200 - val_mean_squared_error: 151.2200\n"", + ""Epoch 961/1000\n"", + ""2/2 - 0s - loss: 202.0973 - mean_squared_error: 202.0973 - val_loss: 150.8285 - val_mean_squared_error: 150.8285\n"", + ""Epoch 962/1000\n"", + ""2/2 - 0s - loss: 202.0771 - mean_squared_error: 202.0771 - val_loss: 150.6295 - val_mean_squared_error: 150.6295\n"", + ""Epoch 963/1000\n"", + ""2/2 - 0s - loss: 202.0643 - mean_squared_error: 202.0643 - val_loss: 150.0955 - val_mean_squared_error: 150.0955\n"", + ""Epoch 964/1000\n"", + ""2/2 - 0s - loss: 202.0753 - mean_squared_error: 202.0753 - val_loss: 149.3367 - val_mean_squared_error: 149.3367\n"", + ""Epoch 965/1000\n"", + ""2/2 - 0s - loss: 202.0769 - mean_squared_error: 202.0769 - val_loss: 149.1399 - val_mean_squared_error: 149.1399\n"", + ""Epoch 966/1000\n"", + ""2/2 - 0s - loss: 202.1708 - mean_squared_error: 202.1708 - val_loss: 148.8613 - val_mean_squared_error: 148.8613\n"", + ""Epoch 967/1000\n"", + ""2/2 - 0s - loss: 202.3653 - mean_squared_error: 202.3653 - val_loss: 150.3053 - val_mean_squared_error: 150.3053\n"", + ""Epoch 968/1000\n"", + ""2/2 - 0s - loss: 202.0818 - mean_squared_error: 202.0818 - val_loss: 149.9712 - val_mean_squared_error: 149.9712\n"", + ""Epoch 969/1000\n"", + ""2/2 - 0s - loss: 202.0930 - mean_squared_error: 202.0930 - val_loss: 150.0007 - val_mean_squared_error: 150.0007\n"", + ""Epoch 970/1000\n"", + ""2/2 - 0s - loss: 202.1105 - mean_squared_error: 202.1105 - val_loss: 150.8983 - val_mean_squared_error: 150.8983\n"", + ""Epoch 971/1000\n"", + ""2/2 - 0s - loss: 202.1206 - mean_squared_error: 202.1206 - val_loss: 151.2609 - val_mean_squared_error: 151.2609\n"", + ""Epoch 972/1000\n"", + ""2/2 - 0s - loss: 202.0766 - mean_squared_error: 202.0766 - val_loss: 150.5339 - val_mean_squared_error: 150.5339\n"", + ""Epoch 973/1000\n"", + ""2/2 - 0s - loss: 202.1550 - mean_squared_error: 202.1550 - val_loss: 149.9355 - val_mean_squared_error: 149.9355\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 974/1000\n"", + ""2/2 - 0s - loss: 202.0683 - mean_squared_error: 202.0683 - val_loss: 150.5479 - val_mean_squared_error: 150.5479\n"", + ""Epoch 975/1000\n"", + ""2/2 - 0s - loss: 202.1981 - mean_squared_error: 202.1981 - val_loss: 150.6516 - val_mean_squared_error: 150.6516\n"", + ""Epoch 976/1000\n"", + ""2/2 - 0s - loss: 202.0862 - mean_squared_error: 202.0862 - val_loss: 152.2628 - val_mean_squared_error: 152.2628\n"", + ""Epoch 977/1000\n"", + ""2/2 - 0s - loss: 202.0856 - mean_squared_error: 202.0856 - val_loss: 152.7823 - val_mean_squared_error: 152.7823\n"", + ""Epoch 978/1000\n"", + ""2/2 - 0s - loss: 202.3291 - mean_squared_error: 202.3291 - val_loss: 152.4681 - val_mean_squared_error: 152.4681\n"", + ""Epoch 979/1000\n"", + ""2/2 - 0s - loss: 202.1132 - mean_squared_error: 202.1132 - val_loss: 153.7199 - val_mean_squared_error: 153.7199\n"", + ""Epoch 980/1000\n"", + ""2/2 - 0s - loss: 202.1528 - mean_squared_error: 202.1528 - val_loss: 153.6983 - val_mean_squared_error: 153.6983\n"", + ""Epoch 981/1000\n"", + ""2/2 - 0s - loss: 202.1336 - mean_squared_error: 202.1336 - val_loss: 153.0231 - val_mean_squared_error: 153.0231\n"", + ""Epoch 982/1000\n"", + ""2/2 - 0s - loss: 202.3273 - mean_squared_error: 202.3273 - val_loss: 151.2994 - val_mean_squared_error: 151.2994\n"", + ""Epoch 983/1000\n"", + ""2/2 - 0s - loss: 202.1629 - mean_squared_error: 202.1629 - val_loss: 150.8273 - val_mean_squared_error: 150.8273\n"", + ""Epoch 984/1000\n"", + ""2/2 - 0s - loss: 202.1718 - mean_squared_error: 202.1718 - val_loss: 151.0235 - val_mean_squared_error: 151.0235\n"", + ""Epoch 985/1000\n"", + ""2/2 - 0s - loss: 202.0522 - mean_squared_error: 202.0522 - val_loss: 152.4324 - val_mean_squared_error: 152.4324\n"", + ""Epoch 986/1000\n"", + ""2/2 - 0s - loss: 202.1300 - mean_squared_error: 202.1300 - val_loss: 152.9978 - val_mean_squared_error: 152.9978\n"", + ""Epoch 987/1000\n"", + ""2/2 - 0s - loss: 202.1046 - mean_squared_error: 202.1046 - val_loss: 153.8467 - val_mean_squared_error: 153.8467\n"", + ""Epoch 988/1000\n"", + ""2/2 - 0s - loss: 202.1955 - mean_squared_error: 202.1955 - val_loss: 154.4426 - val_mean_squared_error: 154.4426\n"", + ""Epoch 989/1000\n"", + ""2/2 - 0s - loss: 202.1842 - mean_squared_error: 202.1842 - val_loss: 153.5453 - val_mean_squared_error: 153.5453\n"", + ""Epoch 990/1000\n"", + ""2/2 - 0s - loss: 202.2054 - mean_squared_error: 202.2054 - val_loss: 151.1686 - val_mean_squared_error: 151.1686\n"", + ""Epoch 991/1000\n"", + ""2/2 - 0s - loss: 202.0472 - mean_squared_error: 202.0472 - val_loss: 149.9209 - val_mean_squared_error: 149.9209\n"", + ""Epoch 992/1000\n"", + ""2/2 - 0s - loss: 202.3248 - mean_squared_error: 202.3248 - val_loss: 148.1980 - val_mean_squared_error: 148.1980\n"", + ""Epoch 993/1000\n"", + ""2/2 - 0s - loss: 202.1170 - mean_squared_error: 202.1170 - val_loss: 148.8009 - val_mean_squared_error: 148.8009\n"", + ""Epoch 994/1000\n"", + ""2/2 - 0s - loss: 202.2451 - mean_squared_error: 202.2451 - val_loss: 149.8096 - val_mean_squared_error: 149.8096\n"", + ""Epoch 995/1000\n"", + ""2/2 - 0s - loss: 202.1378 - mean_squared_error: 202.1378 - val_loss: 149.3607 - val_mean_squared_error: 149.3607\n"", + ""Epoch 996/1000\n"", + ""2/2 - 0s - loss: 202.2595 - mean_squared_error: 202.2595 - val_loss: 150.5473 - val_mean_squared_error: 150.5473\n"", + ""Epoch 997/1000\n"", + ""2/2 - 0s - loss: 202.1257 - mean_squared_error: 202.1257 - val_loss: 150.4344 - val_mean_squared_error: 150.4344\n"", + ""Epoch 998/1000\n"", + ""2/2 - 0s - loss: 202.1685 - mean_squared_error: 202.1685 - val_loss: 149.1119 - val_mean_squared_error: 149.1119\n"", + ""Epoch 999/1000\n"", + ""2/2 - 0s - loss: 202.1149 - mean_squared_error: 202.1149 - val_loss: 149.4107 - val_mean_squared_error: 149.4107\n"", + ""Epoch 1000/1000\n"", + ""2/2 - 0s - loss: 202.1206 - mean_squared_error: 202.1206 - val_loss: 149.0977 - val_mean_squared_error: 149.0977\n"" + ] + } + ], + ""source"": [ + ""model = keras.models.Sequential()\n"", + ""model.add(Dense(units = 24, input_dim = x_train.shape[1],activation='relu'))\n"", + ""model.add(Dense(units = 64, activation='relu'))\n"", + ""model.add(Dense(units = 1))\n"", + ""model.compile(optimizer=keras.optimizers.Adam(learning_rate=0.001),\n"", + "" loss=\""mean_squared_error\"",\n"", + "" metrics=[\""mean_squared_error\""])\n"", + ""Model = model.fit(x_train, y_train, epochs = 1000, batch_size = 128,\n"", + "" validation_data = (x_test, y_test), verbose=2)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 99, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""with open('FFNN_Loss.pickle', 'wb') as handle:\n"", + "" pickle.dump(Model.history, handle, protocol=pickle.HIGHEST_PROTOCOL)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": null, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""Model.history = pickle.load(open(\""FFNN_Loss.pickle\"",\""rb\""))"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 98, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""image/png"": ""iVBORw0KGgoAAAANSUhEUgAAAawAAAEQCAYAAADswECiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAA14ElEQVR4nO3de3xU1b338c9vkhCFQBCRm4BcBCwcERHUFDkN4oVqUc+pt9JTvLQi9kFFqoiKgtWKHlG860E9pfTy1KK2tV5OC6nBW/QRESiiCCIg9CD3QMItyaznj7WHTMZAJslccvm+X695zey91uxZswj5Ze/9W2uZcw4REZGGLpTuBoiIiMRDAUtERBoFBSwREWkUFLBERKRRUMASEZFGITPdDWiI2rdv74455hhatWqV7qY0CKWlpeqLgPrCUz9UUl9U+uijj7Y6545J1vEVsKrRo0cPZs6cSX5+frqb0iAUFhaqLwLqC0/9UEl9UcnM1iXz+LokKCIijYICloiINAoKWCIi0igoYImISKOggCUiIo2CApaIiDQKSmuvRmlFBb8FsouLycvNTXdzRBq17du387//+7/s27cv3U1JitatW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Iq/NFlmZr/Hr3+1t4Zji6Sc7mGJpN4RZtYyZl8HKgPQdqAj39QJ2Ba8LgaOiS40s3ZmdnY1x66Wc267c26ic64LcDJ+Ber/wN/zEmlwFLBE0uN7kRdBskUe8Gaw6x3gQjNrEVXnW8CJ+HFe4BcW/a6ZRf8fvgy/Wm70PaxqmVl7M1tvZv8O4JxbElwOXAd0r/O3EkkiXRIUSay2Znb6IcqKo14/aWat8ZcC78KfVT0TlP0CH5DeMLNZQC5wL/4e1K+COvfh70G9aGazgW7B+55wzu0OLj0eknNuq5mtAh4NMg+/As4HjgP+GP/XFUkdBSyRxBoGFB2irACfSg4+G+9u/KXAAuBi51wxgHPuIzM7E5gBzANKgdeByc653UGd983sHHzg+hP+/tZj+KAVrx8ADwL/ib8nthL4oXNuQS2OIZIy5pxLdxtEmg0zuxL4JXCMc25rmpsj0qjoHpaIiDQKClgiItIo6JKgiIg0CjrDEhGRRkEBS0REGgUFLBERaRQUsEREpFFQwBIRkUbh/wMnDcohTwawpwAAAABJRU5ErkJggg==\n"", + ""text/plain"": [ + ""
"" + ] + }, + ""metadata"": { + ""needs_background"": ""light"" + }, + ""output_type"": ""display_data"" + } + ], + ""source"": [ + ""loss = Model.history['loss']\n"", + ""val_loss = Model.history['val_loss']\n"", + ""epochs = len(loss)\n"", + ""plt.xlim((-5, 1000))\n"", + ""plt.plot(range(epochs), loss, color = 'k', marker = '.', label = 'loss')\n"", + ""plt.plot(range(epochs), val_loss, color = 'c', marker = '.', label = 'val_loss')\n"", + ""plt.xticks(fontname=\""Arial\"", fontsize=16, fontweight='normal')\n"", + ""plt.yticks(fontname=\""Arial\"", fontsize=16, fontweight='normal')\n"", + ""plt.legend(loc = 'best', framealpha=1, prop={'size': 16, 'family':\""Arial\""})\n"", + ""\n"", + ""plt.grid()\n"", + ""plt.xlabel('Epochs',fontname=\""Arial\"", fontsize=16)\n"", + ""plt.ylabel('Loss',fontname=\""Arial\"", fontsize=16)\n"", + ""plt.savefig(\""FFNN_Loss.png\"", dpi=600, bbox_inches='tight')\n"", + ""plt.show()"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 57, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""filepath = 'MRI_DNN.model'\n"", + ""save_model(model, filepath, save_format='h5')"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 58, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""model = load_model('MRI_DNN.model')"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 37, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Train set R^2: 0.61\n"", + ""Train MAE score: 10.97\n"", + ""Train RMSE score: 14.22\n"", + ""Test set R^2: 0.71\n"", + ""Test MAE score: 10.45\n"", + ""Test RMSE score: 12.21\n"" + ] + } + ], + ""source"": [ + ""y_pred_train = model.predict((x_train))\n"", + ""print(\""Train set R^2: %.2f\"" % r2_score(y_train, y_pred_train))\n"", + ""print(\""Train MAE score: %.2f\"" % mean_absolute_error(y_train, y_pred_train))\n"", + ""print(\""Train RMSE score: %.2f\"" % np.sqrt(mean_squared_error(y_train, y_pred_train)))\n"", + ""\n"", + ""y_pred_test = model.predict((x_test))\n"", + ""print(\""Test set R^2: %.2f\"" % r2_score(y_test, y_pred_test))\n"", + ""print(\""Test MAE score: %.2f\"" % mean_absolute_error(y_test, y_pred_test))\n"", + ""print(\""Test RMSE score: %.2f\"" % np.sqrt(mean_squared_error(y_test, y_pred_test)))"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 172, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""image/png"": ""iVBORw0KGgoAAAANSUhEUgAAANwAAADdCAYAAADQBhwkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+W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p+i9ecmIjPo4nfTV2o4v0z/UkplAi8DI/Cv53P3efnNZ+jyuSXQxefyFcH5VfqXtJxb1AD8Dj96Ptx/Xj7/Gbr53LLo4nP5hOC6mP7lC9woIlvsE2//4w/PJyJpwBgRmeDueXz1GV2fi7afW11Xn0undmk0XsQnajiNxl/QgtNovIgWnEbjRbTgNBovogWn0XgRLbh+iBh82tvl6I/oYYE+iojMAj4GlgBNwDhgi1Jq7Vm6vlkpZT0b17Jfb6RS6tjZup6/ogXXhxGRI0CSUqrO/n6UUupo75aqLSIyDbhYKfXH3i5LX8dXkpf7PSJyGdAkIplAOvAb4JfAucA1QBHwLeBGjOz1ezG6DJfYXy8H8uzHPgzcD9wOPAfsBRKBAGAjsAB4Tyn1iohcAkTZz3sGmG4/thqYYb/+ZUC6iKQrpbrl19hf0H24vs8iEfk+sFAptRH4OfA48LRSaj+wFQhTSj0E/AVYClwNxAFHgSNALIbYvgamAP8BwpVSZ+zH5Cil7gGSgfeAW4DbRMQEPACcxpjRkIYhzjql1MNAAYbgvwC+1mLrHF3D9X1WKKXqRMSRFPsihqhK7O8VzRnqX2CIJQU4pJT6CPjILhwrcMrRb3PJw20CKu2vq5VSlfb9gRgTYwfZr4P9OucD5fbja4DAs/u4/o2u4XwEpdRReyDlNuDbGE1EB2b77yHADuAgcL+IhIhIEsY0ku5QCkwSkWkiYgEub694GMFP/X3qBP0H6qO4TG5cLCL3isjvgQsx+lNbgBgRcSx6MklEvo0hiCeA1RiiO4DRHzuB0Ry8xD4kkA7Ei8hwIBWYJiKjgBEiMkNEZmI0SSOBxcA6YC2wDaPflioiI4FzMPqTecClwNwe/aP4ATpK6eOIyGjg10qpO3u3JBpP0DWc7zMTOEdEInu7IJrO0TWcRuNFdA2n0XgRLTiNxotowWk0XkQLTqPxIlpwGo0X+f8DA5u11B2yTwAAAABJRU5ErkJggg==\n"", + ""text/plain"": [ + ""
"" + ] + }, + ""metadata"": { + ""needs_background"": ""light"" + }, + ""output_type"": ""display_data"" + } + ], + ""source"": [ + ""plt.figure(figsize=(3,3))\n"", + ""\n"", + ""ax=plt.subplot(1, 1, 1)\n"", + ""plt.scatter(y_train, y_pred_train, c='#1f77b4', marker='o', s = 18, edgecolors='k', linewidths = 0.2)\n"", + ""plt.scatter(y_test, y_pred_test, c='#ff7f0e', marker='o', s = 18, edgecolors='k', linewidths = 0.2) \n"", + ""\n"", + ""plt.xlabel(\""Experiment\"",fontname=\""Times New Roman\"", fontsize=10)\n"", + ""plt.ylabel(\""Prediction\"",fontname=\""Times New Roman\"", fontsize=10)\n"", + ""x0, x1 = min(y_train), max(y_train)\n"", + ""length = 750\n"", + ""x_start, x_end = -200, 550\n"", + ""plt.xlim([-0, 150])\n"", + ""plt.ylim([-0, 150])\n"", + ""# ax.set_xticks([-200,-100,0,100,200,300,400,500])\n"", + ""# ax.set_yticks([-200,-100,0,100,200,300,400,500])\n"", + ""plt.xticks(fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""plt.yticks(fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""plt.gca().set_aspect(\""equal\"", adjustable=\""box\"")\n"", + ""# the unit line\n"", + ""plt.plot(np.arange(x_start, x_end, 0.01*length),\n"", + ""np.arange(x_start, x_end, 0.01*length), '#d62728')\n"", + ""plt.text(80, 25, \""Train $R^2={:.2f}$\"".format(round(r2_score(y_train, y_pred_train),2)),{'color':'#1f77b4'}, fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""plt.text(80, 12, \""Test $R^2 ={:.2f}$\"".format(r2_score(y_test, y_pred_test)),{'color':'#ff7f0e'}, fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""#plt.text(80, 500, \""Dataset_1\"")\n"", + ""plt.title('MRI_DNN',fontname=\""Times New Roman\"", fontsize=10)\n"", + ""plt.savefig(\""Polyinfo_MRI_DNN.png\"", dpi=1200, bbox_inches='tight') "" + ] + }, + { + ""cell_type"": ""markdown"", + ""metadata"": {}, + ""source"": [ + ""### RNN"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 38, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""import numpy as np\n"", + ""import pandas as pd\n"", + ""from tensorflow.keras.preprocessing.text import one_hot\n"", + ""from tensorflow.keras.preprocessing.sequence import pad_sequences\n"", + ""from tensorflow.keras.models import Sequential, load_model\n"", + ""from tensorflow.keras.layers import Dense, Flatten, LSTM, Embedding, Bidirectional, TimeDistributed, Reshape\n"", + ""from sklearn.model_selection import train_test_split\n"", + ""from tensorflow.keras.callbacks import EarlyStopping, ModelCheckpoint\n"", + ""from tensorflow.keras.models import Sequential, load_model\n"", + ""from sklearn.metrics import mean_absolute_error, r2_score"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 39, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""Mix_X_100Block = []\n"", + ""for i in range(len(DF_MRI[Flag])):\n"", + "" random.seed(10)\n"", + ""\n"", + "" Random_position = []\n"", + "" Random_position_all = []\n"", + ""\n"", + "" Rest = range(0, 100)\n"", + "" for col in ['TFEA', 'HexaFOEA', 'NonaFOEA', 'PEGA', 'HEA', 'MSEA']:\n"", + ""\n"", + "" X_random_position = random.sample(Rest, int(DF_MRI[Flag][col].iloc[i] * 100))\n"", + "" Random_position.append(X_random_position)\n"", + "" for p in X_random_position:\n"", + "" Random_position_all.append(p)\n"", + "" Rest = []\n"", + "" for x in range(0, 100):\n"", + "" if x not in Random_position_all:\n"", + "" Rest.append(x)\n"", + "" \n"", + "" Sequency_X = [0 for a in range(100)]\n"", + "" for j in range(100):\n"", + "" if j in Random_position[0]:\n"", + "" Sequency_X[j] = list(X.iloc[0].values)\n"", + "" elif j in Random_position[1]:\n"", + "" Sequency_X[j] = list(X.iloc[1].values)\n"", + "" elif j in Random_position[2]:\n"", + "" Sequency_X[j] = list(X.iloc[2].values)\n"", + "" elif j in Random_position[3]:\n"", + "" Sequency_X[j] = list(X.iloc[3].values)\n"", + "" elif j in Random_position[4]:\n"", + "" Sequency_X[j] = list(X.iloc[4].values)\n"", + "" elif j in Random_position[5]:\n"", + "" Sequency_X[j] = list(X.iloc[5].values)\n"", + "" \n"", + "" Mix_X_100Block.append(Sequency_X) \n"", + ""\n"", + ""Mix_X_100Block = np.array(Mix_X_100Block)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 40, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""(271, 100, 80)"" + ] + }, + ""execution_count"": 40, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""Mix_X_100Block.shape"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 41, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""text/plain"": [ + ""array([[[1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 0, 0, 0],\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" ...,\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 0, 1, 0]],\n"", + ""\n"", + "" [[1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 0, 0, 0],\n"", + "" [1, 1, 0, ..., 0, 0, 0],\n"", + "" ...,\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 1, 0, ..., 0, 0, 0],\n"", + "" [1, 0, 0, ..., 0, 1, 0]],\n"", + ""\n"", + "" [[1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 0, 0, 0],\n"", + "" [1, 0, 0, ..., 0, 0, 0],\n"", + "" ...,\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 0, 0, 0],\n"", + "" [1, 0, 0, ..., 0, 1, 0]],\n"", + ""\n"", + "" ...,\n"", + ""\n"", + "" [[1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" ...,\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0]],\n"", + ""\n"", + "" [[1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" ...,\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0]],\n"", + ""\n"", + "" [[1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" ...,\n"", + "" [1, 0, 0, ..., 0, 1, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0],\n"", + "" [1, 0, 0, ..., 1, 0, 0]]], dtype=int64)"" + ] + }, + ""execution_count"": 41, + ""metadata"": {}, + ""output_type"": ""execute_result"" + } + ], + ""source"": [ + ""Mix_X_100Block"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 42, + ""metadata"": { + ""scrolled"": true + }, + ""outputs"": [], + ""source"": [ + ""X_train, X_test, y_train, y_test = train_test_split(Mix_X_100Block, DF_MRI[Flag]['19F NMR Signal-to-Noise Ratioa'].astype(np.float64), test_size=0.2, random_state=11)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 43, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 1/200\n"", + ""3/3 [==============================] - 1s 325ms/step - loss: 5292.2534 - mean_squared_error: 5292.2534 - val_loss: 4428.9160 - val_mean_squared_error: 4428.9160\n"", + ""Epoch 2/200\n"", + ""3/3 [==============================] - 0s 52ms/step - loss: 5169.4219 - mean_squared_error: 5169.4219 - val_loss: 4270.5708 - val_mean_squared_error: 4270.5708\n"", + ""Epoch 3/200\n"", + ""3/3 [==============================] - 0s 41ms/step - loss: 4963.3701 - mean_squared_error: 4963.3701 - val_loss: 4040.1243 - val_mean_squared_error: 4040.1243\n"", + ""Epoch 4/200\n"", + ""3/3 [==============================] - 0s 25ms/step - loss: 4677.9995 - mean_squared_error: 4677.9995 - val_loss: 3733.4944 - val_mean_squared_error: 3733.4944\n"", + ""Epoch 5/200\n"", + ""3/3 [==============================] - 0s 26ms/step - loss: 4310.8618 - mean_squared_error: 4310.8618 - val_loss: 3347.9509 - val_mean_squared_error: 3347.9509\n"", + ""Epoch 6/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 3849.7336 - mean_squared_error: 3849.7336 - val_loss: 2886.7219 - val_mean_squared_error: 2886.7219\n"", + ""Epoch 7/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 3294.3965 - mean_squared_error: 3294.3965 - val_loss: 2377.3196 - val_mean_squared_error: 2377.3196\n"", + ""Epoch 8/200\n"", + ""3/3 [==============================] - 0s 21ms/step - loss: 2692.7092 - mean_squared_error: 2692.7092 - val_loss: 1854.8285 - val_mean_squared_error: 1854.8285\n"", + ""Epoch 9/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 2069.0264 - mean_squared_error: 2069.0264 - val_loss: 1358.6130 - val_mean_squared_error: 1358.6130\n"", + ""Epoch 10/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 1474.4712 - mean_squared_error: 1474.4713 - val_loss: 949.7415 - val_mean_squared_error: 949.7415\n"", + ""Epoch 11/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 970.8594 - mean_squared_error: 970.8594 - val_loss: 695.6250 - val_mean_squared_error: 695.6250\n"", + ""Epoch 12/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 616.7227 - mean_squared_error: 616.7227 - val_loss: 644.4954 - val_mean_squared_error: 644.4954\n"", + ""Epoch 13/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 479.1428 - mean_squared_error: 479.1428 - val_loss: 774.8701 - val_mean_squared_error: 774.8701\n"", + ""Epoch 14/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 522.5495 - mean_squared_error: 522.5494 - val_loss: 950.4861 - val_mean_squared_error: 950.4861\n"", + ""Epoch 15/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 594.2542 - mean_squared_error: 594.2542 - val_loss: 1003.2814 - val_mean_squared_error: 1003.2814\n"", + ""Epoch 16/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 606.6002 - mean_squared_error: 606.6002 - val_loss: 932.5268 - val_mean_squared_error: 932.5268\n"", + ""Epoch 17/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 553.4301 - mean_squared_error: 553.4301 - val_loss: 816.3203 - val_mean_squared_error: 816.3203\n"", + ""Epoch 18/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 491.7591 - mean_squared_error: 491.7591 - val_loss: 715.0369 - val_mean_squared_error: 715.0369\n"", + ""Epoch 19/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 459.3970 - mean_squared_error: 459.3970 - val_loss: 649.1143 - val_mean_squared_error: 649.1143\n"", + ""Epoch 20/200\n"", + ""3/3 [==============================] - 0s 21ms/step - loss: 455.8539 - mean_squared_error: 455.8539 - val_loss: 619.8483 - val_mean_squared_error: 619.8483\n"", + ""Epoch 21/200\n"", + ""3/3 [==============================] - 0s 12ms/step - loss: 458.2211 - mean_squared_error: 458.2211 - val_loss: 608.1423 - val_mean_squared_error: 608.1423\n"", + ""Epoch 22/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 460.6635 - mean_squared_error: 460.6635 - val_loss: 603.5832 - val_mean_squared_error: 603.5832\n"", + ""Epoch 23/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 455.8251 - mean_squared_error: 455.8251 - val_loss: 604.0233 - val_mean_squared_error: 604.0233\n"", + ""Epoch 24/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 446.4751 - mean_squared_error: 446.4751 - val_loss: 606.9394 - val_mean_squared_error: 606.9394\n"", + ""Epoch 25/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 437.7151 - mean_squared_error: 437.7151 - val_loss: 612.9732 - val_mean_squared_error: 612.9732\n"", + ""Epoch 26/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 425.8165 - mean_squared_error: 425.8165 - val_loss: 616.1547 - val_mean_squared_error: 616.1547\n"", + ""Epoch 27/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 419.6398 - mean_squared_error: 419.6398 - val_loss: 619.2947 - val_mean_squared_error: 619.2947\n"", + ""Epoch 28/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 412.3443 - mean_squared_error: 412.3443 - val_loss: 607.7792 - val_mean_squared_error: 607.7792\n"", + ""Epoch 29/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 399.5639 - mean_squared_error: 399.5639 - val_loss: 591.9512 - val_mean_squared_error: 591.9512\n"", + ""Epoch 30/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 384.2326 - mean_squared_error: 384.2326 - val_loss: 543.1306 - val_mean_squared_error: 543.1306\n"", + ""Epoch 31/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 353.7835 - mean_squared_error: 353.7835 - val_loss: 429.1675 - val_mean_squared_error: 429.1675\n"", + ""Epoch 32/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 297.4705 - mean_squared_error: 297.4705 - val_loss: 315.2560 - val_mean_squared_error: 315.2560\n"", + ""Epoch 33/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 251.6163 - mean_squared_error: 251.6163 - val_loss: 258.8668 - val_mean_squared_error: 258.8668\n"", + ""Epoch 34/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 226.5304 - mean_squared_error: 226.5304 - val_loss: 252.5555 - val_mean_squared_error: 252.5555\n"", + ""Epoch 35/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 202.5158 - mean_squared_error: 202.5158 - val_loss: 270.3385 - val_mean_squared_error: 270.3385\n"", + ""Epoch 36/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 198.0151 - mean_squared_error: 198.0151 - val_loss: 288.7827 - val_mean_squared_error: 288.7827\n"", + ""Epoch 37/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 199.1603 - mean_squared_error: 199.1603 - val_loss: 306.6201 - val_mean_squared_error: 306.6201\n"", + ""Epoch 38/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 248.1135 - mean_squared_error: 248.1135 - val_loss: 275.6587 - val_mean_squared_error: 275.6587\n"", + ""Epoch 39/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 210.1352 - mean_squared_error: 210.1352 - val_loss: 294.2291 - val_mean_squared_error: 294.2291\n"", + ""Epoch 40/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 201.3035 - mean_squared_error: 201.3035 - val_loss: 255.0319 - val_mean_squared_error: 255.0319\n"", + ""Epoch 41/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 214.7671 - mean_squared_error: 214.7671 - val_loss: 223.3315 - val_mean_squared_error: 223.3315\n"", + ""Epoch 42/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 203.8353 - mean_squared_error: 203.8353 - val_loss: 267.2489 - val_mean_squared_error: 267.2489\n"", + ""Epoch 43/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 223.9583 - mean_squared_error: 223.9583 - val_loss: 267.1710 - val_mean_squared_error: 267.1710\n"", + ""Epoch 44/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 200.5796 - mean_squared_error: 200.5796 - val_loss: 231.2951 - val_mean_squared_error: 231.2951\n"", + ""Epoch 45/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 204.6773 - mean_squared_error: 204.6773 - val_loss: 223.8425 - val_mean_squared_error: 223.8425\n"", + ""Epoch 46/200\n"", + ""3/3 [==============================] - 0s 15ms/step - loss: 186.9375 - mean_squared_error: 186.9375 - val_loss: 219.3504 - val_mean_squared_error: 219.3504\n"", + ""Epoch 47/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 164.5552 - mean_squared_error: 164.5552 - val_loss: 221.2252 - val_mean_squared_error: 221.2252\n"", + ""Epoch 48/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 163.1847 - mean_squared_error: 163.1847 - val_loss: 214.4131 - val_mean_squared_error: 214.4131\n"", + ""Epoch 49/200\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""3/3 [==============================] - 0s 20ms/step - loss: 164.1827 - mean_squared_error: 164.1827 - val_loss: 205.2421 - val_mean_squared_error: 205.2421\n"", + ""Epoch 50/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 159.6210 - mean_squared_error: 159.6210 - val_loss: 201.8635 - val_mean_squared_error: 201.8635\n"", + ""Epoch 51/200\n"", + ""3/3 [==============================] - 0s 15ms/step - loss: 154.6096 - mean_squared_error: 154.6096 - val_loss: 197.8737 - val_mean_squared_error: 197.8737\n"", + ""Epoch 52/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 152.8173 - mean_squared_error: 152.8173 - val_loss: 188.6192 - val_mean_squared_error: 188.6192\n"", + ""Epoch 53/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 148.9049 - mean_squared_error: 148.9049 - val_loss: 190.4959 - val_mean_squared_error: 190.4959\n"", + ""Epoch 54/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 149.1548 - mean_squared_error: 149.1548 - val_loss: 183.8020 - val_mean_squared_error: 183.8020\n"", + ""Epoch 55/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 144.1670 - mean_squared_error: 144.1670 - val_loss: 176.0918 - val_mean_squared_error: 176.0918\n"", + ""Epoch 56/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 143.7411 - mean_squared_error: 143.7411 - val_loss: 170.8627 - val_mean_squared_error: 170.8627\n"", + ""Epoch 57/200\n"", + ""3/3 [==============================] - 0s 20ms/step - loss: 142.1602 - mean_squared_error: 142.1602 - val_loss: 180.2658 - val_mean_squared_error: 180.2658\n"", + ""Epoch 58/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 140.3897 - mean_squared_error: 140.3897 - val_loss: 183.3027 - val_mean_squared_error: 183.3027\n"", + ""Epoch 59/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 139.9853 - mean_squared_error: 139.9853 - val_loss: 184.7516 - val_mean_squared_error: 184.7516\n"", + ""Epoch 60/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 135.9913 - mean_squared_error: 135.9913 - val_loss: 175.4196 - val_mean_squared_error: 175.4196\n"", + ""Epoch 61/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 135.7410 - mean_squared_error: 135.7410 - val_loss: 176.0601 - val_mean_squared_error: 176.0601\n"", + ""Epoch 62/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 131.4212 - mean_squared_error: 131.4212 - val_loss: 177.4084 - val_mean_squared_error: 177.4084\n"", + ""Epoch 63/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 131.9543 - mean_squared_error: 131.9543 - val_loss: 166.3630 - val_mean_squared_error: 166.3630\n"", + ""Epoch 64/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 133.0402 - mean_squared_error: 133.0402 - val_loss: 164.0062 - val_mean_squared_error: 164.0062\n"", + ""Epoch 65/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 127.5535 - mean_squared_error: 127.5535 - val_loss: 178.6271 - val_mean_squared_error: 178.6271\n"", + ""Epoch 66/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 129.4104 - mean_squared_error: 129.4104 - val_loss: 159.4737 - val_mean_squared_error: 159.4737\n"", + ""Epoch 67/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 119.9245 - mean_squared_error: 119.9245 - val_loss: 149.1369 - val_mean_squared_error: 149.1369\n"", + ""Epoch 68/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 119.6001 - mean_squared_error: 119.6001 - val_loss: 160.3897 - val_mean_squared_error: 160.3897\n"", + ""Epoch 69/200\n"", + ""3/3 [==============================] - 0s 21ms/step - loss: 114.6735 - mean_squared_error: 114.6735 - val_loss: 154.0136 - val_mean_squared_error: 154.0136\n"", + ""Epoch 70/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 128.9023 - mean_squared_error: 128.9023 - val_loss: 166.1960 - val_mean_squared_error: 166.1960\n"", + ""Epoch 71/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 119.1944 - mean_squared_error: 119.1944 - val_loss: 160.9241 - val_mean_squared_error: 160.9241\n"", + ""Epoch 72/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 153.9393 - mean_squared_error: 153.9393 - val_loss: 171.2649 - val_mean_squared_error: 171.2649\n"", + ""Epoch 73/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 151.1022 - mean_squared_error: 151.1022 - val_loss: 234.0074 - val_mean_squared_error: 234.0074\n"", + ""Epoch 74/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 159.5630 - mean_squared_error: 159.5630 - val_loss: 142.5150 - val_mean_squared_error: 142.5150\n"", + ""Epoch 75/200\n"", + ""3/3 [==============================] - 0s 21ms/step - loss: 153.2925 - mean_squared_error: 153.2925 - val_loss: 158.0011 - val_mean_squared_error: 158.0011\n"", + ""Epoch 76/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 129.3179 - mean_squared_error: 129.3179 - val_loss: 172.7763 - val_mean_squared_error: 172.7763\n"", + ""Epoch 77/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 123.7127 - mean_squared_error: 123.7127 - val_loss: 177.0170 - val_mean_squared_error: 177.0170\n"", + ""Epoch 78/200\n"", + ""3/3 [==============================] - 0s 15ms/step - loss: 113.8753 - mean_squared_error: 113.8753 - val_loss: 137.8203 - val_mean_squared_error: 137.8203\n"", + ""Epoch 79/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 113.1126 - mean_squared_error: 113.1126 - val_loss: 137.1212 - val_mean_squared_error: 137.1212\n"", + ""Epoch 80/200\n"", + ""3/3 [==============================] - 0s 15ms/step - loss: 109.7133 - mean_squared_error: 109.7133 - val_loss: 138.8926 - val_mean_squared_error: 138.8926\n"", + ""Epoch 81/200\n"", + ""3/3 [==============================] - 0s 20ms/step - loss: 103.8538 - mean_squared_error: 103.8538 - val_loss: 141.3247 - val_mean_squared_error: 141.3247\n"", + ""Epoch 82/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 108.1330 - mean_squared_error: 108.1330 - val_loss: 125.9492 - val_mean_squared_error: 125.9492\n"", + ""Epoch 83/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 102.7652 - mean_squared_error: 102.7652 - val_loss: 123.2502 - val_mean_squared_error: 123.2502\n"", + ""Epoch 84/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 100.8757 - mean_squared_error: 100.8757 - val_loss: 129.5798 - val_mean_squared_error: 129.5798\n"", + ""Epoch 85/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 100.6285 - mean_squared_error: 100.6285 - val_loss: 134.1860 - val_mean_squared_error: 134.1860\n"", + ""Epoch 86/200\n"", + ""3/3 [==============================] - 0s 20ms/step - loss: 97.9138 - mean_squared_error: 97.9138 - val_loss: 124.1682 - val_mean_squared_error: 124.1682\n"", + ""Epoch 87/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 97.7032 - mean_squared_error: 97.7032 - val_loss: 125.4956 - val_mean_squared_error: 125.4956\n"", + ""Epoch 88/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 99.1726 - mean_squared_error: 99.1726 - val_loss: 123.9602 - val_mean_squared_error: 123.9602\n"", + ""Epoch 89/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 92.9157 - mean_squared_error: 92.9157 - val_loss: 121.9563 - val_mean_squared_error: 121.9563\n"", + ""Epoch 90/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 94.0227 - mean_squared_error: 94.0227 - val_loss: 121.8181 - val_mean_squared_error: 121.8181\n"", + ""Epoch 91/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 94.4267 - mean_squared_error: 94.4267 - val_loss: 131.9070 - val_mean_squared_error: 131.9070\n"", + ""Epoch 92/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 90.8464 - mean_squared_error: 90.8464 - val_loss: 120.4050 - val_mean_squared_error: 120.4050\n"", + ""Epoch 93/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 93.6931 - mean_squared_error: 93.6931 - val_loss: 129.3291 - val_mean_squared_error: 129.3291\n"", + ""Epoch 94/200\n"", + ""3/3 [==============================] - 0s 20ms/step - loss: 87.6027 - mean_squared_error: 87.6027 - val_loss: 132.6413 - val_mean_squared_error: 132.6413\n"", + ""Epoch 95/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 92.7208 - mean_squared_error: 92.7208 - val_loss: 121.4251 - val_mean_squared_error: 121.4251\n"", + ""Epoch 96/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 87.5511 - mean_squared_error: 87.5511 - val_loss: 129.7542 - val_mean_squared_error: 129.7542\n"", + ""Epoch 97/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 89.4516 - mean_squared_error: 89.4516 - val_loss: 140.0879 - val_mean_squared_error: 140.0879\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 98/200\n"", + ""3/3 [==============================] - 0s 15ms/step - loss: 89.0527 - mean_squared_error: 89.0527 - val_loss: 127.6220 - val_mean_squared_error: 127.6220\n"", + ""Epoch 99/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 84.3656 - mean_squared_error: 84.3656 - val_loss: 116.4766 - val_mean_squared_error: 116.4766\n"", + ""Epoch 100/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 84.7084 - mean_squared_error: 84.7084 - val_loss: 117.8109 - val_mean_squared_error: 117.8109\n"", + ""Epoch 101/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 84.0683 - mean_squared_error: 84.0683 - val_loss: 125.7928 - val_mean_squared_error: 125.7928\n"", + ""Epoch 102/200\n"", + ""3/3 [==============================] - 0s 15ms/step - loss: 80.8284 - mean_squared_error: 80.8284 - val_loss: 124.3554 - val_mean_squared_error: 124.3554\n"", + ""Epoch 103/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 80.6688 - mean_squared_error: 80.6688 - val_loss: 117.9143 - val_mean_squared_error: 117.9143\n"", + ""Epoch 104/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 76.3362 - mean_squared_error: 76.3362 - val_loss: 122.2538 - val_mean_squared_error: 122.2538\n"", + ""Epoch 105/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 76.2774 - mean_squared_error: 76.2774 - val_loss: 119.7460 - val_mean_squared_error: 119.7460\n"", + ""Epoch 106/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 74.9966 - mean_squared_error: 74.9966 - val_loss: 125.3093 - val_mean_squared_error: 125.3093\n"", + ""Epoch 107/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 71.5206 - mean_squared_error: 71.5206 - val_loss: 133.6271 - val_mean_squared_error: 133.6271\n"", + ""Epoch 108/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 74.3252 - mean_squared_error: 74.3252 - val_loss: 123.9954 - val_mean_squared_error: 123.9954\n"", + ""Epoch 109/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 69.8579 - mean_squared_error: 69.8579 - val_loss: 127.1781 - val_mean_squared_error: 127.1781\n"", + ""Epoch 110/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 70.3760 - mean_squared_error: 70.3760 - val_loss: 129.3574 - val_mean_squared_error: 129.3574\n"", + ""Epoch 111/200\n"", + ""3/3 [==============================] - 0s 20ms/step - loss: 69.6929 - mean_squared_error: 69.6929 - val_loss: 133.4352 - val_mean_squared_error: 133.4352\n"", + ""Epoch 112/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 69.2023 - mean_squared_error: 69.2023 - val_loss: 127.5925 - val_mean_squared_error: 127.5925\n"", + ""Epoch 113/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 69.5499 - mean_squared_error: 69.5499 - val_loss: 132.0117 - val_mean_squared_error: 132.0117\n"", + ""Epoch 114/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 68.9289 - mean_squared_error: 68.9289 - val_loss: 126.0043 - val_mean_squared_error: 126.0043\n"", + ""Epoch 115/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 67.1165 - mean_squared_error: 67.1165 - val_loss: 121.8649 - val_mean_squared_error: 121.8649\n"", + ""Epoch 116/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 63.9339 - mean_squared_error: 63.9339 - val_loss: 124.3282 - val_mean_squared_error: 124.3282\n"", + ""Epoch 117/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 66.2781 - mean_squared_error: 66.2781 - val_loss: 120.3727 - val_mean_squared_error: 120.3727\n"", + ""Epoch 118/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 62.4286 - mean_squared_error: 62.4286 - val_loss: 113.1323 - val_mean_squared_error: 113.1323\n"", + ""Epoch 119/200\n"", + ""3/3 [==============================] - 0s 20ms/step - loss: 67.3425 - mean_squared_error: 67.3425 - val_loss: 122.2237 - val_mean_squared_error: 122.2237\n"", + ""Epoch 120/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 64.7138 - mean_squared_error: 64.7138 - val_loss: 120.7563 - val_mean_squared_error: 120.7563\n"", + ""Epoch 121/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 61.2591 - mean_squared_error: 61.2591 - val_loss: 131.3134 - val_mean_squared_error: 131.3134\n"", + ""Epoch 122/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 61.8326 - mean_squared_error: 61.8326 - val_loss: 131.0534 - val_mean_squared_error: 131.0534\n"", + ""Epoch 123/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 60.6894 - mean_squared_error: 60.6894 - val_loss: 125.2481 - val_mean_squared_error: 125.2481\n"", + ""Epoch 124/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 60.9203 - mean_squared_error: 60.9203 - val_loss: 126.1920 - val_mean_squared_error: 126.1920\n"", + ""Epoch 125/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 61.3223 - mean_squared_error: 61.3223 - val_loss: 129.1044 - val_mean_squared_error: 129.1044\n"", + ""Epoch 126/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 63.4382 - mean_squared_error: 63.4382 - val_loss: 133.1488 - val_mean_squared_error: 133.1488\n"", + ""Epoch 127/200\n"", + ""3/3 [==============================] - 0s 20ms/step - loss: 61.9645 - mean_squared_error: 61.9645 - val_loss: 128.6644 - val_mean_squared_error: 128.6644\n"", + ""Epoch 128/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 64.2340 - mean_squared_error: 64.2340 - val_loss: 146.6524 - val_mean_squared_error: 146.6524\n"", + ""Epoch 129/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 67.7319 - mean_squared_error: 67.7319 - val_loss: 157.4927 - val_mean_squared_error: 157.4927\n"", + ""Epoch 130/200\n"", + ""3/3 [==============================] - 0s 15ms/step - loss: 69.0128 - mean_squared_error: 69.0128 - val_loss: 153.1252 - val_mean_squared_error: 153.1252\n"", + ""Epoch 131/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 67.3891 - mean_squared_error: 67.3891 - val_loss: 171.7604 - val_mean_squared_error: 171.7604\n"", + ""Epoch 132/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 96.9615 - mean_squared_error: 96.9615 - val_loss: 140.9745 - val_mean_squared_error: 140.9745\n"", + ""Epoch 133/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 88.8555 - mean_squared_error: 88.8555 - val_loss: 148.4450 - val_mean_squared_error: 148.4450\n"", + ""Epoch 134/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 91.9708 - mean_squared_error: 91.9708 - val_loss: 132.9515 - val_mean_squared_error: 132.9515\n"", + ""Epoch 135/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 74.5090 - mean_squared_error: 74.5090 - val_loss: 133.5198 - val_mean_squared_error: 133.5198\n"", + ""Epoch 136/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 77.9424 - mean_squared_error: 77.9424 - val_loss: 149.0306 - val_mean_squared_error: 149.0306\n"", + ""Epoch 137/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 78.0877 - mean_squared_error: 78.0877 - val_loss: 154.4192 - val_mean_squared_error: 154.4192\n"", + ""Epoch 138/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 70.3967 - mean_squared_error: 70.3967 - val_loss: 142.5080 - val_mean_squared_error: 142.5080\n"", + ""Epoch 139/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 68.3486 - mean_squared_error: 68.3486 - val_loss: 121.3998 - val_mean_squared_error: 121.3998\n"", + ""Epoch 140/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 66.4093 - mean_squared_error: 66.4093 - val_loss: 122.4538 - val_mean_squared_error: 122.4538\n"", + ""Epoch 141/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 61.6633 - mean_squared_error: 61.6633 - val_loss: 122.3670 - val_mean_squared_error: 122.3670\n"", + ""Epoch 142/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 60.9142 - mean_squared_error: 60.9142 - val_loss: 133.7547 - val_mean_squared_error: 133.7547\n"", + ""Epoch 143/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 63.0550 - mean_squared_error: 63.0550 - val_loss: 125.2558 - val_mean_squared_error: 125.2558\n"", + ""Epoch 144/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 61.4855 - mean_squared_error: 61.4855 - val_loss: 120.1454 - val_mean_squared_error: 120.1454\n"", + ""Epoch 145/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 60.8007 - mean_squared_error: 60.8007 - val_loss: 120.9197 - val_mean_squared_error: 120.9197\n"", + ""Epoch 146/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 58.8305 - mean_squared_error: 58.8305 - val_loss: 134.5355 - val_mean_squared_error: 134.5355\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 147/200\n"", + ""3/3 [==============================] - 0s 20ms/step - loss: 58.8186 - mean_squared_error: 58.8186 - val_loss: 139.2164 - val_mean_squared_error: 139.2164\n"", + ""Epoch 148/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 57.4221 - mean_squared_error: 57.4221 - val_loss: 127.9926 - val_mean_squared_error: 127.9926\n"", + ""Epoch 149/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 56.2993 - mean_squared_error: 56.2993 - val_loss: 116.1909 - val_mean_squared_error: 116.1909\n"", + ""Epoch 150/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 56.7313 - mean_squared_error: 56.7313 - val_loss: 123.8532 - val_mean_squared_error: 123.8532\n"", + ""Epoch 151/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 56.9173 - mean_squared_error: 56.9173 - val_loss: 130.7818 - val_mean_squared_error: 130.7818\n"", + ""Epoch 152/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 54.1650 - mean_squared_error: 54.1650 - val_loss: 128.4590 - val_mean_squared_error: 128.4590\n"", + ""Epoch 153/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 53.5782 - mean_squared_error: 53.5782 - val_loss: 119.3797 - val_mean_squared_error: 119.3797\n"", + ""Epoch 154/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 50.9589 - mean_squared_error: 50.9589 - val_loss: 117.3025 - val_mean_squared_error: 117.3025\n"", + ""Epoch 155/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 52.4855 - mean_squared_error: 52.4855 - val_loss: 105.9599 - val_mean_squared_error: 105.9599\n"", + ""Epoch 156/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 51.1774 - mean_squared_error: 51.1774 - val_loss: 111.8978 - val_mean_squared_error: 111.8978\n"", + ""Epoch 157/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 51.5550 - mean_squared_error: 51.5550 - val_loss: 123.5184 - val_mean_squared_error: 123.5184\n"", + ""Epoch 158/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 50.3553 - mean_squared_error: 50.3553 - val_loss: 123.4784 - val_mean_squared_error: 123.4784\n"", + ""Epoch 159/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 49.6292 - mean_squared_error: 49.6292 - val_loss: 109.2616 - val_mean_squared_error: 109.2616\n"", + ""Epoch 160/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 48.7433 - mean_squared_error: 48.7433 - val_loss: 113.4619 - val_mean_squared_error: 113.4619\n"", + ""Epoch 161/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 47.9070 - mean_squared_error: 47.9070 - val_loss: 115.2061 - val_mean_squared_error: 115.2061\n"", + ""Epoch 162/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 46.1695 - mean_squared_error: 46.1695 - val_loss: 114.5350 - val_mean_squared_error: 114.5350\n"", + ""Epoch 163/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 47.5787 - mean_squared_error: 47.5787 - val_loss: 113.4944 - val_mean_squared_error: 113.4944\n"", + ""Epoch 164/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 46.8631 - mean_squared_error: 46.8631 - val_loss: 126.4153 - val_mean_squared_error: 126.4153\n"", + ""Epoch 165/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 51.6888 - mean_squared_error: 51.6888 - val_loss: 123.7646 - val_mean_squared_error: 123.7646\n"", + ""Epoch 166/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 52.1459 - mean_squared_error: 52.1459 - val_loss: 119.9783 - val_mean_squared_error: 119.9783\n"", + ""Epoch 167/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 47.0226 - mean_squared_error: 47.0226 - val_loss: 117.1882 - val_mean_squared_error: 117.1882\n"", + ""Epoch 168/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 54.5446 - mean_squared_error: 54.5446 - val_loss: 135.9426 - val_mean_squared_error: 135.9426\n"", + ""Epoch 169/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 49.9896 - mean_squared_error: 49.9896 - val_loss: 177.5692 - val_mean_squared_error: 177.5692\n"", + ""Epoch 170/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 52.7576 - mean_squared_error: 52.7576 - val_loss: 140.7135 - val_mean_squared_error: 140.7135\n"", + ""Epoch 171/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 46.7927 - mean_squared_error: 46.7927 - val_loss: 127.9537 - val_mean_squared_error: 127.9537\n"", + ""Epoch 172/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 49.3395 - mean_squared_error: 49.3395 - val_loss: 133.7478 - val_mean_squared_error: 133.7478\n"", + ""Epoch 173/200\n"", + ""3/3 [==============================] - 0s 13ms/step - loss: 48.0498 - mean_squared_error: 48.0498 - val_loss: 145.7094 - val_mean_squared_error: 145.7094\n"", + ""Epoch 174/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 44.6731 - mean_squared_error: 44.6731 - val_loss: 139.1499 - val_mean_squared_error: 139.1499\n"", + ""Epoch 175/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 50.6497 - mean_squared_error: 50.6497 - val_loss: 146.2914 - val_mean_squared_error: 146.2914\n"", + ""Epoch 176/200\n"", + ""3/3 [==============================] - 0s 20ms/step - loss: 45.5288 - mean_squared_error: 45.5288 - val_loss: 160.4052 - val_mean_squared_error: 160.4052\n"", + ""Epoch 177/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 48.1088 - mean_squared_error: 48.1088 - val_loss: 138.1937 - val_mean_squared_error: 138.1937\n"", + ""Epoch 178/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 44.3731 - mean_squared_error: 44.3731 - val_loss: 126.1304 - val_mean_squared_error: 126.1304\n"", + ""Epoch 179/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 42.2320 - mean_squared_error: 42.2320 - val_loss: 122.8807 - val_mean_squared_error: 122.8807\n"", + ""Epoch 180/200\n"", + ""3/3 [==============================] - 0s 20ms/step - loss: 44.0719 - mean_squared_error: 44.0719 - val_loss: 119.8603 - val_mean_squared_error: 119.8603\n"", + ""Epoch 181/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 42.3993 - mean_squared_error: 42.3993 - val_loss: 115.0438 - val_mean_squared_error: 115.0438\n"", + ""Epoch 182/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 43.3328 - mean_squared_error: 43.3328 - val_loss: 124.1629 - val_mean_squared_error: 124.1629\n"", + ""Epoch 183/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 48.7788 - mean_squared_error: 48.7788 - val_loss: 133.1111 - val_mean_squared_error: 133.1111\n"", + ""Epoch 184/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 43.8874 - mean_squared_error: 43.8874 - val_loss: 146.7636 - val_mean_squared_error: 146.7636\n"", + ""Epoch 185/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 49.5150 - mean_squared_error: 49.5150 - val_loss: 133.1856 - val_mean_squared_error: 133.1856\n"", + ""Epoch 186/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 49.5938 - mean_squared_error: 49.5938 - val_loss: 144.0966 - val_mean_squared_error: 144.0966\n"", + ""Epoch 187/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 48.3295 - mean_squared_error: 48.3295 - val_loss: 113.6166 - val_mean_squared_error: 113.6166\n"", + ""Epoch 188/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 47.6316 - mean_squared_error: 47.6316 - val_loss: 114.8835 - val_mean_squared_error: 114.8835\n"", + ""Epoch 189/200\n"", + ""3/3 [==============================] - 0s 15ms/step - loss: 42.9408 - mean_squared_error: 42.9408 - val_loss: 137.9304 - val_mean_squared_error: 137.9304\n"", + ""Epoch 190/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 44.7411 - mean_squared_error: 44.7411 - val_loss: 120.2181 - val_mean_squared_error: 120.2181\n"", + ""Epoch 191/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 42.1178 - mean_squared_error: 42.1178 - val_loss: 114.7291 - val_mean_squared_error: 114.7291\n"", + ""Epoch 192/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 41.3737 - mean_squared_error: 41.3737 - val_loss: 120.6257 - val_mean_squared_error: 120.6257\n"", + ""Epoch 193/200\n"", + ""3/3 [==============================] - 0s 20ms/step - loss: 40.1379 - mean_squared_error: 40.1379 - val_loss: 118.6643 - val_mean_squared_error: 118.6643\n"", + ""Epoch 194/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 39.6074 - mean_squared_error: 39.6074 - val_loss: 116.6139 - val_mean_squared_error: 116.6139\n"", + ""Epoch 195/200\n"", + ""3/3 [==============================] - 0s 19ms/step - loss: 41.2508 - mean_squared_error: 41.2508 - val_loss: 139.8459 - val_mean_squared_error: 139.8459\n"" + ] + }, + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Epoch 196/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 50.3461 - mean_squared_error: 50.3461 - val_loss: 131.3614 - val_mean_squared_error: 131.3614\n"", + ""Epoch 197/200\n"", + ""3/3 [==============================] - 0s 18ms/step - loss: 43.3484 - mean_squared_error: 43.3484 - val_loss: 128.0845 - val_mean_squared_error: 128.0845\n"", + ""Epoch 198/200\n"", + ""3/3 [==============================] - 0s 14ms/step - loss: 46.3449 - mean_squared_error: 46.3449 - val_loss: 115.5101 - val_mean_squared_error: 115.5101\n"", + ""Epoch 199/200\n"", + ""3/3 [==============================] - 0s 16ms/step - loss: 47.6466 - mean_squared_error: 47.6466 - val_loss: 106.7015 - val_mean_squared_error: 106.7015\n"", + ""Epoch 200/200\n"", + ""3/3 [==============================] - 0s 17ms/step - loss: 40.2571 - mean_squared_error: 40.2571 - val_loss: 114.6486 - val_mean_squared_error: 114.6486\n"" + ] + } + ], + ""source"": [ + ""def getRNNmodel(LSTMunits):\n"", + ""\n"", + "" RNNmodel = Sequential()\n"", + "" RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True), input_shape=(100, 80)))\n"", + "" RNNmodel.add(Bidirectional(LSTM(LSTMunits, return_sequences=True)))\n"", + "" RNNmodel.add(TimeDistributed(Dense(int(LSTMunits/2), activation=\""relu\"")))\n"", + "" RNNmodel.add(Reshape((int(LSTMunits/2*100),)))\n"", + "" RNNmodel.add(Dense(1))\n"", + ""\n"", + "" return RNNmodel\n"", + ""\n"", + ""LSTMunits = 20\n"", + ""RNNmodel = getRNNmodel(LSTMunits)\n"", + ""RNNmodel.compile(loss='mse', optimizer='adam', metrics=['mean_squared_error'])\n"", + ""Model = RNNmodel.fit(X_train, y_train, validation_split=0.2, epochs=200, \\\n"", + "" batch_size=64)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 109, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""with open('RNN_Loss.pickle', 'wb') as handle:\n"", + "" pickle.dump(Model.history, handle, protocol=pickle.HIGHEST_PROTOCOL)"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": null, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""Model.history = pickle.load(open(\""RNN_Loss.pickle\"",\""rb\""))"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 108, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""image/png"": ""iVBORw0KGgoAAAANSUhEUgAAAagAAAEQCAYAAADlK+DYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAABEK0lEQVR4nO3deXxU1fn48c8zk0wIkIWEJKwqKGihCgj4Na3+DGJFoS5fv1qXtlprS9UfdaFWrVLFutBFRGutFqRFq/5qUWutaAvGxLpEv6AsFQUjCAgkrEkgLNnm+f1x74TJMEkmyWzA83695jWZe87ceeZmMk/OueeeI6qKMcYYk2w8iQ7AGGOMCccSlDHGmKRkCcoYY0xSsgRljDEmKVmCMsYYk5RSEh1AMurdu7cec8wxrZbv2bOHHj16xC+gTrAYuy7Z4wOLMVosxuj48MMPt6tqXtR2qKp2C7mNHj1a21JSUtJmeTKwGLsu2eNTtRijxWKMDmCJRvG72Lr4jDHGJCVLUMYYY5KSJShjjDFJyRKUMcaYpGQJyhhjTFKyBGWMMSYp2XVQHVRWVsazzz5LWloahYWFiQ7HmKSXkpLCypUr2b9/f6JDaVVGRgYffvhhosNoU6JiTElJISsriz59+tCtW7f4vnZcX+0Q9/bbbzN+/HgaGxt59tlnKS4utiRlTBv27t1Ljx49OOqoo+jZsycikuiQTAeoKvX19ezcuZPVq1dz/PHHxzVJWRdfB7z99ts0NDQ0/9JKS0sTHZIxSW3Tpk3079+fjIwMS06HIBEhLS2Nvn37kp+fT2VlZVxf3xJUB4wbN47U1FTAafYWFRUlNiBjkty+ffvIzs5OdBgmCnJycqipqYnra1qC6oDCwkL+8Y9/ICIcd9xxiQ7HmKTX0NDQ/E+dObT5fD4aGxvj+pqWoDooMzMTEWHlypWMHz+esrKyR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ev39/1q1bl5igjDmEdLTlEqyspobxy5dT7/fj83h4dtiwFv8oxpLX6+Vb3/oW8+fP59577wWcBHXxxRfTs2dPFi5cCMC6dev47LPP+Pjjj/nkk0/o1q1bVF5/1apVbNu2jUsuuaTF9ssuu4xrr72Wf//731x//fUMHTqUH/7wh7zxxhtMnDiRCRMm8MADDwCQkZHRZnmysXNQHeTzeBgC/GXLFt4N6lu2FpQxsVeYlUXxiBHcO2gQxSNGxC05BVxxxRWsXr2a//znP3z++ecsXbqUK664AoBXXnmFY489lkGDBvHtb3+bRYsW0b1794NW4e2sqqoqwDnnHSwrK4u0tDR27dqFx+PhjTfe4NJLL+Xll1/m4osvJj8/n6lTp+L3+9stTzaWoDqorKaGj4Fav7/FSL7Gxka2b98etea8MSa8wqwsfnb00XFPTgCnnnoqgwYN4sUXX2T+/PkMHDiQ0047jfLyci655BLGjx/Pl19+ybZt23j99dfDDqrorJycHAC2bNnSYnt1dTV1dXXk5uYCMHDgQObOncu2bdt49913ueyyy5g1axbz58+PqDyZWILqoNLq6uY+8AZVSqurKSsr46mnngLgnHPOsTWhjDmMXX755SxYsICXXnqJSy+9FBHho48+or6+nttvv50BAwYAsGfPHt55552otaCOP/54evfufVAief755wH4+te/zooVK+jbty8fffQRHo+Hr33ta8yZM4eUlBQ2bNjQbnmysXNQHVSUnU0qUIeT3Yuysyl97rnmefgaGhooLS21iWONOUxdccUVzJgxA3BG1QGMGjUKr9fLbbfdxnXXXcf27dt58MEHqaysJC0tLSqv6/V6ufvuu/nxj39MTk4OF1xwAStWrODuu+/mkksu4atf/SqNjY1kZmZy5ZVXMn36dHJycnjqqafweDxMmjSJoUOHtlmebKwF1UGFWVnMBI5OS2N4jx4UZmVRVFREamoq4HyIbE0oYw5fw4cP58QTT2To0KGMGjUKgKFDh/L000+zYsUKJk6cyK233srYsWP5/e9/z4YNG6J2fnrKlCnMnTuXkpISzjvvPH73u9/xk5/8hGeffRZwLnl57bXXGDJkCNdddx2TJk1i1apVvPrqqwwb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fO8kasDyQn1zr3PhtnqZi3gV+IyEnAAuA1Vf0pxiQJS1DGRFeNqi5prdBNHPtVtTqkaBtwvPtzL5zlE0JtwVldFZzlIra2E8vekMd+9z7QtX8pcBfwLZyuxgYR+QvwI1Xd186+jYk5OwdlTPx1E5HuIdvyOZBwdgIFHKwPsMP9uQbICy4UkRwR+UaYfYelqjtV9SZV7QeMwlk19Ts456yMSThLUMYkxjcDP7iDIwqBEnfTO8AFIuILqvMV4ESc66zAWTDzXBEJ/hu+FHgVZ8XYNolIbxHZICIXAajqMrd7bz1wVKfflTFRZF18xkRXtoic2kpZTdDPj4lIBk7X3l04raYn3LL7cRLQ6yIyC8gC7sM5h/SUW+cBnHNIL4jIbJyVVe8Hfqequ92uxFap6nYRKQcecUcGfglMAo7GWf7cmISzBGVMdH0dKGulrBhnaDc4o+XuwenaKwYuVtUaAFX9UETOBGYA83GW8n4NuFVVd7t13heRs3ES1cs456d+i5OkInU58Bvg1zjntFYD31bVNzqwD2NixpZ8NyaOROR7wJ+APFXdnuBwjElqdg7KGGNMUrIEZYwxJilZF58xxpikZC0oY4wxSckSlDHGmKRkCcoYY0xSsgRljDEmKVmCMsYYk5T+PzWYBggz0HZiAAAAAElFTkSuQmCC\n"", + ""text/plain"": [ + ""
"" + ] + }, + ""metadata"": { + ""needs_background"": ""light"" + }, + ""output_type"": ""display_data"" + } + ], + ""source"": [ + ""loss = Model.history['loss']\n"", + ""val_loss = Model.history['val_loss']\n"", + ""epochs = len(loss)\n"", + ""plt.xlim((-5, 200))\n"", + ""plt.plot(range(epochs), loss, color = 'k', marker = '.', label = 'loss')\n"", + ""plt.plot(range(epochs), val_loss, color = 'c', marker = '.', label = 'val_loss')\n"", + ""plt.xticks(fontname=\""Arial\"", fontsize=16, fontweight='normal')\n"", + ""plt.yticks(fontname=\""Arial\"", fontsize=16, fontweight='normal')\n"", + ""plt.legend(loc = 'best', framealpha=1, prop={'size': 16, 'family':\""Arial\""})\n"", + ""\n"", + ""plt.grid()\n"", + ""plt.xlabel('Epochs',fontname=\""Arial\"", fontsize=16)\n"", + ""plt.ylabel('Loss',fontname=\""Arial\"", fontsize=16)\n"", + ""plt.savefig(\""RNN_Loss.png\"", dpi=600, bbox_inches='tight')\n"", + ""plt.show()"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 209, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""filepath = 'MRI_RNN.model'\n"", + ""save_model(RNNmodel, filepath, save_format='h5')"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 32, + ""metadata"": {}, + ""outputs"": [], + ""source"": [ + ""RNNmodel = load_model('MRI_RNN.model')"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 44, + ""metadata"": {}, + ""outputs"": [ + { + ""name"": ""stdout"", + ""output_type"": ""stream"", + ""text"": [ + ""Train set R^2: 0.89\n"", + ""Train MAE score: 5.37\n"", + ""Train RMSE score: 7.53\n"", + ""Test set R^2: 0.78\n"", + ""Test MAE score: 8.31\n"", + ""Test RMSE score: 10.52\n"" + ] + } + ], + ""source"": [ + ""y_pred_train = RNNmodel.predict((X_train))\n"", + ""print(\""Train set R^2: %.2f\"" % r2_score(y_train, y_pred_train))\n"", + ""print(\""Train MAE score: %.2f\"" % mean_absolute_error(y_train, y_pred_train))\n"", + ""print(\""Train RMSE score: %.2f\"" % np.sqrt(mean_squared_error(y_train, y_pred_train)))\n"", + ""\n"", + ""y_pred_test = RNNmodel.predict((X_test))\n"", + ""print(\""Test set R^2: %.2f\"" % r2_score(y_test, y_pred_test))\n"", + ""print(\""Test MAE score: %.2f\"" % mean_absolute_error(y_test, y_pred_test))\n"", + ""print(\""Test RMSE score: %.2f\"" % np.sqrt(mean_squared_error(y_test, y_pred_test)))"" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": 142, + ""metadata"": {}, + ""outputs"": [ + { + ""data"": { + ""image/png"": ""iVBORw0KGgoAAAANSUhEUgAAANwAAADdCAYAAADQBhwkAAAAOXRFWHRTb2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AaDAfay4AbMLzXFwHeGN7rvwBeBjJt1z4GLAZuA14BDgBxgCewEbgOWK+Uek1EZgGRtnL/C0yxXVsJzMQIM/oxkCgiiUoph/I19hX0O1zvZ6GI3AssVEptBH4LPAu8oJRKB5KBAKXUA8ALwBJgNjAEOAEcByIwxLYXmIjheBuslKqwXZOmlLoLiAdWATdjuJ+ZgIeAYoyIhnHAfqBGKfWYre4Lgc3AXi22ztE9XO9nuVKqRkQaHZpfxxBVY/pwxVkP9c3ATRgO0CeUUp8Dn9uEYwGKGt/bmvnhNgBltu1KpVSZ7bwXEAIMsNWDrZ5LgFLb9VWA13l9WjdH93AuglLqhIhMw4gwvhljiNiI2fZ7ALALOAIsFhFfERkNRDt420KM+K/JIuIBXNle8zAmP/X3qRP0H6iXIiIXYwQ33i8ivxCRPwM/AkKBrcBgEfmj7fLxInIzhiCWAmswRHcYuB44jTEcvMJmEkgEhohIOJAATLalBogSkYtFZCrGe1sIcD/wCbAW2A5cDCSIyFBgBMb7ZCbwU2BWN/5J3AI9S+niiMhw4I9Kqdt7uCkaO9A9nOszFRghIiE93RBN5+geTqNxIrqH02iciBacRuNEtOA0GieiBafROBEtOI3Gifw/Ao6j8ji/2UwAAAAASUVORK5CYII=\n"", + ""text/plain"": [ + ""
"" + ] + }, + ""metadata"": { + ""needs_background"": ""light"" + }, + ""output_type"": ""display_data"" + } + ], + ""source"": [ + ""plt.figure(figsize=(3,3))\n"", + ""\n"", + ""ax=plt.subplot(1, 1, 1)\n"", + ""plt.scatter(y_train, y_pred_train, c='#1f77b4', marker='o', s = 18, edgecolors='k', linewidths = 0.2)\n"", + ""plt.scatter(y_test, y_pred_test, c='#ff7f0e', marker='o', s = 18, edgecolors='k', linewidths = 0.2) \n"", + ""\n"", + ""plt.xlabel(\""Experiment\"",fontname=\""Times New Roman\"", fontsize=10)\n"", + ""plt.ylabel(\""Prediction\"",fontname=\""Times New Roman\"", fontsize=10)\n"", + ""x0, x1 = min(y_train), max(y_train)\n"", + ""length = 750\n"", + ""x_start, x_end = -200, 550\n"", + ""plt.xlim([-0, 150])\n"", + ""plt.ylim([-0, 150])\n"", + ""# ax.set_xticks([-200,-100,0,100,200,300,400,500])\n"", + ""# ax.set_yticks([-200,-100,0,100,200,300,400,500])\n"", + ""plt.xticks(fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""plt.yticks(fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""plt.gca().set_aspect(\""equal\"", adjustable=\""box\"")\n"", + ""# the unit line\n"", + ""plt.plot(np.arange(x_start, x_end, 0.01*length),\n"", + ""np.arange(x_start, x_end, 0.01*length), '#d62728')\n"", + ""plt.text(80, 25, \""Train $R^2={:.2f}$\"".format(round(r2_score(y_train, y_pred_train),2)),{'color':'#1f77b4'}, fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""plt.text(80, 12, \""Test $R^2 ={:.2f}$\"".format(r2_score(y_test, y_pred_test)),{'color':'#ff7f0e'}, fontname=\""Times New Roman\"", fontsize=10, fontweight='normal')\n"", + ""#plt.text(80, 500, \""Dataset_1\"")\n"", + ""plt.title('MRI_RNN',fontname=\""Times New Roman\"", fontsize=10)\n"", + ""plt.savefig(\""Polyinfo_MRI_RNN.png\"", dpi=1200, bbox_inches='tight') "" + ] + }, + { + ""cell_type"": ""code"", + ""execution_count"": null, + ""metadata"": {}, + ""outputs"": [], + ""source"": [] + } + ], + ""metadata"": { + ""kernelspec"": { + ""display_name"": ""python 3.7.13 tensorflow2"", + ""language"": ""python"", + ""name"": ""tensorflow"" + }, + ""language_info"": { + ""codemirror_mode"": { + ""name"": ""ipython"", + ""version"": 3 + }, + ""file_extension"": "".py"", + ""mimetype"": ""text/x-python"", + ""name"": ""python"", + ""nbconvert_exporter"": ""python"", + ""pygments_lexer"": ""ipython3"", + ""version"": ""3.7.13"" + } + }, + ""nbformat"": 4, + ""nbformat_minor"": 2 +} +","Unknown" +"RNN","chrisrothUT/Iterative-Retraining","2d_heisenberg.py",".py","15488","461","import numpy as np +import torch +import gc +import torch.nn as nn +import torch.nn.functional as F +import torch.nn.utils as U +import torch.multiprocessing as mp +import math as m +import random +import os +import sys +import time +import psutil +from itertools import product, permutations, combinations + +num_sites = int(sys.argv[1]) #length of lattice (number of electrons is num_sites*num_sites) +batch_size = int(sys.argv[2]) #batch size +learning_rate = float(sys.argv[3]) +J2 = float(sys.argv[4]) #J2/J1 + +num_batches = 10000 +max_norm = 1.0 #gradient clipping +hidden_nodes = 128 +num_layers = 5 #number of layers + +if torch.cuda.is_available(): + device = torch.device(""cuda:0"") +else: + device = torch.device(""cpu"") + +class LSTM(nn.Module): + #process information over array [-1,in_channels,num_sites,num_sites] from left to right (over last index) + #returns array [-1,out_channels,num_sites,num_sites] + + def __init__(self,in_channels,out_channels,num_sites): + super(LSTM,self).__init__() + self.in_channels = in_channels + self.out_channels = out_channels + self.num_sites = num_sites + + self.input_input = nn.Conv1d(self.in_channels,self.out_channels,1) + self.input_hidden = nn.Conv1d(self.out_channels,self.out_channels,1) + self.forget_input = nn.Conv1d(self.in_channels,self.out_channels,1) + self.forget_hidden = nn.Conv1d(self.out_channels,self.out_channels,1) + self.cell_input = nn.Conv1d(self.in_channels,self.out_channels,1) + self.cell_hidden = nn.Conv1d(self.out_channels,self.out_channels,1) + self.output_input = nn.Conv1d(self.in_channels,self.out_channels,1) + self.output_hidden = nn.Conv1d(self.out_channels,self.out_channels,1) + + self.layer_norm = nn.LayerNorm([self.out_channels]) + self.layer_norm_cell = nn.LayerNorm([self.out_channels]) + + def first_LSTM_step(self,input): + #takes input drive and outputs hidden state + + input_gate = torch.sigmoid(self.input_input(input)) + cell_gate = torch.tanh(self.cell_input(input)) + output_gate = torch.sigmoid(self.output_input(input)) + + cell = input_gate*cell_gate + hidden = torch.tanh(cell)*output_gate + + hidden = self.layer_norm(hidden.permute(0,2,1)).permute(0,2,1) + cell = self.layer_norm_cell(cell.permute(0,2,1)).permute(0,2,1) + + return hidden, cell + + def LSTM_step(self,hidden,cell,input): + #takes previous hidden state and input drive and outputs current_hidden state + + input_gate = torch.sigmoid(self.input_input(input) + self.input_hidden(hidden)) + forget_gate = torch.sigmoid(self.forget_input(input) + self.forget_hidden(hidden)) + cell_gate = torch.tanh(self.cell_input(input) + self.cell_hidden(hidden)) + output_gate = torch.sigmoid(self.output_input(input) + self.output_hidden(hidden)) + + cell = cell*forget_gate + input_gate*cell_gate + hidden = torch.tanh(cell)*output_gate + + hidden = self.layer_norm(hidden.permute(0,2,1)).permute(0,2,1) + cell = self.layer_norm_cell(cell.permute(0,2,1)).permute(0,2,1) + + return hidden,cell + + def forward(self,x): + for site in np.arange(self.num_sites): + if site == 0: + hidden, cell = self.first_LSTM_step(x[:,:,:,site]) + full_hidden = hidden.clone().unsqueeze(-1) + else: + hidden, cell = self.LSTM_step(hidden,cell,x[:,:,:,site]) + full_hidden = torch.cat((full_hidden,hidden.unsqueeze(-1)),3) + + return full_hidden + +class Layer(nn.Module): + def __init__(self,layer_num): + super(Layer,self).__init__() + + self.layer_num = layer_num + + if self.layer_num == 0: + self.top_down = LSTM(2,hidden_nodes,num_sites) + else: + self.top_down = LSTM(hidden_nodes,hidden_nodes,num_sites) + + self.left_right = LSTM(hidden_nodes,hidden_nodes,num_sites) + self.right_left = LSTM(hidden_nodes,hidden_nodes,num_sites) + + self.W1 = nn.Conv2d(2*hidden_nodes,4*hidden_nodes,1) + self.W2 = nn.Conv2d(4*hidden_nodes,hidden_nodes,1) + + self.top_mask = torch.ones([num_sites]).to(device) + self.top_mask[0] = 0 + self.top_mask = self.top_mask.unsqueeze(-1).unsqueeze(0).unsqueeze(0) + + self.left_mask = torch.ones([num_sites]).to(device) + self.left_mask[0] = 0 + self.left_mask = self.left_mask.unsqueeze(0).unsqueeze(0).unsqueeze(0) + + self.layer_norm = nn.LayerNorm([hidden_nodes]) + + def forward(self,x): + + hidden = self.top_down(x.permute(0,1,3,2)).permute(0,1,3,2) + hidden_lr = self.left_right(hidden) + hidden_rl = self.right_left(hidden.flip([3])).flip([3]) + + hidden_rl = hidden_rl.roll([1],[2])*self.top_mask + hidden_lr = hidden_lr.roll([1],[3])*self.left_mask + hidden = torch.cat((hidden_lr,hidden_rl),1) + + hidden = self.W2(F.relu(self.W1(hidden))) + + if self.layer_num == 0: + return self.layer_norm((hidden).permute(0,2,3,1)).permute(0,3,1,2) + else: + return self.layer_norm((hidden + x).permute(0,2,3,1)).permute(0,3,1,2) + +class Net(nn.Module): + def __init__(self): + super(Net,self).__init__() + + #lstms for rest of layers (4 per layer) + self.layers = nn.ModuleList([Layer(layer) for layer in np.arange(num_layers)]) + + self.probs_hid = nn.Conv2d(hidden_nodes,hidden_nodes,1) + self.ang_hid = nn.Conv2d(hidden_nodes,hidden_nodes,1) + self.probs_hid2 = nn.Conv2d(hidden_nodes,hidden_nodes,1) + self.ang_hid2 = nn.Conv2d(hidden_nodes,hidden_nodes,1) + + self.probs = nn.Conv2d(hidden_nodes,2,1) + self.sin = nn.Conv2d(hidden_nodes,2,1) + self.cos = nn.Conv2d(hidden_nodes,2,1) + + def forward(self,inp): + + #input is [batch_size, 2, num_sites, num_sites] + + for layer in np.arange(num_layers): + + if layer == 0: + hidden = self.layers[layer](inp) + else: + hidden = self.layers[layer](hidden) + + probs_hidden = F.relu(self.probs_hid(hidden)) + ang_hidden = F.relu(self.ang_hid(hidden)) + probs_hidden = F.relu(self.probs_hid2(probs_hidden)) + ang_hidden = F.relu(self.ang_hid2(ang_hidden)) + + probs = F.softmax(self.probs(probs_hidden),1) + sin = self.sin(ang_hidden) + cos = self.cos(ang_hidden) + + phase = torch.atan2(sin,cos) + + log_wf = 0.5*torch.sum(torch.sum(torch.log(torch.sum(probs*inp,1)),1),1) + phase_wf = torch.sum(torch.sum(torch.sum(phase*inp,1),1),1) + + return log_wf, phase_wf + + def sample(self): + + inp = torch.ones([batch_size,2,num_sites,num_sites]).to(device) + + for i in np.arange(num_sites): + for j in np.arange(num_sites): + for layer in np.arange(num_layers): + + if layer == 0: + hidden = self.layers[layer](inp) + else: + hidden = self.layers[layer](hidden) + + probs_hidden = F.relu(self.probs_hid(hidden)) + probs_hidden = F.relu(self.probs_hid2(probs_hidden)) + + probs = F.softmax(self.probs(probs_hidden),1) + + thresh = torch.rand(len(inp)).to(device) + is_one = (1 + torch.sign(probs[:,1,i,j] - thresh))/2 + inp[:,:,i,j] = torch.cat((torch.unsqueeze(1-is_one.clone(),1),torch.unsqueeze(is_one.clone(),1)),1) + return inp + +def local_energy(state,NN,device): + + #state is [num_sites,num_sites,2] + + neighbors = [] + next_neighbors = [] + diag_energy = 0 + + neighbors.append(state) + + for i in np.arange(num_sites): + for j in np.arange(num_sites): + if i+1 < num_sites: + if state[1,i,j] == 1 and state[0,i+1,j] == 1: + final_state = state.copy() + final_state[1,i,j] = 0 + final_state[0,i+1,j] = 0 + final_state[0,i,j] = 1 + final_state[1,i+1,j] = 1 + neighbors.append(final_state) + if state[0,i,j] == 1 and state[1,i+1,j] == 1: + final_state = state.copy() + final_state[0,i,j] = 0 + final_state[1,i+1,j] = 0 + final_state[1,i,j] = 1 + final_state[0,i+1,j] = 1 + neighbors.append(final_state) + if j + 1 < num_sites: + if state[1,i,j] == 1 and state[0,i+1,j+1] == 1: + final_state = state.copy() + final_state[1,i,j] = 0 + final_state[0,i+1,j+1] = 0 + final_state[0,i,j] = 1 + final_state[1,i+1,j+1] = 1 + next_neighbors.append(final_state) + if state[0,i,j] == 1 and state[1,i+1,j+1] == 1: + final_state = state.copy() + final_state[0,i,j] = 0 + final_state[1,i+1,j+1] = 0 + final_state[1,i,j] = 1 + final_state[0,i+1,j+1] = 1 + next_neighbors.append(final_state) + if j > 0: + if state[1,i,j] == 1 and state[0,i+1,j-1] == 1: + final_state = state.copy() + final_state[1,i,j] = 0 + final_state[0,i+1,j-1] = 0 + final_state[0,i,j] = 1 + final_state[1,i+1,j-1] = 1 + next_neighbors.append(final_state) + if state[0,i,j] == 1 and state[1,i+1,j-1] == 1: + final_state = state.copy() + final_state[0,i,j] = 0 + final_state[1,i+1,j-1] = 0 + final_state[1,i,j] = 1 + final_state[0,i+1,j-1] = 1 + next_neighbors.append(final_state) + if j+1 0: + nlog_wfs = np.zeros([0]) + nphase_wfs = np.zeros([0]) + for part in np.arange(num_n_partitions): + with torch.no_grad(): + nlwf, npwf = NN.forward(torch.FloatTensor(np.asarray(next_neighbors)[int(partition_size*part):int(partition_size*(part+1))]).to(device)) + nlwf = nlwf.cpu().detach().numpy() + npwf = npwf.cpu().detach().numpy() + nlog_wfs = np.concatenate((nlog_wfs,nlwf),0) + nphase_wfs = np.concatenate((nphase_wfs,npwf),0) + + position = 0 + energies = np.zeros([batch_size],dtype='complex') + log_wf = np.zeros([batch_size]) + phase_wf = np.zeros([batch_size]) + + if J2 > 0: + nposition = 0 + for i in np.arange(batch_size): + log_wf[i] = log_wfs[position] + phase_wf[i] = phase_wfs[position] + energies[i] = diag_energy[i] + 0.5*np.sum(np.exp(log_wfs[int(position + 1):int(position + neighbor_len[i])] + 1j*phase_wfs[int(position + 1):int(position + neighbor_len[i])] - log_wf[i] - 1j*phase_wf[i]))/(num_sites*num_sites) + 0.5*J2*np.sum(np.exp(nlog_wfs[int(nposition):int(nposition + next_neighbor_len[i])] + 1j*nphase_wfs[int(nposition):int(nposition + next_neighbor_len[i])] - log_wf[i] - 1j*phase_wf[i]))/(num_sites*num_sites) + position = position + neighbor_len[i] + nposition = nposition + next_neighbor_len[i] + else: + for i in np.arange(batch_size): + log_wf[i] = log_wfs[position] + phase_wf[i] = phase_wfs[position] + energies[i] = diag_energy[i] + 0.5*np.sum(np.exp(log_wfs[int(position + 1):int(position + neighbor_len[i])] + 1j*phase_wfs[int(position + 1):int(position + neighbor_len[i])] - log_wf[i] - 1j*phase_wf[i]))/(num_sites*num_sites) + + position = position + neighbor_len[i] + + energies = np.nan_to_num(np.asarray(energies)) + log_wf = np.nan_to_num(np.asarray(log_wf)) + phase_wf = np.nan_to_num(np.asarray(phase_wf)) + afm = np.nan_to_num(np.asarray(afm)) + mag = np.nan_to_num(np.asarray(mag)) + mean_energies = np.mean(energies) + mean_entropies = np.mean(2*log_wf)/(num_sites*num_sites) + mean_afm = np.mean(afm) + mean_magmo = np.mean(np.abs(mag)) + + residuals = np.conj(energies - mean_energies) + + real_residuals = np.real(residuals) + imag_residuals = np.imag(residuals) + entropy_residuals = (2*log_wf/(num_sites*num_sites) + np.log(2)) + mag_residuals = np.square(mag) + + optimizer.zero_grad() + #Set T = 0 to train a small model quickly +# T = 0 + T = 1./(1 + 0.001*batch) + C = 10. + + num_partitions = (batch_size - 1)// part_size + 1 + for partition in np.arange(num_partitions): + log_wf,phase_wf = NN.forward(torch.FloatTensor(batch_states[int(partition*part_size):int((partition+1)*part_size)]).to(device)) + loss = torch.sum(log_wf*torch.FloatTensor((real_residuals + T*entropy_residuals + C*mag_residuals)[int(partition*part_size):int((partition+1)*part_size)]).to(device)-phase_wf*torch.FloatTensor(imag_residuals[int(partition*part_size):int((partition+1)*part_size)]).to(device)) + loss.backward() + for param in NN.parameters(): + param.grad[torch.isnan(param.grad)] = 0 + + norm = torch.nn.utils.clip_grad_norm_(NN.parameters(),max_norm) + optimizer.step() + + f2.write(str(norm)) + f2.write('\t') + f2.write(str(mean_magmo)) + f2.write('\t') + f2.write(str(mean_afm)) + f2.write('\t') + f2.write(str(mean_entropies)) + f2.write('\t') + f2.write(str(mean_energies + T*mean_entropies + C*np.mean(np.square(mag)))) + f2.write('\t') + f2.write(str(mean_energies)) + f2.write('\n') + f2.flush() + + avg_energy = avg_energy + mean_energies + avg_afm = avg_afm + mean_afm + avg_magmo = avg_magmo + mean_magmo + + if not (batch + 1) % 100: + f.write(str(avg_energy/100)) + f.write('\t') + f.write(str(avg_magmo/100)) + f.write('\t') + f.write(str(avg_afm/100)) + f.write('\n') + f.flush() + avg_energy = 0 + avg_magmo = 0 + avg_afm = 0 + + #save model every 100 minibatches + torch.save(NN.state_dict(), 'model_heisenberg_' + file_ext) + +# scheduler.step() + + +train_network() +","Python" +"RNN","chrisrothUT/Iterative-Retraining","1d_heisenberg.py",".py","12760","383","# Code from paper FIX WHEN YOU HAVE ARCHIVE LINK + +import numpy as np +import torch +import gc +import torch.nn as nn +import torch.nn.functional as F +import torch.nn.utils as U +import torch.multiprocessing as mp +import math as m +import random +import os +import sys +import time +import psutil +from itertools import product, permutations, combinations + +num_sites = int(sys.argv[1]) #number of lattice sites +batch_size = int(sys.argv[2]) #batch size +learning_rate = float(sys.argv[3]) #learning rate +J2 = float(sys.argv[4]) # J2/J1 + +num_batches = 1000 #total number of minibatches for training +max_norm = 1.0 #gradient clipping +hidden_nodes = 128 #number of hidden units + +if torch.cuda.is_available(): #run on GPU if available + device = torch.device(""cuda:0"") +else: + device = torch.device(""cpu"") + +class GRU(nn.Module): + #uses GRU to process information over array [-1,in_channels,num_sites] + #returns array [-1,out_channels,num_sites,num_sites] + + def __init__(self,in_channels,out_channels,num_sites): + super(GRU,self).__init__() + self.in_channels = in_channels + self.out_channels = out_channels + self.num_sites = num_sites + + self.input_input = nn.Linear(self.in_channels,self.out_channels,1) + self.input_hidden = nn.Linear(self.out_channels,self.out_channels,1) + self.update_input = nn.Linear(self.in_channels,self.out_channels,1) + self.update_hidden = nn.Linear(self.out_channels,self.out_channels,1) + + self.layer_norm = nn.LayerNorm([self.out_channels]) #Layer norm over hidden state (only along hidden node dimension) + + def first_GRU_step(self,input): + #takes input drive and outputs hidden state + + input_gate = torch.tanh(self.input_input(input)) + update_gate = torch.sigmoid(self.update_input(input)) + + hidden = input_gate*update_gate + + hidden = self.layer_norm(hidden.permute(0,1)).permute(0,1) + + return hidden + + def GRU_step(self,hidden,input): + #takes previous hidden state and input drive and outputs current_hidden state + + input_gate = torch.tanh(self.input_input(input) + self.input_hidden(hidden)) + update_gate = torch.sigmoid(self.update_input(input) + self.update_hidden(hidden)) + + hidden = hidden*(torch.ones_like(update_gate) - update_gate) + input_gate*update_gate + + hidden = self.layer_norm(hidden.permute(0,1)).permute(0,1) + + return hidden + + def forward(self,x): + for site in np.arange(self.num_sites): + if site == 0: + hidden = self.first_GRU_step(x[:,:,site]) + full_hidden = hidden.clone().unsqueeze(-1) + else: + hidden = self.GRU_step(hidden,x[:,:,site]) + full_hidden = torch.cat((full_hidden,hidden.unsqueeze(-1)),2) + + return full_hidden + +class Net(nn.Module): + def __init__(self): + super(Net,self).__init__() + + self.gru = GRU(2,hidden_nodes,num_sites) + + #two layer readout for probability and phase of conditional wavefunction + + self.probs_hid1 = nn.Conv1d(hidden_nodes,hidden_nodes,1) + self.ang_hid1 = nn.Conv1d(hidden_nodes,hidden_nodes,1) + self.probs_hid2 = nn.Conv1d(hidden_nodes,hidden_nodes,1) + self.ang_hid2 = nn.Conv1d(hidden_nodes,hidden_nodes,1) + + self.probs = nn.Conv1d(hidden_nodes,2,1) + self.sin = nn.Conv1d(hidden_nodes,2,1) + self.cos = nn.Conv1d(hidden_nodes,2,1) + + #after rolling the input backwards make sure the first electron doesn't see the last one + + self.mask = torch.ones([num_sites]).to(device) + self.mask[0] = 0 + self.mask = self.mask.unsqueeze(0).unsqueeze(0) + + def forward(self,inp): + + #input is [batch_size, 2, num_sites, num_sites] + + #symmetrize the model by reversing the direction of the input + inp = torch.cat((inp,inp.flip([2])),0) + + hidden = self.gru(inp) + + hidden = hidden.roll([1],[2])*self.mask + + probs_hidden = F.relu(self.probs_hid1(hidden)) + probs_hidden = F.relu(self.probs_hid2(probs_hidden)) + ang_hidden = F.relu(self.ang_hid1(hidden)) + ang_hidden = F.relu(self.ang_hid2(ang_hidden)) + + probs = F.softmax(self.probs(probs_hidden),1) + sin = self.sin(ang_hidden) + cos = self.cos(ang_hidden) + + phase = torch.atan2(sin,cos) + + prob_wf = torch.sum(torch.log(torch.sum(probs*inp,1)),1) + phase_wf = torch.sum(torch.sum(phase*inp,1),1) + + phase_symwf = torch.reshape(phase_wf,[2,-1]) + log_sq_symwf = torch.reshape(prob_wf,[2,-1]) + + log_wf = torch.squeeze(0.5*torch.log(torch.mean(torch.exp(log_sq_symwf-torch.max(log_sq_symwf,0,True)[0]),0)) + 0.5*torch.max(log_sq_symwf,0,True)[0],0) + phase_wf = torch.atan2(torch.sum(torch.exp(log_sq_symwf-torch.max(log_sq_symwf,0,True)[0])*torch.sin(phase_symwf),0),torch.sum(torch.exp(log_sq_symwf-torch.max(log_sq_symwf,0,True)[0])*torch.cos(phase_symwf),0)) + + return log_wf, phase_wf + + def sample(self): + + inp = torch.ones([batch_size,2,num_sites]).to(device) + hidden = torch.zeros([batch_size,hidden_nodes,num_sites]).to(device) + + for i in np.arange(num_sites): + + if i > 0: + if i == 1: + hidden[:,:,i] = GRU.first_GRU_step(self.gru,inp[:,:,i-1]) + else: + hidden[:,:,i] = GRU.GRU_step(self.gru,hidden[:,:,i-1],inp[:,:,i-1]) + + probs_hidden = F.relu(self.probs_hid1(hidden)) + probs_hidden = F.relu(self.probs_hid2(probs_hidden)) + + probs = F.softmax(self.probs(probs_hidden),1) + + thresh = torch.rand(len(inp)).to(device) + is_one = (1. + torch.sign(probs[:,1,i] - thresh))/2. + inp[:,:,i] = torch.cat((torch.unsqueeze(1.-is_one.clone(),1),torch.unsqueeze(is_one.clone(),1)),1) + + return inp + +def local_energy(state,NN,device): + + # returns diagonal contribution to local energy, AFM = \sum_i s^z_i s^z_{i+1}, M = \sum_i s^z_i, as well as neighbors and next neighbors that have matrix elements with state 0.5 and 0.5*J2 respectively + + #state is [num_sites,2] + + neighbors = [] + next_neighbors = [] + diag_energy = 0 + + neighbors.append(state) + + for i in np.arange(num_sites): + if i+1 < num_sites: + if state[1,i] == 1 and state[0,i+1] == 1: + final_state = state.copy() + final_state[1,i] = 0 + final_state[0,i+1] = 0 + final_state[0,i] = 1 + final_state[1,i+1] = 1 + neighbors.append(final_state) + if state[0,i] == 1 and state[1,i+1] == 1: + final_state = state.copy() + final_state[0,i] = 0 + final_state[1,i+1] = 0 + final_state[1,i] = 1 + final_state[0,i+1] = 1 + neighbors.append(final_state) + if i+2 < num_sites: + if state[1,i] == 1 and state[0,i+2] == 1: + final_state = state.copy() + final_state[1,i] = 0 + final_state[0,i+2] = 0 + final_state[0,i] = 1 + final_state[1,i+2] = 1 + next_neighbors.append(final_state) + if state[0,i] == 1 and state[1,i+2] == 1: + final_state = state.copy() + final_state[0,i] = 0 + final_state[1,i+2] = 0 + final_state[1,i] = 1 + final_state[0,i+2] = 1 + next_neighbors.append(final_state) + + state = np.sum(state*np.expand_dims(np.asarray([-1,1]),1),0) + right_shifted_state = np.roll(state,1) + right_shifted_state[0] = 0 + j1_mag = np.sum(right_shifted_state*state) + two_right_shifted_state = np.roll(state,2) + two_right_shifted_state[:2] = 0 + j2_mag = np.sum(two_right_shifted_state*state) + diag_energy = 0.25/num_sites*(j1_mag + J2*j2_mag) #This is the energy contribution from H_ss + + afm = j1_mag/num_sites + mag = np.sum(state)/num_sites + + return diag_energy, neighbors, next_neighbors, afm, mag + +def train_network(): + + file_ext = str(num_sites) + '_' + str(batch_size) + '_' + str(learning_rate) + '_' + str(J2) + '.txt' + loss_file = 'loss_heisenberg_' + file_ext + info_file = 'info_heisenberg_' + file_ext + f = open(loss_file,'w') + f2 = open(info_file,'w') + + NN = Net().to(device) + + # Unactivate this hashtag to load a saved model. As you would do for iterative retraining +# NN.load_state_dict(torch.load(""model_80_100_0.001_0.0.txt"")) + + optimizer = torch.optim.Adam(NN.parameters(), lr=learning_rate) + + # Set the decay of the learning rate + scheduler = torch.optim.lr_scheduler.LambdaLR(optimizer, lambda epoch: 1/np.sqrt(0.001*epoch + 1)) + + avg_energy = 0 + avg_magmo = 0 + avg_afm = 0 + + for batch in np.arange(num_batches): + + with torch.no_grad(): + batch_states = NN.sample() + + batch_states = batch_states.cpu().detach().numpy() + + neighbors = [] + next_neighbors = [] + neighbor_len = [] + next_neighbor_len = [] + mag = [] + afm = [] + diag_energy = [] + + for state in batch_states: + de,nb,nnb,af,mg = local_energy(state,NN,device) + neighbors.extend(nb) + next_neighbors.extend(nnb) + neighbor_len.append(len(nb)) + next_neighbor_len.append(len(nnb)) + mag.append(mg) + afm.append(af) + diag_energy.append(de) + + # This parameter chunks up the data so everything fits into memory. Set this as large as possible as you can get away with! + partition_size = 8000 + num_partitions = (len(neighbors) - 1)// partition_size + 1 + num_n_partitions = (len(next_neighbors) - 1)// partition_size + 1 + + log_wfs = np.zeros([0]) + phase_wfs = np.zeros([0]) + + for part in np.arange(num_partitions): + with torch.no_grad(): + lwf, pwf = NN.forward(torch.FloatTensor(np.asarray(neighbors)[int(partition_size*part):int(partition_size*(part+1))]).to(device)) + lwf = lwf.cpu().detach().numpy() + pwf = pwf.cpu().detach().numpy() + log_wfs = np.concatenate((log_wfs,lwf),0) + phase_wfs = np.concatenate((phase_wfs,pwf),0) + + if J2 > 0: + nlog_wfs = np.zeros([0]) + nphase_wfs = np.zeros([0]) + for part in np.arange(num_n_partitions): + with torch.no_grad(): + nlwf, npwf = NN.forward(torch.FloatTensor(np.asarray(next_neighbors)[int(partition_size*part):int(partition_size*(part+1))]).to(device)) + nlwf = nlwf.cpu().detach().numpy() + npwf = npwf.cpu().detach().numpy() + nlog_wfs = np.concatenate((nlog_wfs,nlwf),0) + nphase_wfs = np.concatenate((nphase_wfs,npwf),0) + + position = 0 + energies = np.zeros([batch_size],dtype='complex') + log_wf = np.zeros([batch_size]) + phase_wf = np.zeros([batch_size]) + + if J2 > 0: + nposition = 0 + for i in np.arange(batch_size): + log_wf[i] = log_wfs[position] + phase_wf[i] = phase_wfs[position] + energies[i] = diag_energy[i] + 0.5*np.sum(np.exp(log_wfs[int(position + 1):int(position + neighbor_len[i])] + 1j*phase_wfs[int(position + 1):int(position + neighbor_len[i])] - log_wf[i] - 1j*phase_wf[i]))/num_sites + 0.5*J2*np.sum(np.exp(nlog_wfs[int(nposition):int(nposition + next_neighbor_len[i])] + 1j*nphase_wfs[int(nposition):int(nposition + next_neighbor_len[i])] - log_wf[i] - 1j*phase_wf[i]))/num_sites + position = position + neighbor_len[i] + nposition = nposition + next_neighbor_len[i] + else: + for i in np.arange(batch_size): + log_wf[i] = log_wfs[position] + phase_wf[i] = phase_wfs[position] + energies[i] = diag_energy[i] + 0.5*np.sum(np.exp(log_wfs[int(position + 1):int(position + neighbor_len[i])] + 1j*phase_wfs[int(position + 1):int(position + neighbor_len[i])] - log_wf[i] - 1j*phase_wf[i]))/num_sites + position = position + neighbor_len[i] + + energies = np.nan_to_num(np.asarray(energies)) + log_wf = np.nan_to_num(np.asarray(log_wf)) + phase_wf = np.nan_to_num(np.asarray(phase_wf)) + afm = np.nan_to_num(np.asarray(afm)) + mag = np.nan_to_num(np.asarray(mag)) + mean_energies = np.mean(energies) + mean_entropies = np.mean(2*log_wf)/num_sites + mean_afm = np.mean(afm) + mean_magmo = np.mean(np.abs(mag)) + + residuals = np.conj(energies - mean_energies) + + real_residuals = np.real(residuals) + imag_residuals = np.imag(residuals) + entropy_residuals = (2*log_wf/(num_sites) + np.log(2)) + mag_residuals = np.square(mag) + + optimizer.zero_grad() + log_wf,phase_wf = NN.forward(torch.FloatTensor(batch_states).to(device)) + # Set T = 0 if you just want to learn a small model fast +# T = 0 + T = 1./(1 + 0.001*batch) + C = 100. + + loss = torch.sum(log_wf*torch.FloatTensor(real_residuals + T*entropy_residuals + C*mag_residuals).to(device)-phase_wf*torch.FloatTensor(imag_residuals).to(device)) + loss.backward() + for param in NN.parameters(): + param.grad[torch.isnan(param.grad)] = 0 + norm = torch.nn.utils.clip_grad_norm_(NN.parameters(),max_norm) + optimizer.step() + scheduler.step() + + #info file keeps track of gradient norm, M, AFM, pseudo-entropy, total cost function, energy + f2.write(str(norm)) + f2.write('\t') + f2.write(str(mean_magmo)) + f2.write('\t') + f2.write(str(mean_afm)) + f2.write('\t') + f2.write(str(mean_entropies)) + f2.write('\t') + f2.write(str(mean_energies + T*mean_entropies + C*np.mean(np.square(mag)))) + f2.write('\t') + f2.write(str(mean_energies)) + f2.write('\n') + f2.flush() + + avg_energy = avg_energy + mean_energies + avg_afm = avg_afm + mean_afm + avg_magmo = avg_magmo + mean_magmo + + if not (batch + 1) % 100: + f.write(str(avg_energy/100.)) + f.write('\t') + f.write(str(avg_magmo/100.)) + f.write('\t') + f.write(str(avg_afm/100.)) + f.write('\n') + f.flush() + avg_energy = 0 + avg_magmo = 0 + avg_afm = 0 + + # save the model every 100 batches + torch.save(NN.state_dict(), 'model_load_' + file_ext) + +train_network() +","Python" +"RNN","MinLiAmoy/rnn-fpga","setup.sh",".sh","104","5","#!/usr/bin/env bash + +DIR=""$( cd ""$( dirname ""${BASH_SOURCE[0]}"" )"" && pwd )"" +export CRAFT_BNN_ROOT=$DIR +","Shell" +"RNN","MinLiAmoy/rnn-fpga","settings64.sh",".sh","531","10","############################################################## +# Copyright (c) 1986-2017 Xilinx, Inc. All rights reserved. # +############################################################## + +source /home/hang/Xilinx/SDx/2017.1/SDK/.settings64-Software_Development_Kit.sh +source /home/hang/Xilinx/DocNav/.settings64-DocNav.sh +source /home/hang/Xilinx/SDx/2017.1/.settings64-SDx.sh +source /home/hang/Xilinx/SDx/2017.1/Vivado_HLS/.settings64-SDx_High_Level_Synthesis.sh +source /home/hang/Xilinx/SDx/2017.1/Vivado/.settings64-Vivado.sh +","Shell" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/Common.cpp",".cpp","293","13","#include ""Common.h"" + +//------------------------------------------------------------------------ +std::string get_root_dir() { + char* root = getenv(""CRAFT_BNN_ROOT""); + if (!root) { + fprintf(stderr, ""Cannot find CRAFT_BNN_ROOT directory\n""); + exit(-1); + } + return std::string(root); +} + +","C++" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/Common.h",".h","367","23","#ifndef COMMON_H +#define COMMON_H + +#include +#include +#include +#include +#include + +#include ""Typedefs.h"" + +// Returns the repo's root dir or exits +std::string get_root_dir(); + +// We encode negative to -1, positive to 0 +template +Bit sgn(const T x) { + #pragma HLS INLINE + return (x < 0) ? -1 : 0; +} + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/open_zip.cpp",".cpp","2224","78","//------------------------------------------------------------------------ +// Simple test program for minizip, it checks the contents (files) in +// a zip archive and reports the size of each file +// Requires zlib and minizip. +//------------------------------------------------------------------------ +#include +#include +#include + +#include ""../minizip/unzip.h"" + +int main(int argc, char** argv) { + if (argc < 2) { + printf(""Usage: %s \n"", argv[0]); + return 0; + } + + int err; + + // Open the zipfile + // A ""zipfile"" means the zip archive, which can be a directory containing + // many files. + unzFile zipfile = unzOpen(argv[1]); + if (zipfile == NULL) { + printf(""Could not open %s\n"", argv[1]); + return -1; + } + + // Get the number of files (entries) inside + unz_global_info info; + err = unzGetGlobalInfo(zipfile, &info); + assert (!err); + unsigned entries = info.number_entry; + printf (""Entries: %u\n"", entries); + + float** data = new float*[entries]; + + for (unsigned i = 0; i < entries; ++i) { + // Get some info on the file + unz_file_info finfo; + char filename[50]; + err = unzGetCurrentFileInfo(zipfile, &finfo, filename, 50, NULL, 0, NULL, 0); + assert (!err); + printf ("" File %s: size=%luKB, compsize=%luKB\n"", filename, + finfo.uncompressed_size>>10, finfo.compressed_size>>10); + + // The data is an array of floats packed into 4-byte chunks + unsigned array_size = finfo.uncompressed_size/4; + assert(finfo.uncompressed_size % 4 == 0); + assert(array_size > 0); + data[i] = new float[array_size]; + + // Read the data from the current file 4 bytes at a time, + // convert the bytes to a float and store it + unzOpenCurrentFile(zipfile); + float f; + + for (unsigned j = 0; j < array_size; ++j) { + // unzReadCurrentFile returns the number of bytes read + // or 0 if end of file is reached + err = unzReadCurrentFile(zipfile, (void*)&f, 4); + assert((err == 4) || (j == array_size-1)); + data[i][j] = f; + + if (j < 5) + printf ("" %5.2f"", data[i][j]); + } + printf (""\n""); + + unzCloseCurrentFile(zipfile); + unzGoToNextFile(zipfile); + } + + unzClose(zipfile); + + return 0; +} +","C++" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/DataIO.h",".h","937","36","//------------------------------------------------------------------------ +// Class to read the image data +//------------------------------------------------------------------------ +#include + +#include ""Debug.h"" +#include ""ZipIO.h"" +#include ""Common.h"" +#include ""SArray.h"" + +// This class will load N cifar10 test images +struct Cifar10TestInputs { + static const unsigned CHANNELS=3; + static const unsigned ROWS=32; + static const unsigned COLS=32; + static constexpr const char* filename = ""/data/cifar10_test_inputs.zip""; + + float* data; + unsigned m_size; + + Cifar10TestInputs(unsigned n); + ~Cifar10TestInputs() { delete[] data; } + unsigned size() { return m_size; } +}; + +struct Cifar10TestLabels { + static constexpr const char* filename = ""/data/cifar10_test_labels.zip""; + + float* data; + unsigned m_size; + + Cifar10TestLabels(unsigned n); + ~Cifar10TestLabels() { delete[] data; } + unsigned size() { return m_size; } +}; +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/DataIO.cpp",".cpp","1294","46","#include ""DataIO.h"" + + +Cifar10TestInputs::Cifar10TestInputs(unsigned n) + : m_size(n*CHANNELS*ROWS*COLS) +{ + data = new float[m_size]; // ML: data's type and size + + std::string full_filename = get_root_dir() + filename; + DB_PRINT(2, ""Opening data archive %s\n"", full_filename.c_str()); + unzFile ar = open_unzip(full_filename.c_str()); + unsigned nfiles = get_nfiles_in_unzip(ar); + assert(nfiles == 1); + + // We read m_size*4 bytes from the archive + // ML: data stored in Inputs is 32 bits float + unsigned fsize = get_current_file_size(ar); + assert(m_size*4 <= fsize); + + DB_PRINT(2, ""Reading %u bytes\n"", m_size*4); + read_current_file(ar, (void*)data, m_size*4); // ML: read the inputs to data + + unzClose(ar); +} + +Cifar10TestLabels::Cifar10TestLabels(unsigned n) + : m_size(n) +{ + data = new float[m_size]; + + std::string full_filename = get_root_dir() + filename; + DB_PRINT(2, ""Opening data archive %s\n"", full_filename.c_str()); + unzFile ar = open_unzip(full_filename.c_str()); + unsigned nfiles = get_nfiles_in_unzip(ar); + assert(nfiles == 1); + + // We read n*4 bytes from the archive + unsigned fsize = get_current_file_size(ar); + assert(m_size*4 <= fsize); + + DB_PRINT(2, ""Reading %u bytes\n"", m_size*4); + read_current_file(ar, (void*)data, m_size*4); + unzClose(ar); +} + +","C++" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/Debug.h",".h","366","27","#ifndef DEBUG_H +#define DEBUG_H + +#ifndef DEBUG_LEVEL +#define DEBUG_LEVEL 0 +#endif + +#ifdef HLS_COMPILE +#undef DEBUG_LEVEL +#endif + +#ifdef DEBUG_LEVEL + + #define DB(lvl, x) if (lvl <= DEBUG_LEVEL) {x;} + #define DB_PRINT(lvl, ...) \ + if (lvl <= DEBUG_LEVEL) \ + printf (__VA_ARGS__) + +#else + + #define DB(lvl, x) + #define DB_PRINT(lvl, ...) + +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/Timer.cpp",".cpp","1675","77","//--------------------------------------------------------- +// Timer.cpp +//--------------------------------------------------------- +#include ""Timer.h"" + +#ifdef TIMER_ON +//--------------------------------------------------------- +// Timer is active +//--------------------------------------------------------- + +Timer::Timer(const char* Name, bool On) { + if (On) { + // record the start time + gettimeofday(&ts_start, NULL); + nCalls = 1; + } + else { + nCalls = 0; + } + totalTime = 0; + strcpy(binName, Name); +} + +Timer::~Timer() { + // on being destroyed, print the average and total time + if (nCalls > 0) { + printf (""%-20s: "", binName); + printf (""%6d calls; "", nCalls); + if (totalTime < 1e-6) + printf (""%6.3f usecs total time\n"", 1e6*totalTime); + else if (totalTime < 1e-3) + printf (""%6.3f msecs total time\n"", 1e3*totalTime); + else + printf (""%6.3f secs total time\n"", totalTime); + } +} + +void Timer::start() { + // record start time + gettimeofday(&ts_start, NULL); + nCalls++; +} + +void Timer::stop() { + // get current time, add elapsed time to totalTime + timeval ts_curr; + gettimeofday(&ts_curr, NULL); + totalTime += float(ts_curr.tv_sec - ts_start.tv_sec) + + float(ts_curr.tv_usec)*1e-6 - float(ts_start.tv_usec)*1e-6; +} + +float Timer::get_time() { + return totalTime; +} + +#else +//--------------------------------------------------------- +// Timer turned off, methods do nothing +//--------------------------------------------------------- +Timer::Timer(const char* Name="""", bool On=false) { +} + +Timer::~Timer() { +} + +void Timer::start() { +} + +void Timer::stop() { +} + +float Timer::get_time() { + return 0; +} + +#endif +","C++" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/Typedefs.h",".h","742","40","#ifndef TYPEDEFS_H +#define TYPEDEFS_H + +#include + +//#define USE_FLOAT + +#ifdef USE_FLOAT + + typedef float InputFixed; + + // Types for weights + typedef ap_int<1> Bit; + typedef ap_int<2> TwoBit; + + typedef float KType; + typedef float HType; + + typedef float NormOutput; + typedef ap_int<14> ConvOutput; + +#else + + // Quantized 32-bit input images in the range [-1,1] + typedef ap_fixed<32,2, AP_RND> InputFixed; + + // Types for weights + typedef ap_int<1> Bit; + typedef ap_int<2> TwoBit; + + typedef ap_fixed<16,2> KType; + typedef ap_fixed<16,4> HType; // ML: KType and HType are used in the last layer, where outputs are not binaried + + typedef ap_fixed<16,5> NormOutput; + typedef ap_int<14> ConvOutput; + +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/ParamIO.cpp",".cpp","848","39","#include + +#include ""ParamIO.h"" +#include ""ZipIO.h"" +#include ""Common.h"" + +Params::Params(std::string zipfile) + : m_filename(zipfile), + m_arrays(0) +{ + // Open file + DB_PRINT(2, ""Opening params archive %s\n"", m_filename.c_str()); + unzFile ar = open_unzip(m_filename); + + // Get number of files in the archive + m_arrays = get_nfiles_in_unzip(ar); + DB_PRINT(2, ""Number of param arrays: %u\n"", m_arrays); + assert(m_arrays <= MAX_LAYERS); + + // Read each array + for (unsigned i = 0; i < m_arrays; ++i) { + unsigned fsize = get_current_file_size(ar); + m_array_size[i] = fsize; // size in bytes + + m_data[i] = new float[fsize/4]; + read_current_file(ar, (void*)m_data[i], fsize); + + unzGoToNextFile(ar); + } + + unzClose(ar); +} + +Params::~Params() { + for (unsigned i = 0; i < m_arrays; ++i) + delete[] m_data[i]; +} + +","C++" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/ZipIO.h",".h","3173","94","#ifndef ZIP_IO_H +#define ZIP_IO_H + +#include +#include +#include +#include ""../minizip/zip.h"" +#include ""../minizip/unzip.h"" + +//------------------------------------------------------------------------ +// Functions for reading a zip archive +//------------------------------------------------------------------------ +unzFile open_unzip(const std::string filename); +unsigned get_nfiles_in_unzip(unzFile ar); +unsigned get_current_file_size(unzFile ar); +void read_current_file(unzFile ar, void* buffer, unsigned bytes); + +//------------------------------------------------------------------------ +// Writes a buffer to a new file with name [fname] inside the +// zip archive [zf]. +//------------------------------------------------------------------------ +void write_buffer_to_zip( + zipFile zf, // zip archive handle + std::string fname, // name of file instead archive to write + void* buf, // buffer of data + unsigned len // how many bytes to write + ); + +//------------------------------------------------------------------------ +// SArray to and from zipfile +//------------------------------------------------------------------------ +// Read zip archive to SArray, used when you know the archive contains +// one array and it has an exact size +template +void unzip_to_sarray(std::string filename, Array &buf) { + unzFile ar = open_unzip(filename); + unsigned fsize = get_current_file_size(ar); + assert(fsize == sizeof(buf.data)); + + read_current_file(ar, (void*)buf.ptr(), fsize); + unzClose(ar); +} + +// write an array to a zip archive containing one file +template +void sarray_to_zip(std::string filename, const Array &buf, unsigned n_elems=0) { + zipFile ar = zipOpen(filename.c_str(), 0); + n_elems = (n_elems == 0) ? Array::size() : n_elems; + + // copy the SArray data to an array of float + float* data = new float[n_elems]; + for (unsigned i = 0; i < n_elems; ++i) { + data[i] = buf[i]; + } + + // store the array of float + write_buffer_to_zip(ar, ""arr_0"", (void*)data, n_elems*sizeof(float)); + delete[] data; + int err = zipClose(ar, NULL); + assert(err == ZIP_OK); +} + +//------------------------------------------------------------------------ +// C Array to and from zipfile +//------------------------------------------------------------------------ +template +void unzip_to_array(std::string filename, T buf[]) { + unzFile ar = open_unzip(filename); + unsigned fsize = get_current_file_size(ar); + assert(fsize != 0 && fsize % 4 == 0); + + read_current_file(ar, (void*)buf, fsize); + unzClose(ar); +} + +template +void bitarray_to_zip(std::string filename, T buf[], unsigned n_elems) { + zipFile ar = zipOpen(filename.c_str(), 0); + const unsigned elem_size = buf[0].length(); + + // copy the array data to an array of float + float* data = new float[n_elems]; + for (unsigned i = 0; i < n_elems; ++i) { + data[i] = (buf[i/elem_size][i%elem_size] == 0) ? 1.0 : -1.0; + } + // store the array of float + write_buffer_to_zip(ar, ""arr_0"", (void*)data, n_elems*sizeof(float)); + delete[] data; + int err = zipClose(ar, NULL); + assert(err == ZIP_OK); +} + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/ParamIO.h",".h","1450","50","//------------------------------------------------------------------------ +// Class to read the parameters from a .zip archive. +// Requires zlib and minizip. +//------------------------------------------------------------------------ +#ifndef PARAM_IO_H +#define PARAM_IO_H + +#include +#include +#include ""../minizip/unzip.h"" +#include ""Debug.h"" + +/* Parameters are organized into arrays. A layer may have multiple arrays of + * params. For example Weight and Bias are two arrays for a Conv layer + */ +// ML: * case of batch normalizaion? +struct Params { + static const unsigned MAX_LAYERS = 64; // ML: actually it's the max array number + + std::string m_filename; + unsigned m_arrays; + unsigned m_array_size[MAX_LAYERS]; + float* m_data[MAX_LAYERS]; + + public: + // Read a zip archive containing NN params. We make the assumption + // that each file in the archive is one array. The data is stored + // as just an array of bytes + Params(std::string zipfile); + // Safely deletes params + ~Params(); + + // Get the number of layers + unsigned num_arrays() const { return m_arrays; } + // Get the size of the params array in bytes + unsigned array_size(unsigned i) const { + return m_array_size[i]; + } + // Get a pointer to the params for layer + float* array_data(unsigned i) const { + return m_data[i]; + } + + float* float_data(unsigned i) const { + return array_data(i); + } +}; + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/SArray.h",".h","1738","71","#ifndef SARRAY_H +#define SARRAY_H + +//------------------------------------------------------------------------ +// Static array organized as N SxS images +//------------------------------------------------------------------------ +template +struct SArray { + typedef T ElemType; + T data[SIZE]; + + static constexpr unsigned size() { return SIZE; } + + // get base ptr + T* ptr() { return data; } + const T* ptr() const { return data; } + + // array subscript + T& operator[](unsigned i) { return data[i]; } + const T& operator[](unsigned i) const { return data[i]; } + + void set(T x) { + for (unsigned i = 0; i < size(); ++i) + data[i] = x; + } + + void clear() { + set(0); + } + + // copy data from another array or SArray + template + void copy_from(const A& other, unsigned siz=size()) { + assert(siz <= size()); + for (unsigned i = 0; i < siz; ++i) + data[i] = other[i]; + } + + // copy data and binarize + template + void binarize_from(const A& other, unsigned siz=size()) { + assert(siz <= size()); + for (unsigned i = 0; i < siz; ++i) + data[i] = (other[i] >= 0) ? 0 : 1; + } + + // print a subimage + void print_sub(unsigned n, unsigned S, + unsigned maxs=8, char fmt='f') const { + maxs = (maxs >= S) ? S : maxs; + assert(n*S*S < size()); + for (unsigned r = 0; r < maxs; ++r) { + for (unsigned c = 0; c < S; ++c) { + if (fmt == 'f') + printf (""%6.3f "", (float)data[n*S*S + r*S + c]); + else + printf (""%5d "", (int)data[n*S*S + r*S + c]); + } + printf (""\n""); + } + } + + // print an image + void print(unsigned n=0, unsigned S=32, char fmt='f') const { + print_sub(n, S, S, fmt); + } + +}; + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/Timer.h",".h","1101","48","//--------------------------------------------------------- +// Timer.h +//--------------------------------------------------------- +#ifndef __TIMER_H__ +#define __TIMER_H__ +#include +#include +#include +#include + +#define TIMER_ON + +//--------------------------------------------------------- +// Timer is an object which helps profile programs using +// the clock() function. +// - By default, a timer is stopped when you instantiate it +// and must be started manually +// - Passing True to the constructor starts the timer when +// it is constructed +// - When the timer is destructed it prints stats to stdout +//--------------------------------------------------------- +class Timer { + + #ifdef TIMER_ON + + char binName[50]; + unsigned nCalls; + timeval ts_start; + float totalTime; + + #endif + + public: + // constructor + Timer(const char* Name="""", bool On=false); + // destructor + ~Timer(); + + // start/stop timer + void start(); + void stop(); + + // returns time in seconds + float get_time(); +}; + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/utils/ZipIO.cpp",".cpp","1975","73","#include + +#include ""ZipIO.h"" +#include ""Debug.h"" + +//------------------------------------------------------------------------ +unzFile open_unzip(const std::string filename) { + unzFile ar = unzOpen(filename.c_str()); + if (ar == NULL) { + fprintf(stderr, ""Error opening %s\n"", filename.c_str()); + exit(-1); + } + return ar; + +} + +//------------------------------------------------------------------------ +unsigned get_nfiles_in_unzip(unzFile ar) { + unz_global_info info; + int err = unzGetGlobalInfo(ar, &info); + assert(!err); + return info.number_entry; +} + +//------------------------------------------------------------------------ +unsigned get_current_file_size(unzFile ar) { + unz_file_info finfo; + char fname[50]; + + int err = unzGetCurrentFileInfo(ar, &finfo, fname, 50, NULL, 0, NULL, 0); + assert(!err); + unsigned fsize = finfo.uncompressed_size; + + DB_PRINT(3, ""Reading %10s, %u bytes\n"", fname, fsize); + + assert(fsize > 0); + return fsize; +} + +//------------------------------------------------------------------------ +void read_current_file(unzFile ar, void* buffer, unsigned bytes) { + int err = unzOpenCurrentFile(ar); + assert(!err); + + unsigned b = unzReadCurrentFile(ar, buffer, bytes); + assert(b == bytes); + + unzCloseCurrentFile(ar); +} + +//------------------------------------------------------------------------ +void write_buffer_to_zip(zipFile zf, std::string fname, void* buf, unsigned len) { + int err; + DB_PRINT(3, ""Writing %10s, %u bytes\n"", fname.c_str(), len); + + // Open new file + zip_fileinfo zi = {0}; + err = zipOpenNewFileInZip(zf, fname.c_str(), &zi, + NULL, 0, NULL, 0, NULL, + 0, /* method */ + Z_DEFAULT_COMPRESSION); /* level */ + assert(err == ZIP_OK); + + // Write data + err = zipWriteInFileInZip(zf, buf, len); + assert(err == ZIP_OK); + + // Close file + err = zipCloseFileInZip(zf); + assert(err == ZIP_OK); +} + +","C++" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/miniunz.c",".c","15761","574","/* miniunz.c + Version 1.1, February 14h, 2010 + sample part of the MiniZip project + + Copyright (C) 1998-2010 Gilles Vollant + http://www.winimage.com/zLibDll/minizip.html + Modifications of Unzip for Zip64 + Copyright (C) 2007-2008 Even Rouault + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson + http://result42.com + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. +*/ + +#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) +# ifndef __USE_FILE_OFFSET64 +# define __USE_FILE_OFFSET64 +# endif +# ifndef __USE_LARGEFILE64 +# define __USE_LARGEFILE64 +# endif +# ifndef _LARGEFILE64_SOURCE +# define _LARGEFILE64_SOURCE +# endif +# ifndef _FILE_OFFSET_BIT +# define _FILE_OFFSET_BIT 64 +# endif +#endif + +#ifdef __APPLE__ +/* In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions */ +# define FOPEN_FUNC(filename, mode) fopen(filename, mode) +# define FTELLO_FUNC(stream) ftello(stream) +# define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) +#else +# define FOPEN_FUNC(filename, mode) fopen64(filename, mode) +# define FTELLO_FUNC(stream) ftello64(stream) +# define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin) +#endif + +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +# include +# include +#else +# include +# include +# include +#endif + +#ifdef _WIN32 +# define MKDIR(d) _mkdir(d) +# define CHDIR(d) _chdir(d) +#else +# define MKDIR(d) mkdir(d, 0775) +# define CHDIR(d) chdir(d) +#endif + +#include ""unzip.h"" + +#define WRITEBUFFERSIZE (8192) +#define MAXFILENAME (256) + +#ifdef _WIN32 +# define USEWIN32IOAPI +# include ""iowin32.h"" +#endif + +void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) +{ +#ifdef _WIN32 + HANDLE hFile; + FILETIME ftm, ftLocal, ftCreate, ftLastAcc, ftLastWrite; + + hFile = CreateFileA(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); + if (hFile != INVALID_HANDLE_VALUE) + { + GetFileTime(hFile, &ftCreate, &ftLastAcc, &ftLastWrite); + DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate, &ftLocal); + LocalFileTimeToFileTime(&ftLocal, &ftm); + SetFileTime(hFile, &ftm, &ftLastAcc, &ftm); + CloseHandle(hFile); + } +#else +#if defined unix || defined __APPLE__ + struct utimbuf ut; + struct tm newdate; + + newdate.tm_sec = tmu_date.tm_sec; + newdate.tm_min = tmu_date.tm_min; + newdate.tm_hour = tmu_date.tm_hour; + newdate.tm_mday = tmu_date.tm_mday; + newdate.tm_mon = tmu_date.tm_mon; + if (tmu_date.tm_year > 1900) + newdate.tm_year = tmu_date.tm_year - 1900; + else + newdate.tm_year = tmu_date.tm_year ; + newdate.tm_isdst = -1; + + ut.actime = ut.modtime = mktime(&newdate); + utime(filename,&ut); +#endif +#endif +} + +int check_file_exists(const char* filename) +{ + FILE* ftestexist = FOPEN_FUNC(filename,""rb""); + if (ftestexist == NULL) + return 0; + fclose(ftestexist); + return 1; +} + +int makedir(const char *newdir) +{ + char *buffer = NULL; + char *p = NULL; + int len = (int)strlen(newdir); + + if (len <= 0) + return 0; + + buffer = (char*)malloc(len+1); + if (buffer == NULL) + { + printf(""Error allocating memory\n""); + return UNZ_INTERNALERROR; + } + + strcpy(buffer, newdir); + + if (buffer[len-1] == '/') + buffer[len-1] = 0; + + if (MKDIR(buffer) == 0) + { + free(buffer); + return 1; + } + + p = buffer + 1; + while (1) + { + char hold; + while(*p && *p != '\\' && *p != '/') + p++; + hold = *p; + *p = 0; + + if ((MKDIR(buffer) == -1) && (errno == ENOENT)) + { + printf(""couldn't create directory %s (%d)\n"", buffer, errno); + free(buffer); + return 0; + } + + if (hold == 0) + break; + + *p++ = hold; + } + + free(buffer); + return 1; +} + +void display_zpos64(ZPOS64_T n, int size_char) +{ + /* To avoid compatibility problem we do here the conversion */ + char number[21] = {0}; + int offset = 19; + int pos_string = 19; + int size_display_string = 19; + + while (1) + { + number[offset] = (char)((n%10) + '0'); + if (number[offset] != '0') + pos_string = offset; + n /= 10; + if (offset == 0) + break; + offset--; + } + + size_display_string -= pos_string; + while (size_char-- > size_display_string) + printf("" ""); + printf(""%s"",&number[pos_string]); +} + +void do_banner() +{ + printf(""MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n""); + printf(""more info at http://www.winimage.com/zLibDll/minizip.html\n\n""); +} + +void do_help() +{ + printf(""Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n"" \ + "" -e Extract without pathname (junk paths)\n"" \ + "" -x Extract with pathname\n"" \ + "" -v list files\n"" \ + "" -l list files\n"" \ + "" -d directory to extract into\n"" \ + "" -o overwrite files without prompting\n"" \ + "" -p extract crypted file using password\n\n""); +} + +int do_list(unzFile uf) +{ + int err = unzGoToFirstFile(uf); + if (err != UNZ_OK) + { + printf(""error %d with zipfile in unzGoToFirstFile\n"", err); + return 1; + } + + printf("" Length Method Size Ratio Date Time CRC-32 Name\n""); + printf("" ------ ------ ---- ----- ---- ---- ------ ----\n""); + + do + { + char filename_inzip[256] = {0}; + unz_file_info64 file_info = {0}; + uLong ratio = 0; + const char *string_method = NULL; + char charCrypt = ' '; + + err = unzGetCurrentFileInfo64(uf, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0); + if (err != UNZ_OK) + { + printf(""error %d with zipfile in unzGetCurrentFileInfo\n"", err); + break; + } + + if (file_info.uncompressed_size > 0) + ratio = (uLong)((file_info.compressed_size*100) / file_info.uncompressed_size); + + /* Display a '*' if the file is encrypted */ + if ((file_info.flag & 1) != 0) + charCrypt = '*'; + + if (file_info.compression_method == 0) + string_method = ""Stored""; + else if (file_info.compression_method == Z_DEFLATED) + { + uInt iLevel = (uInt)((file_info.flag & 0x6) / 2); + if (iLevel == 0) + string_method = ""Defl:N""; + else if (iLevel == 1) + string_method = ""Defl:X""; + else if ((iLevel == 2) || (iLevel == 3)) + string_method = ""Defl:F""; /* 2:fast , 3 : extra fast*/ + } + else if (file_info.compression_method == Z_BZIP2ED) + { + string_method = ""BZip2 ""; + } + else + string_method = ""Unkn. ""; + + display_zpos64(file_info.uncompressed_size, 7); + printf("" %6s%c"", string_method, charCrypt); + display_zpos64(file_info.compressed_size, 7); + printf("" %3lu%% %2.2lu-%2.2lu-%2.2lu %2.2lu:%2.2lu %8.8lx %s\n"", ratio, + (uLong)file_info.tmu_date.tm_mon + 1, (uLong)file_info.tmu_date.tm_mday, + (uLong)file_info.tmu_date.tm_year % 100, + (uLong)file_info.tmu_date.tm_hour, (uLong)file_info.tmu_date.tm_min, + (uLong)file_info.crc, filename_inzip); + + err = unzGoToNextFile(uf); + } + while (err == UNZ_OK); + + if (err != UNZ_END_OF_LIST_OF_FILE && err != UNZ_OK) { + printf(""error %d with zipfile in unzGoToNextFile\n"", err); + return err; + } + + return 0; +} + +int do_extract_currentfile(unzFile uf, int opt_extract_without_path, int* popt_overwrite, const char *password) +{ + unz_file_info64 file_info = {0}; + FILE* fout = NULL; + void* buf = NULL; + uInt size_buf = WRITEBUFFERSIZE; + int err = UNZ_OK; + int errclose = UNZ_OK; + int skip = 0; + char filename_inzip[256] = {0}; + char* filename_withoutpath = NULL; + const char* write_filename = NULL; + char* p = NULL; + + err = unzGetCurrentFileInfo64(uf, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0); + if (err != UNZ_OK) + { + printf(""error %d with zipfile in unzGetCurrentFileInfo\n"",err); + return err; + } + + p = filename_withoutpath = filename_inzip; + while (*p != 0) + { + if ((*p == '/') || (*p == '\\')) + filename_withoutpath = p+1; + p++; + } + + /* If zip entry is a directory then create it on disk */ + if (*filename_withoutpath == 0) + { + if (opt_extract_without_path == 0) + { + printf(""creating directory: %s\n"", filename_inzip); + MKDIR(filename_inzip); + } + return err; + } + + buf = (void*)malloc(size_buf); + if (buf == NULL) + { + printf(""Error allocating memory\n""); + return UNZ_INTERNALERROR; + } + + err = unzOpenCurrentFilePassword(uf, password); + if (err != UNZ_OK) + printf(""error %d with zipfile in unzOpenCurrentFilePassword\n"", err); + + if (opt_extract_without_path) + write_filename = filename_withoutpath; + else + write_filename = filename_inzip; + + /* Determine if the file should be overwritten or not and ask the user if needed */ + if ((err == UNZ_OK) && (*popt_overwrite == 0) && (check_file_exists(write_filename))) + { + char rep = 0; + do + { + char answer[128]; + printf(""The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: "", write_filename); + if (scanf(""%1s"", answer) != 1) + exit(EXIT_FAILURE); + rep = answer[0]; + if ((rep >= 'a') && (rep <= 'z')) + rep -= 0x20; + } + while ((rep != 'Y') && (rep != 'N') && (rep != 'A')); + + if (rep == 'N') + skip = 1; + if (rep == 'A') + *popt_overwrite = 1; + } + + /* Create the file on disk so we can unzip to it */ + if ((skip == 0) && (err == UNZ_OK)) + { + fout = FOPEN_FUNC(write_filename, ""wb""); + /* Some zips don't contain directory alone before file */ + if ((fout == NULL) && (opt_extract_without_path == 0) && + (filename_withoutpath != (char*)filename_inzip)) + { + char c = *(filename_withoutpath-1); + *(filename_withoutpath-1) = 0; + makedir(write_filename); + *(filename_withoutpath-1) = c; + fout = FOPEN_FUNC(write_filename, ""wb""); + } + if (fout == NULL) + printf(""error opening %s\n"", write_filename); + } + + /* Read from the zip, unzip to buffer, and write to disk */ + if (fout != NULL) + { + printf("" extracting: %s\n"", write_filename); + + do + { + err = unzReadCurrentFile(uf, buf, size_buf); + if (err < 0) + { + printf(""error %d with zipfile in unzReadCurrentFile\n"", err); + break; + } + if (err == 0) + break; + if (fwrite(buf, err, 1, fout) != 1) + { + printf(""error %d in writing extracted file\n"", errno); + err = UNZ_ERRNO; + break; + } + } + while (err > 0); + + if (fout) + fclose(fout); + + /* Set the time of the file that has been unzipped */ + if (err == 0) + change_file_date(write_filename,file_info.dosDate, file_info.tmu_date); + } + + errclose = unzCloseCurrentFile(uf); + if (errclose != UNZ_OK) + printf(""error %d with zipfile in unzCloseCurrentFile\n"", errclose); + + free(buf); + return err; +} + +int do_extract_all(unzFile uf, int opt_extract_without_path, int opt_overwrite, const char *password) +{ + int err = unzGoToFirstFile(uf); + if (err != UNZ_OK) + { + printf(""error %d with zipfile in unzGoToFirstFile\n"", err); + return 1; + } + + do + { + err = do_extract_currentfile(uf, opt_extract_without_path, &opt_overwrite, password); + if (err != UNZ_OK) + break; + err = unzGoToNextFile(uf); + } + while (err == UNZ_OK); + + if (err != UNZ_END_OF_LIST_OF_FILE) + { + printf(""error %d with zipfile in unzGoToNextFile\n"", err); + return 1; + } + return 0; +} + +int do_extract_onefile(unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, + const char* password) +{ + if (unzLocateFile(uf, filename, NULL) != UNZ_OK) + { + printf(""file %s not found in the zipfile\n"", filename); + return 2; + } + if (do_extract_currentfile(uf, opt_extract_without_path, &opt_overwrite, password) == UNZ_OK) + return 0; + return 1; +} + +int main(int argc, const char *argv[]) +{ + const char *zipfilename = NULL; + const char *filename_to_extract = NULL; + const char *password = NULL; + int i = 0; + int ret = 0; + int opt_do_list = 0; + int opt_do_extract = 1; + int opt_do_extract_withoutpath = 0; + int opt_overwrite = 0; + int opt_extractdir = 0; + const char *dirname = NULL; + unzFile uf = NULL; + + do_banner(); + if (argc == 1) + { + do_help(); + return 0; + } + + /* Parse command line options */ + for (i = 1; i < argc; i++) + { + if ((*argv[i]) == '-') + { + const char *p = argv[i]+1; + + while (*p != 0) + { + char c = *(p++); + if ((c == 'l') || (c == 'L')) + opt_do_list = 1; + if ((c == 'v') || (c == 'V')) + opt_do_list = 1; + if ((c == 'x') || (c == 'X')) + opt_do_extract = 1; + if ((c == 'e') || (c == 'E')) + opt_do_extract = opt_do_extract_withoutpath = 1; + if ((c == 'o') || (c == 'O')) + opt_overwrite=1; + if ((c == 'd') || (c == 'D')) + { + opt_extractdir = 1; + dirname = argv[i+1]; + } + + if (((c == 'p') || (c == 'P')) && (i+1 < argc)) + { + password = argv[i+1]; + i++; + } + } + } + else + { + if (zipfilename == NULL) + zipfilename = argv[i]; + else if ((filename_to_extract == NULL) && (!opt_extractdir)) + filename_to_extract = argv[i]; + } + } + + /* Open zip file */ + if (zipfilename != NULL) + { +#ifdef USEWIN32IOAPI + zlib_filefunc64_def ffunc; + fill_win32_filefunc64A(&ffunc); + uf = unzOpen2_64(zipfilename, &ffunc); +#else + uf = unzOpen64(zipfilename); +#endif + } + + if (uf == NULL) + { + printf(""Cannot open %s\n"", zipfilename); + return 1; + } + + printf(""%s opened\n"", zipfilename); + + /* Process command line options */ + if (opt_do_list == 1) + { + ret = do_list(uf); + } + else if (opt_do_extract == 1) + { + if (opt_extractdir && CHDIR(dirname)) + { + printf(""Error changing into %s, aborting\n"", dirname); + exit(-1); + } + + if (filename_to_extract == NULL) + ret = do_extract_all(uf, opt_do_extract_withoutpath, opt_overwrite, password); + else + ret = do_extract_onefile(uf, filename_to_extract, opt_do_extract_withoutpath, opt_overwrite, password); + } + + unzClose(uf); + return ret; +} +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/zip.c",".c","74816","2047","/* zip.c -- IO on .zip files using zlib + Version 1.1, February 14h, 2010 + part of the MiniZip project + + Copyright (C) 1998-2010 Gilles Vollant + http://www.winimage.com/zLibDll/minizip.html + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson + http://result42.com + Modifications for AES, PKWARE disk spanning + Copyright (C) 2010-2014 Nathan Moinvaziri + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. +*/ + +#include +#include +#include +#include +#include ""zlib.h"" +#include ""zip.h"" + +#ifdef STDC +# include +# include +# include +#endif +#ifdef NO_ERRNO_H + extern int errno; +#else +# include +#endif + +#ifdef HAVE_AES +# define AES_METHOD (99) +# define AES_PWVERIFYSIZE (2) +# define AES_AUTHCODESIZE (10) +# define AES_MAXSALTLENGTH (16) +# define AES_VERSION (0x0001) +# define AES_ENCRYPTIONMODE (0x03) + +# include ""aes/aes.h"" +# include ""aes/fileenc.h"" +# include ""aes/prng.h"" +# include ""aes/entropy.h"" +#endif + +#ifndef NOCRYPT +# define INCLUDECRYPTINGCODE_IFCRYPTALLOWED +# include ""crypt.h"" +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +#define SIZEDATA_INDATABLOCK (4096-(4*4)) + +#define DISKHEADERMAGIC (0x08074b50) +#define LOCALHEADERMAGIC (0x04034b50) +#define CENTRALHEADERMAGIC (0x02014b50) +#define ENDHEADERMAGIC (0x06054b50) +#define ZIP64ENDHEADERMAGIC (0x06064b50) +#define ZIP64ENDLOCHEADERMAGIC (0x07064b50) + +#define FLAG_LOCALHEADER_OFFSET (0x06) +#define CRC_LOCALHEADER_OFFSET (0x0e) + +#define SIZECENTRALHEADER (0x2e) /* 46 */ +#define SIZECENTRALHEADERLOCATOR (0x14) /* 20 */ +#define SIZECENTRALDIRITEM (0x2e) +#define SIZEZIPLOCALHEADER (0x1e) + +#ifndef BUFREADCOMMENT +# define BUFREADCOMMENT (0x400) +#endif +#ifndef VERSIONMADEBY +# define VERSIONMADEBY (0x0) /* platform dependent */ +#endif + +#ifndef Z_BUFSIZE +# define Z_BUFSIZE (64*1024) +#endif +#ifndef Z_MAXFILENAMEINZIP +# define Z_MAXFILENAMEINZIP (256) +#endif + +#ifndef ALLOC +# define ALLOC(size) (malloc(size)) +#endif +#ifndef TRYFREE +# define TRYFREE(p) {if (p) free(p);} +#endif + +/* NOT sure that this work on ALL platform */ +#define MAKEULONG64(a, b) ((ZPOS64_T)(((unsigned long)(a)) | ((ZPOS64_T)((unsigned long)(b))) << 32)) + +#ifndef DEF_MEM_LEVEL +# if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +# else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +# endif +#endif + +const char zip_copyright[] = "" zip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll""; + +typedef struct linkedlist_datablock_internal_s +{ + struct linkedlist_datablock_internal_s* next_datablock; + uLong avail_in_this_block; + uLong filled_in_this_block; + uLong unused; /* for future use and alignment */ + unsigned char data[SIZEDATA_INDATABLOCK]; +} linkedlist_datablock_internal; + +typedef struct linkedlist_data_s +{ + linkedlist_datablock_internal* first_block; + linkedlist_datablock_internal* last_block; +} linkedlist_data; + +typedef struct +{ + z_stream stream; /* zLib stream structure for inflate */ +#ifdef HAVE_BZIP2 + bz_stream bstream; /* bzLib stream structure for bziped */ +#endif +#ifdef HAVE_AES + fcrypt_ctx aes_ctx; + prng_ctx aes_rng[1]; +#endif + int stream_initialised; /* 1 is stream is initialized */ + uInt pos_in_buffered_data; /* last written byte in buffered_data */ + + ZPOS64_T pos_local_header; /* offset of the local header of the file currently writing */ + char* central_header; /* central header data for the current file */ + uLong size_centralextra; + uLong size_centralheader; /* size of the central header for cur file */ + uLong size_centralextrafree; /* Extra bytes allocated to the central header but that are not used */ + uLong size_comment; + uLong flag; /* flag of the file currently writing */ + + int method; /* compression method written to file.*/ + int compression_method; /* compression method to use */ + int raw; /* 1 for directly writing raw data */ + Byte buffered_data[Z_BUFSIZE]; /* buffer contain compressed data to be writ*/ + uLong dosDate; + uLong crc32; + int zip64; /* Add ZIP64 extended information in the extra field */ + uLong number_disk; /* number of current disk used for spanning ZIP */ + ZPOS64_T pos_zip64extrainfo; + ZPOS64_T total_compressed; + ZPOS64_T total_uncompressed; +#ifndef NOCRYPT + unsigned int keys[3]; /* keys defining the pseudo-random sequence */ + const unsigned int* pcrc_32_tab; + int crypt_header_size; +#endif +} curfile64_info; + +typedef struct +{ + zlib_filefunc64_32_def z_filefunc; + voidpf filestream; /* io structure of the zipfile */ + voidpf filestream_with_CD; /* io structure of the zipfile with the central dir */ + linkedlist_data central_dir; /* datablock with central dir in construction*/ + int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/ + int append; /* append mode */ + curfile64_info ci; /* info on the file currently writing */ + + ZPOS64_T begin_pos; /* position of the beginning of the zipfile */ + ZPOS64_T add_position_when_writting_offset; + ZPOS64_T number_entry; + ZPOS64_T disk_size; /* size of each disk */ + uLong number_disk; /* number of the current disk, used for spanning ZIP */ + uLong number_disk_with_CD; /* number the the disk with central dir, used for spanning ZIP */ +#ifndef NO_ADDFILEINEXISTINGZIP + char *globalcomment; +#endif +} zip64_internal; + +/* Allocate a new data block */ +local linkedlist_datablock_internal* allocate_new_datablock OF(()); +local linkedlist_datablock_internal* allocate_new_datablock() +{ + linkedlist_datablock_internal* ldi; + + ldi = (linkedlist_datablock_internal*)ALLOC(sizeof(linkedlist_datablock_internal)); + + if (ldi != NULL) + { + ldi->next_datablock = NULL; + ldi->filled_in_this_block = 0; + ldi->avail_in_this_block = SIZEDATA_INDATABLOCK; + } + return ldi; +} + +/* Free data block in linked list */ +local void free_datablock OF((linkedlist_datablock_internal* ldi)); +local void free_datablock(linkedlist_datablock_internal* ldi) +{ + while (ldi != NULL) + { + linkedlist_datablock_internal* ldinext = ldi->next_datablock; + TRYFREE(ldi); + ldi = ldinext; + } +} + +/* Initialize linked list */ +local void init_linkedlist OF((linkedlist_data* ll)); +local void init_linkedlist(linkedlist_data* ll) +{ + ll->first_block = ll->last_block = NULL; +} + +/* Free entire linked list and all data blocks */ +local void free_linkedlist OF((linkedlist_data* ll)); +local void free_linkedlist(linkedlist_data* ll) +{ + free_datablock(ll->first_block); + ll->first_block = ll->last_block = NULL; +} + +/* Add data to linked list data block */ +local int add_data_in_datablock OF((linkedlist_data* ll, const void* buf, uLong len)); +local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) +{ + linkedlist_datablock_internal* ldi; + const unsigned char* from_copy; + + if (ll == NULL) + return ZIP_INTERNALERROR; + + if (ll->last_block == NULL) + { + ll->first_block = ll->last_block = allocate_new_datablock(); + if (ll->first_block == NULL) + return ZIP_INTERNALERROR; + } + + ldi = ll->last_block; + from_copy = (unsigned char*)buf; + + while (len > 0) + { + uInt copy_this; + uInt i; + unsigned char* to_copy; + + if (ldi->avail_in_this_block == 0) + { + ldi->next_datablock = allocate_new_datablock(); + if (ldi->next_datablock == NULL) + return ZIP_INTERNALERROR; + ldi = ldi->next_datablock ; + ll->last_block = ldi; + } + + if (ldi->avail_in_this_block < len) + copy_this = (uInt)ldi->avail_in_this_block; + else + copy_this = (uInt)len; + + to_copy = &(ldi->data[ldi->filled_in_this_block]); + + for (i = 0; i < copy_this; i++) + *(to_copy+i) = *(from_copy+i); + + ldi->filled_in_this_block += copy_this; + ldi->avail_in_this_block -= copy_this; + from_copy += copy_this; + len -= copy_this; + } + return ZIP_OK; +} + +local uLong zip64local_TmzDateToDosDate OF((const tm_zip* ptm)); +local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) +{ + uLong year; +#define zip64local_in_range(min, max, value) ((min) <= (value) && (value) <= (max)) + /* Years supported: + * [00, 79] (assumed to be between 2000 and 2079) + * [80, 207] (assumed to be between 1980 and 2107, typical output of old + software that does 'year-1900' to get a double digit year) + * [1980, 2107] + Due to the date format limitations, only years between 1980 and 2107 can be stored. + */ + if (!(zip64local_in_range(1980, 2107, ptm->tm_year) || zip64local_in_range(0, 207, ptm->tm_year)) || + !zip64local_in_range(0, 11, ptm->tm_mon) || + !zip64local_in_range(1, 31, ptm->tm_mday) || + !zip64local_in_range(0, 23, ptm->tm_hour) || + !zip64local_in_range(0, 59, ptm->tm_min) || + !zip64local_in_range(0, 59, ptm->tm_sec)) + return 0; +#undef zip64local_in_range + + year = (uLong)ptm->tm_year; + if (year >= 1980) /* range [1980, 2107] */ + year -= 1980; + else if (year >= 80) /* range [80, 99] */ + year -= 80; + else /* range [00, 79] */ + year += 20; + + return (uLong)(((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) | + ((ptm->tm_sec / 2) + (32 * ptm->tm_min) + (2048 * (uLong)ptm->tm_hour)); +} + +/* Inputs a long in LSB order to the given file: nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T) */ +local int zip64local_putValue OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, + ZPOS64_T x, int nbByte)); +local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, + ZPOS64_T x, int nbByte) +{ + unsigned char buf[8]; + int n; + for (n = 0; n < nbByte; n++) + { + buf[n] = (unsigned char)(x & 0xff); + x >>= 8; + } + if (x != 0) + { + /* Data overflow - hack for ZIP64 (X Roche) */ + for (n = 0; n < nbByte; n++) + { + buf[n] = 0xff; + } + } + + if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte) + return ZIP_ERRNO; + + return ZIP_OK; +} + +local ZPOS64_T zip64local_getValue_frommemory OF((void* src, int nbByte)); +local ZPOS64_T zip64local_getValue_frommemory (void* src, int nbByte) +{ + ZPOS64_T x = 0; + unsigned char* buf =(unsigned char*)src; + int n; + for (n = 0; n < nbByte; n++) { + x <<= 8; + x |= buf[nbByte - n - 1]; + } + return x; +} + +local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte)); +local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) +{ + unsigned char* buf =(unsigned char*)dest; + int n; + for (n = 0; n < nbByte; n++) { + buf[n] = (unsigned char)(x & 0xff); + x >>= 8; + } + + if (x != 0) + { + /* data overflow - hack for ZIP64 */ + for (n = 0; n < nbByte; n++) + { + buf[n] = 0xff; + } + } +} + +local int zip64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)); +local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi) +{ + unsigned char c; + int err = (int)ZREAD64(*pzlib_filefunc_def, filestream, &c,1); + if (err == 1) + { + *pi = (int)c; + return ZIP_OK; + } + if (ZERROR64(*pzlib_filefunc_def, filestream)) + return ZIP_ERRNO; + return ZIP_EOF; +} + +local int zip64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX)); +local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) +{ + uLong x; + int i = 0; + int err; + + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x = (uLong)i; + if (err == ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x += ((uLong)i) << 8; + + if (err == ZIP_OK) + *pX = x; + else + *pX = 0; + return err; +} + +local int zip64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX)); +local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) +{ + uLong x; + int i = 0; + int err; + + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x = (uLong)i; + if (err == ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x += ((uLong)i) << 8; + if (err == ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x += ((uLong)i) << 16; + if (err == ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x += ((uLong)i) << 24; + + if (err == ZIP_OK) + *pX = x; + else + *pX = 0; + return err; +} + +local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)); +local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) +{ + ZPOS64_T x; + int i = 0; + int err; + + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x = (ZPOS64_T)i; + if (err == ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x += ((ZPOS64_T)i) << 8; + if (err == ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x += ((ZPOS64_T)i) << 16; + if (err == ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x += ((ZPOS64_T)i) << 24; + if (err == ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x += ((ZPOS64_T)i) << 32; + if (err == ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x += ((ZPOS64_T)i) << 40; + if (err == ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x += ((ZPOS64_T)i) << 48; + if (err == ZIP_OK) + err = zip64local_getByte(pzlib_filefunc_def, filestream, &i); + x += ((ZPOS64_T)i) << 56; + + if (err == ZIP_OK) + *pX = x; + else + *pX = 0; + + return err; +} + +/* Gets the amount of bytes left to write to the current disk for spanning archives */ +local int zipGetDiskSizeAvailable OF((zipFile file, ZPOS64_T *size_available)); +local int zipGetDiskSizeAvailable(zipFile file, ZPOS64_T *size_available) +{ + zip64_internal* zi; + ZPOS64_T current_disk_size; + + zi = (zip64_internal*)file; + ZSEEK64(zi->z_filefunc, zi->filestream, 0, ZLIB_FILEFUNC_SEEK_END); + current_disk_size = ZTELL64(zi->z_filefunc, zi->filestream); + *size_available = zi->disk_size - current_disk_size; + return ZIP_OK; +} + +/* Goes to a specific disk number for spanning archives */ +local int zipGoToSpecificDisk OF((zipFile file, int number_disk, int open_existing)); +local int zipGoToSpecificDisk(zipFile file, int number_disk, int open_existing) +{ + zip64_internal* zi; + int err = ZIP_OK; + + zi = (zip64_internal*)file; + if (zi->disk_size == 0) + return err; + + if ((zi->filestream != NULL) && (zi->filestream != zi->filestream_with_CD)) + ZCLOSE64(zi->z_filefunc, zi->filestream); + + zi->filestream = ZOPENDISK64(zi->z_filefunc, zi->filestream_with_CD, number_disk, (open_existing == 1) ? + (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING) : + (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE)); + + if (zi->filestream == NULL) + err = ZIP_ERRNO; + + return err; +} + +/* Goes to the first disk in a spanned archive */ +local int zipGoToFirstDisk OF((zipFile file)); +local int zipGoToFirstDisk(zipFile file) +{ + zip64_internal* zi; + int number_disk_next; + int err = ZIP_OK; + + zi = (zip64_internal*)file; + + if (zi->disk_size == 0) + return err; + number_disk_next = 0; + if (zi->number_disk_with_CD > 0) + number_disk_next = zi->number_disk_with_CD - 1; + err = zipGoToSpecificDisk(file, number_disk_next, (zi->append == APPEND_STATUS_ADDINZIP)); + if ((err == ZIP_ERRNO) && (zi->append == APPEND_STATUS_ADDINZIP)) + err = zipGoToSpecificDisk(file, number_disk_next, 0); + if (err == ZIP_OK) + zi->number_disk = number_disk_next; + ZSEEK64(zi->z_filefunc, zi->filestream, 0, ZLIB_FILEFUNC_SEEK_END); + return err; +} + +/* Goes to the next disk in a spanned archive */ +local int zipGoToNextDisk OF((zipFile file)); +local int zipGoToNextDisk(zipFile file) +{ + zip64_internal* zi; + ZPOS64_T size_available_in_disk; + int err = ZIP_OK; + int number_disk_next; + + zi = (zip64_internal*)file; + + if (zi->disk_size == 0) + return err; + + number_disk_next = zi->number_disk + 1; + + do + { + err = zipGoToSpecificDisk(file, number_disk_next, (zi->append == APPEND_STATUS_ADDINZIP)); + if ((err == ZIP_ERRNO) && (zi->append == APPEND_STATUS_ADDINZIP)) + err = zipGoToSpecificDisk(file, number_disk_next, 0); + if (err != ZIP_OK) + break; + err = zipGetDiskSizeAvailable(file, &size_available_in_disk); + if (err != ZIP_OK) + break; + zi->number_disk = number_disk_next; + zi->number_disk_with_CD = zi->number_disk + 1; + + number_disk_next += 1; + } + while (size_available_in_disk <= 0); + + return err; +} + +/* Locate the Central directory of a zipfile (at the end, just before the global comment) */ +local ZPOS64_T zip64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); +local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) +{ + unsigned char* buf; + ZPOS64_T file_size; + ZPOS64_T back_read = 4; + ZPOS64_T max_back=0xffff; /* maximum size of global comment */ + ZPOS64_T pos_found=0; + uLong read_size; + ZPOS64_T read_pos; + int i; + + buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); + if (buf == NULL) + return 0; + + if (ZSEEK64(*pzlib_filefunc_def, filestream, 0, ZLIB_FILEFUNC_SEEK_END) != 0) + { + TRYFREE(buf); + return 0; + } + + file_size = ZTELL64(*pzlib_filefunc_def, filestream); + + if (max_back > file_size) + max_back = file_size; + + while (back_read < max_back) + { + if (back_read + BUFREADCOMMENT > max_back) + back_read = max_back; + else + back_read += BUFREADCOMMENT; + + read_pos = file_size-back_read; + read_size = ((BUFREADCOMMENT+4) < (file_size-read_pos)) ? + (BUFREADCOMMENT+4) : (uLong)(file_size-read_pos); + + if (ZSEEK64(*pzlib_filefunc_def, filestream, read_pos, ZLIB_FILEFUNC_SEEK_SET) != 0) + break; + if (ZREAD64(*pzlib_filefunc_def, filestream, buf, read_size) != read_size) + break; + + for (i = (int)read_size-3; (i--) > 0;) + if ((*(buf+i)) == (ENDHEADERMAGIC & 0xff) && + (*(buf+i+1)) == (ENDHEADERMAGIC >> 8 & 0xff) && + (*(buf+i+2)) == (ENDHEADERMAGIC >> 16 & 0xff) && + (*(buf+i+3)) == (ENDHEADERMAGIC >> 24 & 0xff)) + { + pos_found = read_pos+i; + break; + } + + if (pos_found != 0) + break; + } + TRYFREE(buf); + return pos_found; +} + +/* Locate the Central directory 64 of a zipfile (at the end, just before the global comment) */ +local ZPOS64_T zip64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, + const ZPOS64_T endcentraloffset)); +local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, + const ZPOS64_T endcentraloffset) +{ + ZPOS64_T offset; + uLong uL; + + /* Zip64 end of central directory locator */ + if (ZSEEK64(*pzlib_filefunc_def, filestream, endcentraloffset - SIZECENTRALHEADERLOCATOR, ZLIB_FILEFUNC_SEEK_SET) != 0) + return 0; + + /* Read locator signature */ + if (zip64local_getLong(pzlib_filefunc_def, filestream, &uL) != ZIP_OK) + return 0; + if (uL != ZIP64ENDLOCHEADERMAGIC) + return 0; + /* Number of the disk with the start of the zip64 end of central directory */ + if (zip64local_getLong(pzlib_filefunc_def, filestream, &uL) != ZIP_OK) + return 0; + /* Relative offset of the zip64 end of central directory record */ + if (zip64local_getLong64(pzlib_filefunc_def, filestream, &offset) != ZIP_OK) + return 0; + /* Total number of disks */ + if (zip64local_getLong(pzlib_filefunc_def, filestream, &uL) != ZIP_OK) + return 0; + /* Goto end of central directory record */ + if (ZSEEK64(*pzlib_filefunc_def,filestream, offset, ZLIB_FILEFUNC_SEEK_SET) != 0) + return 0; + /* The signature */ + if (zip64local_getLong(pzlib_filefunc_def, filestream, &uL) != ZIP_OK) + return 0; + if (uL != ZIP64ENDHEADERMAGIC) + return 0; + + return offset; +} + +extern zipFile ZEXPORT zipOpen4(const void *pathname, int append, ZPOS64_T disk_size, const char ** globalcomment, + zlib_filefunc64_32_def* pzlib_filefunc64_32_def) +{ + zip64_internal ziinit; + zip64_internal* zi; +#ifndef NO_ADDFILEINEXISTINGZIP + ZPOS64_T byte_before_the_zipfile; /* byte before the zipfile, (>0 for sfx)*/ + ZPOS64_T size_central_dir; /* size of the central directory */ + ZPOS64_T offset_central_dir; /* offset of start of central directory */ + ZPOS64_T number_entry_CD; /* total number of entries in the central dir */ + ZPOS64_T number_entry; + ZPOS64_T central_pos; + ZPOS64_T size_central_dir_to_read; + uLong uL; + uLong size_comment; + size_t buf_size = SIZEDATA_INDATABLOCK; + void* buf_read; +#endif + int err = ZIP_OK; + int mode; + + ziinit.z_filefunc.zseek32_file = NULL; + ziinit.z_filefunc.ztell32_file = NULL; + if (pzlib_filefunc64_32_def == NULL) + fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64); + else + ziinit.z_filefunc = *pzlib_filefunc64_32_def; + + if (append == APPEND_STATUS_CREATE) + mode = (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE); + else + mode = (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING); + + ziinit.filestream = ZOPEN64(ziinit.z_filefunc, pathname, mode); + if (ziinit.filestream == NULL) + return NULL; + + if (append == APPEND_STATUS_CREATEAFTER) + { + /* Don't support spanning ZIP with APPEND_STATUS_CREATEAFTER */ + if (disk_size > 0) + return NULL; + + ZSEEK64(ziinit.z_filefunc,ziinit.filestream,0,SEEK_END); + } + + ziinit.filestream_with_CD = ziinit.filestream; + ziinit.append = append; + ziinit.number_disk = 0; + ziinit.number_disk_with_CD = 0; + ziinit.disk_size = disk_size; + ziinit.begin_pos = ZTELL64(ziinit.z_filefunc,ziinit.filestream); + ziinit.in_opened_file_inzip = 0; + ziinit.ci.stream_initialised = 0; + ziinit.number_entry = 0; + ziinit.add_position_when_writting_offset = 0; + init_linkedlist(&(ziinit.central_dir)); + + zi = (zip64_internal*)ALLOC(sizeof(zip64_internal)); + if (zi == NULL) + { + ZCLOSE64(ziinit.z_filefunc,ziinit.filestream); + return NULL; + } + +#ifndef NO_ADDFILEINEXISTINGZIP + /* Add file in a zipfile */ + ziinit.globalcomment = NULL; + if (append == APPEND_STATUS_ADDINZIP) + { + /* Read and Cache Central Directory Records */ + central_pos = zip64local_SearchCentralDir(&ziinit.z_filefunc,ziinit.filestream); + /* Disable to allow appending to empty ZIP archive (must be standard zip, not zip64) + if (central_pos == 0) + err = ZIP_ERRNO; + */ + + if (err == ZIP_OK) + { + /* Read end of central directory info */ + if (ZSEEK64(ziinit.z_filefunc, ziinit.filestream, central_pos,ZLIB_FILEFUNC_SEEK_SET) != 0) + err = ZIP_ERRNO; + + /* The signature, already checked */ + if (zip64local_getLong(&ziinit.z_filefunc, ziinit.filestream, &uL) != ZIP_OK) + err = ZIP_ERRNO; + /* Number of this disk */ + if (zip64local_getShort(&ziinit.z_filefunc, ziinit.filestream, &ziinit.number_disk) != ZIP_OK) + err = ZIP_ERRNO; + /* Number of the disk with the start of the central directory */ + if (zip64local_getShort(&ziinit.z_filefunc, ziinit.filestream, &ziinit.number_disk_with_CD) != ZIP_OK) + err = ZIP_ERRNO; + /* Total number of entries in the central dir on this disk */ + number_entry = 0; + if (zip64local_getShort(&ziinit.z_filefunc, ziinit.filestream, &uL) != ZIP_OK) + err = ZIP_ERRNO; + else + number_entry = uL; + /* Total number of entries in the central dir */ + number_entry_CD = 0; + if (zip64local_getShort(&ziinit.z_filefunc, ziinit.filestream, &uL) != ZIP_OK) + err = ZIP_ERRNO; + else + number_entry_CD = uL; + if (number_entry_CD!=number_entry) + err = ZIP_BADZIPFILE; + /* Size of the central directory */ + size_central_dir = 0; + if (zip64local_getLong(&ziinit.z_filefunc, ziinit.filestream, &uL) != ZIP_OK) + err = ZIP_ERRNO; + else + size_central_dir = uL; + /* Offset of start of central directory with respect to the starting disk number */ + offset_central_dir = 0; + if (zip64local_getLong(&ziinit.z_filefunc, ziinit.filestream, &uL) != ZIP_OK) + err = ZIP_ERRNO; + else + offset_central_dir = uL; + /* Zipfile global comment length */ + if (zip64local_getShort(&ziinit.z_filefunc, ziinit.filestream, &size_comment) != ZIP_OK) + err = ZIP_ERRNO; + + if ((err == ZIP_OK) && ((number_entry_CD == 0xffff) || (offset_central_dir == 0xffffffff))) + { + /* Format should be Zip64, as the central directory or file size is too large */ + central_pos = zip64local_SearchCentralDir64(&ziinit.z_filefunc, ziinit.filestream, central_pos); + + if (central_pos) + { + ZPOS64_T sizeEndOfCentralDirectory; + + if (ZSEEK64(ziinit.z_filefunc, ziinit.filestream, central_pos, ZLIB_FILEFUNC_SEEK_SET) != 0) + err = ZIP_ERRNO; + + /* The signature, already checked */ + if (zip64local_getLong(&ziinit.z_filefunc, ziinit.filestream, &uL) != ZIP_OK) + err = ZIP_ERRNO; + /* Size of zip64 end of central directory record */ + if (zip64local_getLong64(&ziinit.z_filefunc, ziinit.filestream, &sizeEndOfCentralDirectory) != ZIP_OK) + err = ZIP_ERRNO; + /* Version made by */ + if (zip64local_getShort(&ziinit.z_filefunc, ziinit.filestream, &uL) != ZIP_OK) + err = ZIP_ERRNO; + /* Version needed to extract */ + if (zip64local_getShort(&ziinit.z_filefunc, ziinit.filestream, &uL) != ZIP_OK) + err = ZIP_ERRNO; + /* Number of this disk */ + if (zip64local_getLong(&ziinit.z_filefunc, ziinit.filestream, &ziinit.number_disk) != ZIP_OK) + err = ZIP_ERRNO; + /* Number of the disk with the start of the central directory */ + if (zip64local_getLong(&ziinit.z_filefunc, ziinit.filestream, &ziinit.number_disk_with_CD) != ZIP_OK) + err = ZIP_ERRNO; + /* Total number of entries in the central directory on this disk */ + if (zip64local_getLong64(&ziinit.z_filefunc, ziinit.filestream, &number_entry) != ZIP_OK) + err = ZIP_ERRNO; + /* Total number of entries in the central directory */ + if (zip64local_getLong64(&ziinit.z_filefunc, ziinit.filestream, &number_entry_CD) != ZIP_OK) + err = ZIP_ERRNO; + if (number_entry_CD!=number_entry) + err = ZIP_BADZIPFILE; + /* Size of the central directory */ + if (zip64local_getLong64(&ziinit.z_filefunc, ziinit.filestream, &size_central_dir) != ZIP_OK) + err = ZIP_ERRNO; + /* Offset of start of central directory with respect to the starting disk number */ + if (zip64local_getLong64(&ziinit.z_filefunc, ziinit.filestream, &offset_central_dir) != ZIP_OK) + err = ZIP_ERRNO; + } + else + err = ZIP_BADZIPFILE; + } + } + + if ((err == ZIP_OK) && (central_pos 0) + { + ziinit.globalcomment = (char*)ALLOC(size_comment+1); + if (ziinit.globalcomment) + { + size_comment = ZREAD64(ziinit.z_filefunc, ziinit.filestream, ziinit.globalcomment, size_comment); + ziinit.globalcomment[size_comment] = 0; + } + } + + byte_before_the_zipfile = central_pos - (offset_central_dir+size_central_dir); + ziinit.add_position_when_writting_offset = byte_before_the_zipfile; + + /* Store central directory in memory */ + size_central_dir_to_read = size_central_dir; + buf_size = SIZEDATA_INDATABLOCK; + buf_read = (void*)ALLOC(buf_size); + + if (ZSEEK64(ziinit.z_filefunc, ziinit.filestream, + offset_central_dir + byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0) + err = ZIP_ERRNO; + + while ((size_central_dir_to_read > 0) && (err == ZIP_OK)) + { + ZPOS64_T read_this = SIZEDATA_INDATABLOCK; + if (read_this > size_central_dir_to_read) + read_this = size_central_dir_to_read; + + if (ZREAD64(ziinit.z_filefunc, ziinit.filestream, buf_read, (uLong)read_this) != read_this) + err = ZIP_ERRNO; + + if (err == ZIP_OK) + err = add_data_in_datablock(&ziinit.central_dir, buf_read, (uLong)read_this); + + size_central_dir_to_read -= read_this; + } + TRYFREE(buf_read); + + ziinit.begin_pos = byte_before_the_zipfile; + ziinit.number_entry = number_entry_CD; + + if (ZSEEK64(ziinit.z_filefunc, ziinit.filestream, + offset_central_dir+byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0) + err = ZIP_ERRNO; + } + + if (globalcomment) + *globalcomment = ziinit.globalcomment; +#endif + + if (err != ZIP_OK) + { +#ifndef NO_ADDFILEINEXISTINGZIP + TRYFREE(ziinit.globalcomment); +#endif + TRYFREE(zi); + return NULL; + } + + *zi = ziinit; + zipGoToFirstDisk((zipFile)zi); + return(zipFile)zi; +} + +extern zipFile ZEXPORT zipOpen2(const char *pathname, int append, const char ** globalcomment, + zlib_filefunc_def* pzlib_filefunc32_def) +{ + if (pzlib_filefunc32_def != NULL) + { + zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; + fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def); + return zipOpen4(pathname, append, 0, globalcomment, &zlib_filefunc64_32_def_fill); + } + return zipOpen4(pathname, append, 0, globalcomment, NULL); +} + +extern zipFile ZEXPORT zipOpen2_64(const void *pathname, int append, const char ** globalcomment, + zlib_filefunc64_def* pzlib_filefunc_def) +{ + if (pzlib_filefunc_def != NULL) + { + zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; + zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def; + zlib_filefunc64_32_def_fill.ztell32_file = NULL; + zlib_filefunc64_32_def_fill.zseek32_file = NULL; + return zipOpen4(pathname, append, 0, globalcomment, &zlib_filefunc64_32_def_fill); + } + return zipOpen4(pathname, append, 0, globalcomment, NULL); +} + +extern zipFile ZEXPORT zipOpen3(const char *pathname, int append, ZPOS64_T disk_size, const char ** globalcomment, + zlib_filefunc_def* pzlib_filefunc32_def) +{ + if (pzlib_filefunc32_def != NULL) + { + zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; + fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def); + return zipOpen4(pathname, append, disk_size, globalcomment, &zlib_filefunc64_32_def_fill); + } + return zipOpen4(pathname, append, disk_size, globalcomment, NULL); +} + +extern zipFile ZEXPORT zipOpen3_64(const void *pathname, int append, ZPOS64_T disk_size, const char ** globalcomment, + zlib_filefunc64_def* pzlib_filefunc_def) +{ + if (pzlib_filefunc_def != NULL) + { + zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; + zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def; + zlib_filefunc64_32_def_fill.ztell32_file = NULL; + zlib_filefunc64_32_def_fill.zseek32_file = NULL; + return zipOpen4(pathname, append, disk_size, globalcomment, &zlib_filefunc64_32_def_fill); + } + return zipOpen4(pathname, append, disk_size, globalcomment, NULL); +} + +extern zipFile ZEXPORT zipOpen(const char* pathname, int append) +{ + return zipOpen3((const void*)pathname,append,0,NULL,NULL); +} + +extern zipFile ZEXPORT zipOpen64(const void* pathname, int append) +{ + return zipOpen3(pathname,append,0,NULL,NULL); +} + +extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits, int memLevel, + int strategy, const char* password, uLong crcForCrypting, uLong versionMadeBy, uLong flagBase, int zip64) +{ + zip64_internal* zi; + uInt size_filename; + uInt size_comment = 0; + uInt i; + int err = ZIP_OK; + ZPOS64_T size_available; + ZPOS64_T size_needed; + +#ifdef NOCRYPT + (crcForCrypting); + if (password != NULL) + return ZIP_PARAMERROR; +#endif + + if (file == NULL) + return ZIP_PARAMERROR; + + if ((method != 0) && +#ifdef HAVE_BZIP2 + (method != Z_BZIP2ED) && +#endif + (method != Z_DEFLATED)) + return ZIP_PARAMERROR; + + zi = (zip64_internal*)file; + + if (zi->in_opened_file_inzip == 1) + { + err = zipCloseFileInZip (file); + if (err != ZIP_OK) + return err; + } + + if (filename == NULL) + filename = ""-""; + if (comment != NULL) + size_comment = (uInt)strlen(comment); + + size_filename = (uInt)strlen(filename); + + if (zipfi == NULL) + zi->ci.dosDate = 0; + else + { + if (zipfi->dosDate != 0) + zi->ci.dosDate = zipfi->dosDate; + else + zi->ci.dosDate = zip64local_TmzDateToDosDate(&zipfi->tmz_date); + } + + zi->ci.method = method; + zi->ci.compression_method = method; + zi->ci.crc32 = 0; + zi->ci.stream_initialised = 0; + zi->ci.pos_in_buffered_data = 0; + zi->ci.raw = raw; + zi->ci.flag = flagBase; + if ((level == 8) || (level == 9)) + zi->ci.flag |= 2; + if (level == 2) + zi->ci.flag |= 4; + if (level == 1) + zi->ci.flag |= 6; + if (password != NULL) + { + zi->ci.flag |= 1; +#ifdef HAVE_AES + zi->ci.method = AES_METHOD; +#endif + } + + if (zi->disk_size > 0) + { + if ((zi->number_disk == 0) && (zi->number_entry == 0)) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)DISKHEADERMAGIC, 4); + + /* Make sure enough space available on current disk for local header */ + zipGetDiskSizeAvailable((zipFile)zi, &size_available); + size_needed = 30 + size_filename + size_extrafield_local; + if (zi->ci.zip64) + size_needed += 20; +#ifdef HAVE_AES + if (zi->ci.method == AES_METHOD) + size_needed += 11; +#endif + if (size_available < size_needed) + zipGoToNextDisk((zipFile)zi); + } + + zi->ci.pos_local_header = ZTELL64(zi->z_filefunc, zi->filestream); + zi->ci.size_comment = size_comment; + zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + size_extrafield_global; + zi->ci.size_centralextra = size_extrafield_global; + zi->ci.size_centralextrafree = 32; /* Extra space reserved for ZIP64 extra info */ +#ifdef HAVE_AES + if (zi->ci.method == AES_METHOD) + zi->ci.size_centralextrafree += 11; /* Extra space reserved for AES extra info */ +#endif + zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader + zi->ci.size_centralextrafree + size_comment); + zi->ci.number_disk = zi->number_disk; + + /* Write central directory header */ + zip64local_putValue_inmemory(zi->ci.central_header, (uLong)CENTRALHEADERMAGIC, 4); + zip64local_putValue_inmemory(zi->ci.central_header+4, (uLong)versionMadeBy, 2); + zip64local_putValue_inmemory(zi->ci.central_header+6, (uLong)20, 2); + zip64local_putValue_inmemory(zi->ci.central_header+8, (uLong)zi->ci.flag, 2); + zip64local_putValue_inmemory(zi->ci.central_header+10, (uLong)zi->ci.method, 2); + zip64local_putValue_inmemory(zi->ci.central_header+12, (uLong)zi->ci.dosDate, 4); + zip64local_putValue_inmemory(zi->ci.central_header+16, (uLong)0, 4); /*crc*/ + zip64local_putValue_inmemory(zi->ci.central_header+20, (uLong)0, 4); /*compr size*/ + zip64local_putValue_inmemory(zi->ci.central_header+24, (uLong)0, 4); /*uncompr size*/ + zip64local_putValue_inmemory(zi->ci.central_header+28, (uLong)size_filename, 2); + zip64local_putValue_inmemory(zi->ci.central_header+30, (uLong)size_extrafield_global, 2); + zip64local_putValue_inmemory(zi->ci.central_header+32, (uLong)size_comment, 2); + zip64local_putValue_inmemory(zi->ci.central_header+34, (uLong)zi->ci.number_disk, 2); /*disk nm start*/ + + if (zipfi == NULL) + zip64local_putValue_inmemory(zi->ci.central_header+36, (uLong)0, 2); + else + zip64local_putValue_inmemory(zi->ci.central_header+36, (uLong)zipfi->internal_fa, 2); + if (zipfi == NULL) + zip64local_putValue_inmemory(zi->ci.central_header+38, (uLong)0, 4); + else + zip64local_putValue_inmemory(zi->ci.central_header+38, (uLong)zipfi->external_fa, 4); + if (zi->ci.pos_local_header >= 0xffffffff) + zip64local_putValue_inmemory(zi->ci.central_header+42, (uLong)0xffffffff, 4); + else + zip64local_putValue_inmemory(zi->ci.central_header+42, + (uLong)zi->ci.pos_local_header - zi->add_position_when_writting_offset, 4); + + for (i = 0; i < size_filename; i++) + zi->ci.central_header[SIZECENTRALHEADER+i] = filename[i]; + for (i = 0; i < size_extrafield_global; i++) + zi->ci.central_header[SIZECENTRALHEADER+size_filename+i] = + ((const char*)extrafield_global)[i]; + /* Store comment at the end for later repositioning */ + for (i = 0; i < size_comment; i++) + zi->ci.central_header[zi->ci.size_centralheader+ + zi->ci.size_centralextrafree+i] = comment[i]; + + if (zi->ci.central_header == NULL) + return ZIP_INTERNALERROR; + + zi->ci.zip64 = zip64; + zi->ci.total_compressed = 0; + zi->ci.total_uncompressed = 0; + zi->ci.pos_zip64extrainfo = 0; + + /* Write the local header */ + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)LOCALHEADERMAGIC, 4); + + if (err == ZIP_OK) + { + if (zi->ci.zip64) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)45, 2); /* version needed to extract */ + else + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)20, 2); /* version needed to extract */ + } + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)zi->ci.flag, 2); + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)zi->ci.method, 2); + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)zi->ci.dosDate, 4); + + /* CRC & compressed size & uncompressed size will be filled in later and rewritten later */ + + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)0, 4); /* crc 32, unknown */ + if (err == ZIP_OK) + { + if (zi->ci.zip64) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)0xFFFFFFFF, 4); /* compressed size, unknown */ + else + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)0, 4); /* compressed size, unknown */ + } + if (err == ZIP_OK) + { + if (zi->ci.zip64) /* uncompressed size, unknown */ + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)0xFFFFFFFF, 4); + else /* uncompressed size, unknown */ + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)0, 4); + } + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)size_filename, 2); + if (err == ZIP_OK) + { + ZPOS64_T size_extrafield = size_extrafield_local; + if (zi->ci.zip64) + size_extrafield += 20; +#ifdef HAVE_AES + if (zi->ci.method == AES_METHOD) + size_extrafield += 11; +#endif + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)size_extrafield,2); + } + if ((err == ZIP_OK) && (size_filename > 0)) + { + if (ZWRITE64(zi->z_filefunc, zi->filestream, filename, size_filename) != size_filename) + err = ZIP_ERRNO; + } + if ((err == ZIP_OK) && (size_extrafield_local > 0)) + { + if (ZWRITE64(zi->z_filefunc, zi->filestream, extrafield_local, size_extrafield_local) != size_extrafield_local) + err = ZIP_ERRNO; + } + + /* Write the Zip64 extended info */ + if ((err == ZIP_OK) && (zi->ci.zip64)) + { + short headerid = 1; + short datasize = 16; + ZPOS64_T compressed_size = 0; + ZPOS64_T uncompressed_size = 0; + + /* Remember position of Zip64 extended info for the local file header. + (needed when we update size after done with file) */ + zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc, zi->filestream); + + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)headerid, 2); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)datasize, 2); + + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)uncompressed_size, 8); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)compressed_size, 8); + } +#ifdef HAVE_AES + /* Write the AES extended info */ + if ((err == ZIP_OK) && (zi->ci.method == AES_METHOD)) + { + int headerid = 0x9901; + short datasize = 7; + + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, headerid, 2); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, datasize, 2); + + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, AES_VERSION, 2); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, 'A', 1); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, 'E', 1); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, AES_ENCRYPTIONMODE, 1); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, zi->ci.compression_method, 2); + } +#endif + +#ifdef HAVE_BZIP2 + zi->ci.bstream.avail_in = (uInt)0; + zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE; + zi->ci.bstream.next_out = (char*)zi->ci.buffered_data; + zi->ci.bstream.total_in_hi32 = 0; + zi->ci.bstream.total_in_lo32 = 0; + zi->ci.bstream.total_out_hi32 = 0; + zi->ci.bstream.total_out_lo32 = 0; +#endif + + zi->ci.stream.avail_in = (uInt)0; + zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; + zi->ci.stream.next_out = zi->ci.buffered_data; + zi->ci.stream.total_in = 0; + zi->ci.stream.total_out = 0; + zi->ci.stream.data_type = Z_BINARY; + + if ((err == ZIP_OK) && (!zi->ci.raw)) + { + if (method == Z_DEFLATED) + { + zi->ci.stream.zalloc = (alloc_func)0; + zi->ci.stream.zfree = (free_func)0; + zi->ci.stream.opaque = (voidpf)zi; + + if (windowBits > 0) + windowBits = -windowBits; + + err = deflateInit2(&zi->ci.stream, level, Z_DEFLATED, windowBits, memLevel, strategy); + + if (err == Z_OK) + zi->ci.stream_initialised = Z_DEFLATED; + } + else if (method == Z_BZIP2ED) + { +#ifdef HAVE_BZIP2 + zi->ci.bstream.bzalloc = 0; + zi->ci.bstream.bzfree = 0; + zi->ci.bstream.opaque = (voidpf)0; + + err = BZ2_bzCompressInit(&zi->ci.bstream, level, 0, 35); + if (err == BZ_OK) + zi->ci.stream_initialised = Z_BZIP2ED; +#endif + } + } + +#ifndef NOCRYPT + zi->ci.crypt_header_size = 0; + if ((err == Z_OK) && ((zi->ci.flag & 1) != 0)) + { +#ifdef HAVE_AES + if (zi->ci.method == AES_METHOD) + { + unsigned char passverify[AES_PWVERIFYSIZE]; + unsigned char saltvalue[AES_MAXSALTLENGTH]; + uInt saltlength; + + if ((AES_ENCRYPTIONMODE < 1) || (AES_ENCRYPTIONMODE > 3)) + return Z_ERRNO; + + saltlength = SALT_LENGTH(AES_ENCRYPTIONMODE); + + prng_init(entropy_fun, zi->ci.aes_rng); + prng_rand(saltvalue, saltlength, zi->ci.aes_rng); + prng_end(zi->ci.aes_rng); + + fcrypt_init(AES_ENCRYPTIONMODE, password, strlen(password), saltvalue, passverify, &zi->ci.aes_ctx); + + if (ZWRITE64(zi->z_filefunc, zi->filestream, saltvalue, saltlength) != saltlength) + err = ZIP_ERRNO; + if (ZWRITE64(zi->z_filefunc, zi->filestream, passverify, AES_PWVERIFYSIZE) != AES_PWVERIFYSIZE) + err = ZIP_ERRNO; + + zi->ci.crypt_header_size = saltlength + AES_PWVERIFYSIZE + AES_AUTHCODESIZE; + } + else +#endif + { + unsigned char bufHead[RAND_HEAD_LEN]; + unsigned int sizeHead; + + zi->ci.pcrc_32_tab = (const unsigned int*)get_crc_table(); + /*init_keys(password, zi->ci.keys, zi->ci.pcrc_32_tab);*/ + + sizeHead = crypthead(password, bufHead, RAND_HEAD_LEN, zi->ci.keys, zi->ci.pcrc_32_tab, crcForCrypting); + zi->ci.crypt_header_size = sizeHead; + + if (ZWRITE64(zi->z_filefunc, zi->filestream, bufHead, sizeHead) != sizeHead) + err = ZIP_ERRNO; + } + } +#endif + + if (err == Z_OK) + zi->in_opened_file_inzip = 1; + return err; +} + +extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits, + int memLevel, int strategy, const char* password, uLong crcForCrypting, uLong versionMadeBy, uLong flagBase) +{ + return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, comment, method, level, raw, windowBits, memLevel, + strategy, password, crcForCrypting, versionMadeBy, flagBase, 0); +} + +extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits, + int memLevel, int strategy, const char* password, uLong crcForCrypting) +{ + return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, comment, method, level, raw, windowBits, memLevel, + strategy, password, crcForCrypting, VERSIONMADEBY, 0, 0); +} + +extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits, + int memLevel, int strategy, const char* password, uLong crcForCrypting, int zip64) +{ + return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, comment, method, level, raw, windowBits, memLevel, strategy, + password, crcForCrypting, VERSIONMADEBY, 0, zip64); +} + +extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int raw) +{ + return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, comment, method, level, raw, -MAX_WBITS, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY, NULL, 0, VERSIONMADEBY, 0, 0); +} + +extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int raw, int zip64) +{ + return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, comment, method, level, raw, -MAX_WBITS, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY, NULL, 0, VERSIONMADEBY, 0, zip64); +} + +extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void*extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int zip64) +{ + return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, comment, method, level, 0, -MAX_WBITS, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY, NULL, 0, VERSIONMADEBY, 0, zip64); +} + +extern int ZEXPORT zipOpenNewFileInZip(zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void*extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level) +{ + return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local, + extrafield_global, size_extrafield_global, comment, method, level, 0, -MAX_WBITS, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY, NULL, 0, VERSIONMADEBY, 0, 0); +} + +/* Flushes the write buffer to disk */ +local int zip64FlushWriteBuffer OF((zip64_internal* zi)); +local int zip64FlushWriteBuffer(zip64_internal* zi) +{ + int err = ZIP_OK; + uInt written = 0; + uInt total_written = 0; + uInt write = 0; + uInt max_write = 0; + ZPOS64_T size_available = 0; + + if ((zi->ci.flag & 1) != 0) + { +#ifndef NOCRYPT +#ifdef HAVE_AES + if (zi->ci.method == AES_METHOD) + { + fcrypt_encrypt(zi->ci.buffered_data, zi->ci.pos_in_buffered_data, &zi->ci.aes_ctx); + } + else +#endif + { + uInt i; + int t; + for (i = 0;i < zi->ci.pos_in_buffered_data; i++) + zi->ci.buffered_data[i] = zencode(zi->ci.keys, zi->ci.pcrc_32_tab, zi->ci.buffered_data[i],t); + } +#endif + } + + write = zi->ci.pos_in_buffered_data; + + do + { + max_write = write; + + if (zi->disk_size > 0) + { + err = zipGetDiskSizeAvailable((zipFile)zi, &size_available); + if (err != ZIP_OK) + return err; + + if (size_available == 0) + { + err = zipGoToNextDisk((zipFile)zi); + if (err != ZIP_OK) + return err; + } + + if (size_available < (ZPOS64_T)max_write) + max_write = (uInt)size_available; + } + + written = ZWRITE64(zi->z_filefunc, zi->filestream, zi->ci.buffered_data + total_written, max_write); + + if (ZERROR64(zi->z_filefunc, zi->filestream)) + { + err = ZIP_ERRNO; + break; + } + + total_written += written; + write -= written; + } + while (write > 0); + + zi->ci.total_compressed += zi->ci.pos_in_buffered_data; + +#ifdef HAVE_BZIP2 + if (zi->ci.compression_method == Z_BZIP2ED) + { + zi->ci.total_uncompressed += zi->ci.bstream.total_in_lo32; + zi->ci.bstream.total_in_lo32 = 0; + zi->ci.bstream.total_in_hi32 = 0; + } + else +#endif + { + zi->ci.total_uncompressed += zi->ci.stream.total_in; + zi->ci.stream.total_in = 0; + } + + zi->ci.pos_in_buffered_data = 0; + + return err; +} + +extern int ZEXPORT zipWriteInFileInZip(zipFile file,const void* buf,unsigned int len) +{ + zip64_internal* zi; + int err = ZIP_OK; + + if (file == NULL) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; + + if (zi->in_opened_file_inzip == 0) + return ZIP_PARAMERROR; + + zi->ci.crc32 = crc32(zi->ci.crc32, buf, (uInt)len); + +#ifdef HAVE_BZIP2 + if ((zi->ci.compression_method == Z_BZIP2ED) && (!zi->ci.raw)) + { + zi->ci.bstream.next_in = (void*)buf; + zi->ci.bstream.avail_in = len; + err = BZ_RUN_OK; + + while ((err == BZ_RUN_OK) && (zi->ci.bstream.avail_in > 0)) + { + if (zi->ci.bstream.avail_out == 0) + { + if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) + err = ZIP_ERRNO; + zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE; + zi->ci.bstream.next_out = (char*)zi->ci.buffered_data; + } + else + { + uLong uTotalOutBefore_lo = zi->ci.bstream.total_out_lo32; + uLong uTotalOutBefore_hi = zi->ci.bstream.total_out_hi32; + + err = BZ2_bzCompress(&zi->ci.bstream, BZ_RUN); + + zi->ci.pos_in_buffered_data += (uInt)(zi->ci.bstream.total_out_lo32 - uTotalOutBefore_lo); + } + } + + if (err == BZ_RUN_OK) + err = ZIP_OK; + } + else +#endif + { + zi->ci.stream.next_in = (Bytef*)buf; + zi->ci.stream.avail_in = len; + + while ((err == ZIP_OK) && (zi->ci.stream.avail_in > 0)) + { + if (zi->ci.stream.avail_out == 0) + { + if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) + err = ZIP_ERRNO; + zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; + zi->ci.stream.next_out = zi->ci.buffered_data; + } + + if (err != ZIP_OK) + break; + + if ((zi->ci.compression_method == Z_DEFLATED) && (!zi->ci.raw)) + { + uLong total_out_before = zi->ci.stream.total_out; + err = deflate(&zi->ci.stream, Z_NO_FLUSH); + zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - total_out_before); + } + else + { + uInt copy_this,i; + if (zi->ci.stream.avail_in < zi->ci.stream.avail_out) + copy_this = zi->ci.stream.avail_in; + else + copy_this = zi->ci.stream.avail_out; + + for (i = 0; i < copy_this; i++) + *(((char*)zi->ci.stream.next_out)+i) = + *(((const char*)zi->ci.stream.next_in)+i); + + zi->ci.stream.avail_in -= copy_this; + zi->ci.stream.avail_out -= copy_this; + zi->ci.stream.next_in += copy_this; + zi->ci.stream.next_out += copy_this; + zi->ci.stream.total_in += copy_this; + zi->ci.stream.total_out += copy_this; + zi->ci.pos_in_buffered_data += copy_this; + } + } + } + + return err; +} + +extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, uLong uncompressed_size, uLong crc32) +{ + return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32); +} + +extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32) +{ + zip64_internal* zi; + ZPOS64_T compressed_size; + uLong invalidValue = 0xffffffff; + uLong i = 0; + short datasize = 0; + int err = ZIP_OK; + + if (file == NULL) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; + + if (zi->in_opened_file_inzip == 0) + return ZIP_PARAMERROR; + zi->ci.stream.avail_in = 0; + + if (!zi->ci.raw) + { + if (zi->ci.compression_method == Z_DEFLATED) + { + while (err == ZIP_OK) + { + uLong total_out_before; + if (zi->ci.stream.avail_out == 0) + { + if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) + err = ZIP_ERRNO; + zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; + zi->ci.stream.next_out = zi->ci.buffered_data; + } + total_out_before = zi->ci.stream.total_out; + err = deflate(&zi->ci.stream, Z_FINISH); + zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - total_out_before); + } + } + else if (zi->ci.compression_method == Z_BZIP2ED) + { +#ifdef HAVE_BZIP2 + err = BZ_FINISH_OK; + while (err == BZ_FINISH_OK) + { + uLong total_out_before; + if (zi->ci.bstream.avail_out == 0) + { + if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) + err = ZIP_ERRNO; + zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE; + zi->ci.bstream.next_out = (char*)zi->ci.buffered_data; + } + total_out_before = zi->ci.bstream.total_out_lo32; + err = BZ2_bzCompress(&zi->ci.bstream, BZ_FINISH); + if (err == BZ_STREAM_END) + err = Z_STREAM_END; + zi->ci.pos_in_buffered_data += (uInt)(zi->ci.bstream.total_out_lo32 - total_out_before); + } + + if (err == BZ_FINISH_OK) + err = ZIP_OK; +#endif + } + } + + if (err == Z_STREAM_END) + err = ZIP_OK; /* this is normal */ + + if ((zi->ci.pos_in_buffered_data > 0) && (err == ZIP_OK)) + { + if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) + err = ZIP_ERRNO; + } + +#ifdef HAVE_AES + if (zi->ci.method == AES_METHOD) + { + unsigned char authcode[AES_AUTHCODESIZE]; + + fcrypt_end(authcode, &zi->ci.aes_ctx); + + if (ZWRITE64(zi->z_filefunc, zi->filestream, authcode, AES_AUTHCODESIZE) != AES_AUTHCODESIZE) + err = ZIP_ERRNO; + } +#endif + + if (!zi->ci.raw) + { + if (zi->ci.compression_method == Z_DEFLATED) + { + int tmp_err = deflateEnd(&zi->ci.stream); + if (err == ZIP_OK) + err = tmp_err; + zi->ci.stream_initialised = 0; + } +#ifdef HAVE_BZIP2 + else if (zi->ci.compression_method == Z_BZIP2ED) + { + int tmperr = BZ2_bzCompressEnd(&zi->ci.bstream); + if (err == ZIP_OK) + err = tmperr; + zi->ci.stream_initialised = 0; + } +#endif + + crc32 = (uLong)zi->ci.crc32; + uncompressed_size = zi->ci.total_uncompressed; + } + + compressed_size = zi->ci.total_compressed; +#ifndef NOCRYPT + compressed_size += zi->ci.crypt_header_size; +#endif + + /* Update current item crc and sizes */ + if (compressed_size >= 0xffffffff || uncompressed_size >= 0xffffffff || zi->ci.pos_local_header >= 0xffffffff) + { + /* Do not change ""version made by"" upper byte since it might have been set by the user */ + uLong versionMadeBy = (uLong)zip64local_getValue_frommemory(zi->ci.central_header+4, 2); /* version made by */ + if ((versionMadeBy & 0xff) < 45) + zip64local_putValue_inmemory(zi->ci.central_header+4, (uLong)((versionMadeBy & 0xff00) | (uLong)45), 2); /* version made by */ + zip64local_putValue_inmemory(zi->ci.central_header+6, (uLong)45, 2); /* version needed */ + } + zip64local_putValue_inmemory(zi->ci.central_header+16, crc32, 4); /* crc */ + if (compressed_size >= 0xffffffff) + zip64local_putValue_inmemory(zi->ci.central_header+20, invalidValue, 4); /* compr size */ + else + zip64local_putValue_inmemory(zi->ci.central_header+20, compressed_size, 4); /* compr size */ + if (zi->ci.stream.data_type == Z_ASCII) + zip64local_putValue_inmemory(zi->ci.central_header+36, (uLong)Z_ASCII, 2); /* internal file attrib */ + if (uncompressed_size >= 0xffffffff) + zip64local_putValue_inmemory(zi->ci.central_header+24, invalidValue, 4); /* uncompr size */ + else + zip64local_putValue_inmemory(zi->ci.central_header+24, uncompressed_size, 4); /* uncompr size */ + + /* Add ZIP64 extra info field for uncompressed size */ + if (uncompressed_size >= 0xffffffff) + datasize += 8; + /* Add ZIP64 extra info field for compressed size */ + if (compressed_size >= 0xffffffff) + datasize += 8; + /* Add ZIP64 extra info field for relative offset to local file header of current file */ + if (zi->ci.pos_local_header >= 0xffffffff) + datasize += 8; + + /* Add Extra Information Header for 'ZIP64 information' */ + if (datasize > 0) + { + char* p = zi->ci.central_header + zi->ci.size_centralheader; + + if ((uLong)(datasize + 4) > zi->ci.size_centralextrafree) + return ZIP_BADZIPFILE; + + zip64local_putValue_inmemory(p, 0x0001, 2); + p += 2; + zip64local_putValue_inmemory(p, datasize, 2); + p += 2; + + if (uncompressed_size >= 0xffffffff) + { + zip64local_putValue_inmemory(p, uncompressed_size, 8); + p += 8; + } + if (compressed_size >= 0xffffffff) + { + zip64local_putValue_inmemory(p, compressed_size, 8); + p += 8; + } + if (zi->ci.pos_local_header >= 0xffffffff) + { + zip64local_putValue_inmemory(p, zi->ci.pos_local_header, 8); + p += 8; + } + + zi->ci.size_centralextrafree -= datasize + 4; + zi->ci.size_centralheader += datasize + 4; + zi->ci.size_centralextra += datasize + 4; + + zip64local_putValue_inmemory(zi->ci.central_header+30, (uLong)zi->ci.size_centralextra, 2); + } + +#ifdef HAVE_AES + /* Write the AES extended info */ + if (zi->ci.method == AES_METHOD) + { + char* p = zi->ci.central_header + zi->ci.size_centralheader; + + datasize = 7; + + if ((uLong)(datasize + 4) > zi->ci.size_centralextrafree) + return ZIP_BADZIPFILE; + + zip64local_putValue_inmemory(p, 0x9901, 2); + p += 2; + zip64local_putValue_inmemory(p, datasize, 2); + p += 2; + zip64local_putValue_inmemory(p, AES_VERSION, 2); + p += 2; + zip64local_putValue_inmemory(p, 'A', 1); + p += 1; + zip64local_putValue_inmemory(p, 'E', 1); + p += 1; + zip64local_putValue_inmemory(p, AES_ENCRYPTIONMODE, 1); + p += 1; + zip64local_putValue_inmemory(p, zi->ci.compression_method, 2); + p += 2; + + zi->ci.size_centralextrafree -= datasize + 4; + zi->ci.size_centralheader += datasize + 4; + zi->ci.size_centralextra += datasize + 4; + + zip64local_putValue_inmemory(zi->ci.central_header+30, (uLong)zi->ci.size_centralextra, 2); + } +#endif + /* Restore comment to correct position */ + for (i = 0; i < zi->ci.size_comment; i++) + zi->ci.central_header[zi->ci.size_centralheader+i] = + zi->ci.central_header[zi->ci.size_centralheader+zi->ci.size_centralextrafree+i]; + zi->ci.size_centralheader += zi->ci.size_comment; + + if (err == ZIP_OK) + err = add_data_in_datablock(&zi->central_dir, zi->ci.central_header, (uLong)zi->ci.size_centralheader); + + free(zi->ci.central_header); + + if (err == ZIP_OK) + { + /* Update the LocalFileHeader with the new values. */ + ZPOS64_T cur_pos_inzip = ZTELL64(zi->z_filefunc, zi->filestream); + uLong cur_number_disk = zi->number_disk; + + /* Local file header is stored on previous disk, switch to make edits */ + if (zi->ci.number_disk != cur_number_disk) + err = zipGoToSpecificDisk(file, zi->ci.number_disk, 1); + + if (ZSEEK64(zi->z_filefunc, zi->filestream, zi->ci.pos_local_header + 14, ZLIB_FILEFUNC_SEEK_SET) != 0) + err = ZIP_ERRNO; + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream,crc32,4); /* crc 32, unknown */ + + if (uncompressed_size >= 0xffffffff || compressed_size >= 0xffffffff) + { + if (zi->ci.pos_zip64extrainfo > 0) + { + /* Update the size in the ZIP64 extended field. */ + if (ZSEEK64(zi->z_filefunc, zi->filestream, zi->ci.pos_zip64extrainfo + 4, ZLIB_FILEFUNC_SEEK_SET) != 0) + err = ZIP_ERRNO; + + if (err == ZIP_OK) /* compressed size, unknown */ + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, uncompressed_size, 8); + if (err == ZIP_OK) /* uncompressed size, unknown */ + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, compressed_size, 8); + } + else + err = ZIP_BADZIPFILE; /* Caller passed zip64 = 0, so no room for zip64 info -> fatal */ + } + else + { + if (err == ZIP_OK) /* compressed size, unknown */ + err = zip64local_putValue(&zi->z_filefunc, zi->filestream,compressed_size, 4); + if (err == ZIP_OK) /* uncompressed size, unknown */ + err = zip64local_putValue(&zi->z_filefunc, zi->filestream,uncompressed_size, 4); + } + + /* Now switch back again to the disk we were on before */ + if (zi->ci.number_disk != cur_number_disk) + err = zipGoToSpecificDisk(file, cur_number_disk, 1); + + if (ZSEEK64(zi->z_filefunc, zi->filestream, cur_pos_inzip, ZLIB_FILEFUNC_SEEK_SET) != 0) + err = ZIP_ERRNO; + } + + zi->number_entry++; + zi->in_opened_file_inzip = 0; + + return err; +} + +extern int ZEXPORT zipCloseFileInZip(zipFile file) +{ + return zipCloseFileInZipRaw(file, 0, 0); +} + +extern int ZEXPORT zipClose(zipFile file, const char* global_comment) +{ + return zipClose_64(file, global_comment); +} + +extern int ZEXPORT zipClose_64(zipFile file, const char* global_comment) +{ + return zipClose2_64(file, global_comment, VERSIONMADEBY); +} + +extern int ZEXPORT zipClose2_64(zipFile file, const char* global_comment, uLong versionMadeBy) +{ + zip64_internal* zi; + int err = 0; + uLong size_centraldir = 0; + uInt size_global_comment = 0; + ZPOS64_T centraldir_pos_inzip; + ZPOS64_T pos = 0; + uLong write = 0; + + if (file == NULL) + return ZIP_PARAMERROR; + + zi = (zip64_internal*)file; + + if (zi->in_opened_file_inzip == 1) + err = zipCloseFileInZip(file); + +#ifndef NO_ADDFILEINEXISTINGZIP + if (global_comment == NULL) + global_comment = zi->globalcomment; +#endif + + if (zi->filestream != zi->filestream_with_CD) + { + if (ZCLOSE64(zi->z_filefunc, zi->filestream) != 0) + if (err == ZIP_OK) + err = ZIP_ERRNO; + if (zi->disk_size > 0) + zi->number_disk_with_CD = zi->number_disk + 1; + zi->filestream = zi->filestream_with_CD; + } + + centraldir_pos_inzip = ZTELL64(zi->z_filefunc, zi->filestream); + + if (err == ZIP_OK) + { + linkedlist_datablock_internal* ldi = zi->central_dir.first_block; + while (ldi!= NULL) + { + if ((err == ZIP_OK) && (ldi->filled_in_this_block > 0)) + { + write = ZWRITE64(zi->z_filefunc, zi->filestream, ldi->data, ldi->filled_in_this_block); + if (write != ldi->filled_in_this_block) + err = ZIP_ERRNO; + } + + size_centraldir += ldi->filled_in_this_block; + ldi = ldi->next_datablock; + } + } + + free_linkedlist(&(zi->central_dir)); + + pos = centraldir_pos_inzip - zi->add_position_when_writting_offset; + + /* Write the ZIP64 central directory header */ + if (pos >= 0xffffffff || zi->number_entry > 0xffff) + { + ZPOS64_T zip64eocd_pos_inzip = ZTELL64(zi->z_filefunc, zi->filestream); + uLong zip64datasize = 44; + + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)ZIP64ENDHEADERMAGIC, 4); + + /* Size of this 'zip64 end of central directory' */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)zip64datasize, 8); + /* Version made by */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)versionMadeBy, 2); + /* version needed */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)45, 2); + /* Number of this disk */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)zi->number_disk_with_CD, 4); + /* Number of the disk with the start of the central directory */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)zi->number_disk_with_CD, 4); + /* Total number of entries in the central dir on this disk */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, zi->number_entry, 8); + /* Total number of entries in the central dir */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, zi->number_entry, 8); + /* Size of the central directory */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)size_centraldir, 8); + + if (err == ZIP_OK) + { + /* Offset of start of central directory with respect to the starting disk number */ + ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset; + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)pos, 8); + } + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)ZIP64ENDLOCHEADERMAGIC, 4); + + /* Number of the disk with the start of the central directory */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)zi->number_disk_with_CD, 4); + /* Relative offset to the Zip64EndOfCentralDirectory */ + if (err == ZIP_OK) + { + ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writting_offset; + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, pos, 8); + } + /* Number of the disk with the start of the central directory */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)zi->number_disk_with_CD+1, 4); + } + + /* Write the central directory header */ + + /* Signature */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)ENDHEADERMAGIC, 4); + /* Number of this disk */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)zi->number_disk_with_CD, 2); + /* Number of the disk with the start of the central directory */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)zi->number_disk_with_CD, 2); + /* Total number of entries in the central dir on this disk */ + if (err == ZIP_OK) + { + if (zi->number_entry >= 0xffff) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)0xffff, 2); /* use value in ZIP64 record */ + else + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)zi->number_entry, 2); + } + /* Total number of entries in the central dir */ + if (err == ZIP_OK) + { + if (zi->number_entry >= 0xffff) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)0xffff, 2); /* use value in ZIP64 record */ + else + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)zi->number_entry, 2); + } + /* Size of the central directory */ + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)size_centraldir,4); + /* Offset of start of central directory with respect to the starting disk number */ + if (err == ZIP_OK) + { + ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset; + if (pos >= 0xffffffff) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)0xffffffff, 4); + else + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)pos, 4); + } + + /* Write global comment */ + + if (global_comment != NULL) + size_global_comment = (uInt)strlen(global_comment); + if (err == ZIP_OK) + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (uLong)size_global_comment, 2); + if (err == ZIP_OK && size_global_comment > 0) + { + if (ZWRITE64(zi->z_filefunc, zi->filestream, global_comment, size_global_comment) != size_global_comment) + err = ZIP_ERRNO; + } + + if ((ZCLOSE64(zi->z_filefunc, zi->filestream) != 0) && (err == ZIP_OK)) + err = ZIP_ERRNO; + +#ifndef NO_ADDFILEINEXISTINGZIP + TRYFREE(zi->globalcomment); +#endif + TRYFREE(zi); + + return err; +} +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/zip.h",".h","9390","204","/* zip.h -- IO on .zip files using zlib + Version 1.1, February 14h, 2010 + part of the MiniZip project + + Copyright (C) 1998-2010 Gilles Vollant + http://www.winimage.com/zLibDll/minizip.html + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson + http://result42.com + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. +*/ + +#ifndef _ZIP_H +#define _ZIP_H + +#ifdef __cplusplus +extern ""C"" { +#endif + +#ifndef _ZLIB_H +# include ""zlib.h"" +#endif + +#ifndef _ZLIBIOAPI_H +# include ""ioapi.h"" +#endif + +#ifdef HAVE_BZIP2 +# include ""bzlib.h"" +#endif + +#define Z_BZIP2ED 12 + +#if defined(STRICTZIP) || defined(STRICTZIPUNZIP) +/* like the STRICT of WIN32, we define a pointer that cannot be converted + from (void*) without cast */ +typedef struct TagzipFile__ { int unused; } zipFile__; +typedef zipFile__ *zipFile; +#else +typedef voidp zipFile; +#endif + +#define ZIP_OK (0) +#define ZIP_EOF (0) +#define ZIP_ERRNO (Z_ERRNO) +#define ZIP_PARAMERROR (-102) +#define ZIP_BADZIPFILE (-103) +#define ZIP_INTERNALERROR (-104) + +#ifndef DEF_MEM_LEVEL +# if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +# else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +# endif +#endif +/* default memLevel */ + +/* tm_zip contain date/time info */ +typedef struct tm_zip_s +{ + uInt tm_sec; /* seconds after the minute - [0,59] */ + uInt tm_min; /* minutes after the hour - [0,59] */ + uInt tm_hour; /* hours since midnight - [0,23] */ + uInt tm_mday; /* day of the month - [1,31] */ + uInt tm_mon; /* months since January - [0,11] */ + uInt tm_year; /* years - [1980..2044] */ +} tm_zip; + +typedef struct +{ + tm_zip tmz_date; /* date in understandable format */ + uLong dosDate; /* if dos_date == 0, tmu_date is used */ + uLong internal_fa; /* internal file attributes 2 bytes */ + uLong external_fa; /* external file attributes 4 bytes */ +} zip_fileinfo; + +#define APPEND_STATUS_CREATE (0) +#define APPEND_STATUS_CREATEAFTER (1) +#define APPEND_STATUS_ADDINZIP (2) + +/***************************************************************************/ +/* Writing a zip file */ + +extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); +extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append)); +/* Create a zipfile. + + pathname should contain the full pathname (by example, on a Windows XP computer + ""c:\\zlib\\zlib113.zip"" or on an Unix computer ""zlib/zlib113.zip"". + + return NULL if zipfile cannot be opened + return zipFile handle if no error + + If the file pathname exist and append == APPEND_STATUS_CREATEAFTER, the zip + will be created at the end of the file. (useful if the file contain a self extractor code) + If the file pathname exist and append == APPEND_STATUS_ADDINZIP, we will add files in existing + zip (be sure you don't add file that doesn't exist) + + NOTE: There is no delete function into a zipfile. If you want delete file into a zipfile, + you must open a zipfile, and create another. Of course, you can use RAW reading and writing to copy + the file you did not want delete. */ + +extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, int append, const char ** globalcomment, + zlib_filefunc_def* pzlib_filefunc_def)); + +extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname, int append, const char ** globalcomment, + zlib_filefunc64_def* pzlib_filefunc_def)); + +extern zipFile ZEXPORT zipOpen3 OF((const char *pathname, int append, ZPOS64_T disk_size, + const char ** globalcomment, zlib_filefunc_def* pzlib_filefunc_def)); +/* Same as zipOpen2 but allows specification of spanned zip size */ + +extern zipFile ZEXPORT zipOpen3_64 OF((const void *pathname, int append, ZPOS64_T disk_size, + const char ** globalcomment, zlib_filefunc64_def* pzlib_filefunc_def)); + +extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level)); +/* Open a file in the ZIP for writing. + + filename : the filename in zip (if NULL, '-' without quote will be used + *zipfi contain supplemental information + extrafield_local buffer to store the local header extra field data, can be NULL + size_extrafield_local size of extrafield_local buffer + extrafield_global buffer to store the global header extra field data, can be NULL + size_extrafield_global size of extrafield_local buffer + comment buffer for comment string + method contain the compression method (0 for store, Z_DEFLATED for deflate) + level contain the level of compression (can be Z_DEFAULT_COMPRESSION) + zip64 is set to 1 if a zip64 extended information block should be added to the local file header. + this MUST be '1' if the uncompressed size is >= 0xffffffff. */ + +extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int zip64)); +/* Same as zipOpenNewFileInZip with zip64 support */ + +extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int raw)); +/* Same as zipOpenNewFileInZip, except if raw=1, we write raw file */ + +extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int raw, int zip64)); +/* Same as zipOpenNewFileInZip3 with zip64 support */ + +extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits, int memLevel, + int strategy, const char* password, uLong crcForCrypting)); +/* Same as zipOpenNewFileInZip2, except + windowBits, memLevel, strategy : see parameter strategy in deflateInit2 + password : crypting password (NULL for no crypting) + crcForCrypting : crc of file to compress (needed for crypting) */ + +extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits, int memLevel, + int strategy, const char* password, uLong crcForCrypting, int zip64)); +/* Same as zipOpenNewFileInZip3 with zip64 support */ + +extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits, int memLevel, + int strategy, const char* password, uLong crcForCrypting, uLong versionMadeBy, uLong flagBase)); +/* Same as zipOpenNewFileInZip3 except versionMadeBy & flag fields */ + +extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file, const char* filename, const zip_fileinfo* zipfi, + const void* extrafield_local, uInt size_extrafield_local, const void* extrafield_global, + uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits, int memLevel, + int strategy, const char* password, uLong crcForCrypting, uLong versionMadeBy, uLong flagBase, int zip64)); +/* Same as zipOpenNewFileInZip4 with zip64 support */ + +extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, const void* buf, unsigned len)); +/* Write data in the zipfile */ + +extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); +/* Close the current file in the zipfile */ + +extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, uLong uncompressed_size, uLong crc32)); +extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file, ZPOS64_T uncompressed_size, uLong crc32)); +/* Close the current file in the zipfile, for file opened with parameter raw=1 in zipOpenNewFileInZip2 + uncompressed_size and crc32 are value for the uncompressed size */ + +extern int ZEXPORT zipClose OF((zipFile file, const char* global_comment)); +/* Close the zipfile */ + +extern int ZEXPORT zipClose_64 OF((zipFile file, const char* global_comment)); + +extern int ZEXPORT zipClose2_64 OF((zipFile file, const char* global_comment, uLong versionMadeBy)); +/* Same as zipClose_64 except versionMadeBy field */ + +/***************************************************************************/ + +#ifdef __cplusplus +} +#endif + +#endif /* _ZIP_H */ +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/iowin32.c",".c","18819","586","/* iowin32.c -- IO base function header for compress/uncompress .zip + Version 1.1, February 14h, 2010 + part of the MiniZip project + + Copyright (C) 1998-2010 Gilles Vollant + http://www.winimage.com/zLibDll/minizip.html + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson + http://result42.com + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. +*/ + +#include +#include + +#include ""zlib.h"" +#include ""ioapi.h"" +#include ""iowin32.h"" + +#ifndef INVALID_HANDLE_VALUE +# define INVALID_HANDLE_VALUE (0xFFFFFFFF) +#endif + +#ifndef INVALID_SET_FILE_POINTER +# define INVALID_SET_FILE_POINTER ((DWORD)-1) +#endif + +#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) +# if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +# define IOWIN32_USING_WINRT_API 1 +# endif +#endif + +voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode)); +uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); +uLong ZCALLBACK win32_write_file_func OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); +ZPOS64_T ZCALLBACK win32_tell64_file_func OF((voidpf opaque, voidpf stream)); +long ZCALLBACK win32_seek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); +int ZCALLBACK win32_close_file_func OF((voidpf opaque, voidpf stream)); +int ZCALLBACK win32_error_file_func OF((voidpf opaque, voidpf stream)); + +typedef struct +{ + HANDLE hf; + int error; + void *filename; + int filenameLength; +} WIN32FILE_IOWIN; + + +static void win32_translate_open_mode(int mode, + DWORD* lpdwDesiredAccess, + DWORD* lpdwCreationDisposition, + DWORD* lpdwShareMode, + DWORD* lpdwFlagsAndAttributes) +{ + *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0; + + if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) == ZLIB_FILEFUNC_MODE_READ) + { + *lpdwDesiredAccess = GENERIC_READ; + *lpdwCreationDisposition = OPEN_EXISTING; + *lpdwShareMode = FILE_SHARE_READ; + } + else if (mode & ZLIB_FILEFUNC_MODE_EXISTING) + { + *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ; + *lpdwCreationDisposition = OPEN_EXISTING; + } + else if (mode & ZLIB_FILEFUNC_MODE_CREATE) + { + *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ; + *lpdwCreationDisposition = CREATE_ALWAYS; + } +} + +static voidpf win32_build_iowin(HANDLE hFile) +{ + WIN32FILE_IOWIN *iowin = NULL; + + if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE)) + { + iowin = (WIN32FILE_IOWIN *)malloc(sizeof(WIN32FILE_IOWIN)); + if (iowin == NULL) + { + CloseHandle(hFile); + return NULL; + } + memset(iowin, 0, sizeof(WIN32FILE_IOWIN)); + iowin->hf = hFile; + } + return (voidpf)iowin; +} + +voidpf ZCALLBACK win32_open64_file_func (voidpf opaque, const void* filename, int mode) +{ + DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; + HANDLE hFile = NULL; + WIN32FILE_IOWIN *iowin = NULL; + + win32_translate_open_mode(mode, &dwDesiredAccess, &dwCreationDisposition, &dwShareMode, &dwFlagsAndAttributes); + + if ((filename != NULL) && (dwDesiredAccess != 0)) + { +#ifdef IOWIN32_USING_WINRT_API +#ifdef UNICODE + hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); +#else + WCHAR filenameW[FILENAME_MAX + 0x200 + 1]; + MultiByteToWideChar(CP_ACP, 0, (const char*)filename, -1, filenameW, FILENAME_MAX + 0x200); + hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); +#endif +#else + hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); +#endif + } + + iowin = win32_build_iowin(hFile); + if (iowin == NULL) + return NULL; + iowin->filenameLength = _tcslen(filename) + 1; + iowin->filename = (void*)malloc(iowin->filenameLength * sizeof(TCHAR)); + _tcsncpy(iowin->filename, filename, iowin->filenameLength); + return iowin; +} + + +voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque, const void* filename, int mode) +{ + DWORD dwDesiredAccess, dwCreationDisposition, dwShareMode, dwFlagsAndAttributes ; + HANDLE hFile = NULL; + WIN32FILE_IOWIN *iowin = NULL; + + win32_translate_open_mode(mode, &dwDesiredAccess, &dwCreationDisposition, &dwShareMode, &dwFlagsAndAttributes); + + if ((filename != NULL) && (dwDesiredAccess != 0)) + { +#ifdef IOWIN32_USING_WINRT_API + WCHAR filenameW[FILENAME_MAX + 0x200 + 1]; + MultiByteToWideChar(CP_ACP, 0, (const char*)filename, -1, filenameW, FILENAME_MAX + 0x200); + hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); +#else + hFile = CreateFileA((LPCSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); +#endif + } + + iowin = win32_build_iowin(hFile); + if (iowin == NULL) + return NULL; + iowin->filenameLength = strlen(filename) + 1; + iowin->filename = (void*)malloc(iowin->filenameLength * sizeof(char)); + strncpy(iowin->filename, filename, iowin->filenameLength); + return iowin; +} + + +voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int mode) +{ + DWORD dwDesiredAccess, dwCreationDisposition, dwShareMode, dwFlagsAndAttributes; + HANDLE hFile = NULL; + WIN32FILE_IOWIN *iowin = NULL; + + win32_translate_open_mode(mode, &dwDesiredAccess, &dwCreationDisposition, &dwShareMode, &dwFlagsAndAttributes); + + if ((filename != NULL) && (dwDesiredAccess != 0)) + { +#ifdef IOWIN32_USING_WINRT_API + hFile = CreateFile2((LPCWSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); +#else + hFile = CreateFileW((LPCWSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); +#endif + } + + iowin = win32_build_iowin(hFile); + if (iowin == NULL) + return NULL; + if (iowin->filename == NULL) + { + iowin->filenameLength = wcslen(filename) + 1; + iowin->filename = (void*)malloc(iowin->filenameLength * sizeof(WCHAR)); + wcsncpy(iowin->filename, filename, iowin->filenameLength); + } + return iowin; +} + +voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mode) +{ + DWORD dwDesiredAccess, dwCreationDisposition, dwShareMode, dwFlagsAndAttributes ; + HANDLE hFile = NULL; + WIN32FILE_IOWIN *iowin = NULL; + + win32_translate_open_mode(mode, &dwDesiredAccess, &dwCreationDisposition, &dwShareMode, &dwFlagsAndAttributes); + + if ((filename != NULL) && (dwDesiredAccess != 0)) + { +#ifdef IOWIN32_USING_WINRT_API +#ifdef UNICODE + hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); +#else + WCHAR filenameW[FILENAME_MAX + 0x200 + 1]; + MultiByteToWideChar(CP_ACP, 0, (const char*)filename, -1, filenameW, FILENAME_MAX + 0x200); + hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); +#endif +#else + hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); +#endif + } + + iowin = win32_build_iowin(hFile); + if (iowin == NULL) + return NULL; + iowin->filenameLength = _tcslen((TCHAR*)filename) + 1; + iowin->filename = (void*)malloc(iowin->filenameLength * sizeof(TCHAR)); + _tcsncpy(iowin->filename, (TCHAR*)filename, iowin->filenameLength); + return iowin; +} + +voidpf ZCALLBACK win32_opendisk64_file_func (voidpf opaque, voidpf stream, int number_disk, int mode) +{ + WIN32FILE_IOWIN *iowin = NULL; + TCHAR *diskFilename = NULL; + voidpf ret = NULL; + int i = 0; + + if (stream == NULL) + return NULL; + iowin = (WIN32FILE_IOWIN*)stream; + diskFilename = (TCHAR*)malloc(iowin->filenameLength * sizeof(TCHAR)); + _tcsncpy(diskFilename, iowin->filename, iowin->filenameLength); + for (i = iowin->filenameLength - 1; i >= 0; i -= 1) + { + if (diskFilename[i] != _T('.')) + continue; + _sntprintf(&diskFilename[i], iowin->filenameLength - i, _T("".z%02d""), number_disk + 1); + break; + } + if (i >= 0) + ret = win32_open64_file_func(opaque, (char*)diskFilename, mode); + free(diskFilename); + return ret; +} + +voidpf ZCALLBACK win32_opendisk64_file_funcW (voidpf opaque, voidpf stream, int number_disk, int mode) +{ + WIN32FILE_IOWIN *iowin = NULL; + WCHAR *diskFilename = NULL; + voidpf ret = NULL; + int i = 0; + + if (stream == NULL) + return NULL; + iowin = (WIN32FILE_IOWIN*)stream; + diskFilename = (WCHAR*)malloc((iowin->filenameLength + 10) * sizeof(WCHAR)); + wcsncpy(diskFilename, iowin->filename, iowin->filenameLength); + for (i = iowin->filenameLength - 1; i >= 0; i -= 1) + { + if (diskFilename[i] != L'.') + continue; + _snwprintf(&diskFilename[i], (iowin->filenameLength + 10) - i, L"".z%02d"", number_disk + 1); + break; + } + if (i >= 0) + ret = win32_open64_file_funcW(opaque, diskFilename, mode); + free(diskFilename); + return ret; +} + +voidpf ZCALLBACK win32_opendisk64_file_funcA (voidpf opaque, voidpf stream, int number_disk, int mode) +{ + WIN32FILE_IOWIN *iowin = NULL; + char *diskFilename = NULL; + voidpf ret = NULL; + int i = 0; + + if (stream == NULL) + return NULL; + iowin = (WIN32FILE_IOWIN*)stream; + diskFilename = (char*)malloc(iowin->filenameLength * sizeof(char)); + strncpy(diskFilename, iowin->filename, iowin->filenameLength); + for (i = iowin->filenameLength - 1; i >= 0; i -= 1) + { + if (diskFilename[i] != '.') + continue; + _snprintf(&diskFilename[i], iowin->filenameLength - i, "".z%02d"", number_disk + 1); + break; + } + if (i >= 0) + ret = win32_open64_file_funcA(opaque, diskFilename, mode); + free(diskFilename); + return ret; +} + +voidpf ZCALLBACK win32_opendisk_file_func (voidpf opaque, voidpf stream, int number_disk, int mode) +{ + WIN32FILE_IOWIN *iowin = NULL; + TCHAR *diskFilename = NULL; + voidpf ret = NULL; + int i = 0; + + if (stream == NULL) + return NULL; + iowin = (WIN32FILE_IOWIN*)stream; + diskFilename = (TCHAR*)malloc(iowin->filenameLength * sizeof(TCHAR)); + _tcsncpy(diskFilename, iowin->filename, iowin->filenameLength); + for (i = iowin->filenameLength - 1; i >= 0; i -= 1) + { + if (diskFilename[i] != _T('.')) + continue; + _sntprintf(&diskFilename[i], iowin->filenameLength - i, _T("".z%02d""), number_disk + 1); + break; + } + if (i >= 0) + ret = win32_open_file_func(opaque, (char*)diskFilename, mode); + free(diskFilename); + return ret; +} + +uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uLong size) +{ + uLong ret = 0; + HANDLE hFile = NULL; + if (stream != NULL) + hFile = ((WIN32FILE_IOWIN*)stream)->hf; + + if (hFile != NULL) + { + if (!ReadFile(hFile, buf, size, &ret, NULL)) + { + DWORD dwErr = GetLastError(); + if (dwErr == ERROR_HANDLE_EOF) + dwErr = 0; + ((WIN32FILE_IOWIN*)stream)->error = (int)dwErr; + } + } + + return ret; +} + +uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* buf,uLong size) +{ + uLong ret = 0; + HANDLE hFile = NULL; + if (stream != NULL) + hFile = ((WIN32FILE_IOWIN*)stream)->hf; + + if (hFile != NULL) + { + if (!WriteFile(hFile, buf, size, &ret, NULL)) + { + DWORD dwErr = GetLastError(); + if (dwErr == ERROR_HANDLE_EOF) + dwErr = 0; + ((WIN32FILE_IOWIN*)stream)->error = (int)dwErr; + } + } + + return ret; +} + +static BOOL win32_setfilepointer_internal(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod) +{ +#ifdef IOWIN32_USING_WINRT_API + return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod); +#else + LONG lHigh = pos.HighPart; + BOOL ret = TRUE; + DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, dwMoveMethod); + if ((dwNewPos == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR)) + ret = FALSE; + if ((newPos != NULL) && (ret)) + { + newPos->LowPart = dwNewPos; + newPos->HighPart = lHigh; + } + return ret; +#endif +} + +long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream) +{ + long ret = -1; + HANDLE hFile = NULL; + if (stream != NULL) + hFile = ((WIN32FILE_IOWIN*)stream)->hf; + if (hFile != NULL) + { + LARGE_INTEGER pos; + pos.QuadPart = 0; + if (!win32_setfilepointer_internal(hFile, pos, &pos, FILE_CURRENT)) + { + DWORD dwErr = GetLastError(); + ((WIN32FILE_IOWIN*)stream)->error = (int)dwErr; + ret = -1; + } + else + ret = (long)pos.LowPart; + } + return ret; +} + +ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream) +{ + ZPOS64_T ret = (ZPOS64_T)-1; + HANDLE hFile = NULL; + if (stream != NULL) + hFile = ((WIN32FILE_IOWIN*)stream)->hf; + + if (hFile) + { + LARGE_INTEGER pos; + pos.QuadPart = 0; + if (!win32_setfilepointer_internal(hFile, pos, &pos, FILE_CURRENT)) + { + DWORD dwErr = GetLastError(); + ((WIN32FILE_IOWIN*)stream)->error = (int)dwErr; + ret = (ZPOS64_T)-1; + } + else + ret = pos.QuadPart; + } + return ret; +} + + +long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,int origin) +{ + DWORD dwMoveMethod = 0xFFFFFFFF; + HANDLE hFile = NULL; + long ret = -1; + + if (stream != NULL) + hFile = ((WIN32FILE_IOWIN*)stream)->hf; + + switch (origin) + { + case ZLIB_FILEFUNC_SEEK_CUR: + dwMoveMethod = FILE_CURRENT; + break; + case ZLIB_FILEFUNC_SEEK_END: + dwMoveMethod = FILE_END; + break; + case ZLIB_FILEFUNC_SEEK_SET: + dwMoveMethod = FILE_BEGIN; + break; + default: + return -1; + } + + if (hFile != NULL) + { + LARGE_INTEGER pos; + pos.QuadPart = offset; + if (!win32_setfilepointer_internal(hFile, pos, NULL, dwMoveMethod)) + { + DWORD dwErr = GetLastError(); + ((WIN32FILE_IOWIN*)stream)->error = (int)dwErr; + ret = -1; + } + else + ret = 0; + } + return ret; +} + +long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T offset,int origin) +{ + DWORD dwMoveMethod = 0xFFFFFFFF; + HANDLE hFile = NULL; + long ret = -1; + + if (stream != NULL) + hFile = ((WIN32FILE_IOWIN*)stream)->hf; + + switch (origin) + { + case ZLIB_FILEFUNC_SEEK_CUR: + dwMoveMethod = FILE_CURRENT; + break; + case ZLIB_FILEFUNC_SEEK_END: + dwMoveMethod = FILE_END; + break; + case ZLIB_FILEFUNC_SEEK_SET: + dwMoveMethod = FILE_BEGIN; + break; + default: + return -1; + } + + if (hFile) + { + LARGE_INTEGER pos; + pos.QuadPart = offset; + if (!win32_setfilepointer_internal(hFile, pos, NULL, dwMoveMethod)) + { + DWORD dwErr = GetLastError(); + ((WIN32FILE_IOWIN*)stream)->error = (int)dwErr; + ret = -1; + } + else + ret = 0; + } + return ret; +} + +int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream) +{ + WIN32FILE_IOWIN* iowin = NULL; + int ret = -1; + + if (stream == NULL) + return ret; + iowin = ((WIN32FILE_IOWIN*)stream); + if (iowin->filename != NULL) + free(iowin->filename); + if (iowin->hf != NULL) + { + CloseHandle(iowin->hf); + ret=0; + } + free(stream); + return ret; +} + +int ZCALLBACK win32_error_file_func (voidpf opaque, voidpf stream) +{ + int ret = -1; + if (stream == NULL) + return ret; + ret = ((WIN32FILE_IOWIN*)stream)->error; + return ret; +} + +void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def) +{ + pzlib_filefunc_def->zopen_file = win32_open_file_func; + pzlib_filefunc_def->zopendisk_file = win32_opendisk_file_func; + pzlib_filefunc_def->zread_file = win32_read_file_func; + pzlib_filefunc_def->zwrite_file = win32_write_file_func; + pzlib_filefunc_def->ztell_file = win32_tell_file_func; + pzlib_filefunc_def->zseek_file = win32_seek_file_func; + pzlib_filefunc_def->zclose_file = win32_close_file_func; + pzlib_filefunc_def->zerror_file = win32_error_file_func; + pzlib_filefunc_def->opaque = NULL; +} + +void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) +{ + pzlib_filefunc_def->zopen64_file = win32_open64_file_func; + pzlib_filefunc_def->zopendisk64_file = win32_opendisk64_file_func; + pzlib_filefunc_def->zread_file = win32_read_file_func; + pzlib_filefunc_def->zwrite_file = win32_write_file_func; + pzlib_filefunc_def->ztell64_file = win32_tell64_file_func; + pzlib_filefunc_def->zseek64_file = win32_seek64_file_func; + pzlib_filefunc_def->zclose_file = win32_close_file_func; + pzlib_filefunc_def->zerror_file = win32_error_file_func; + pzlib_filefunc_def->opaque = NULL; +} + +void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) +{ + pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA; + pzlib_filefunc_def->zopendisk64_file = win32_opendisk64_file_funcA; + pzlib_filefunc_def->zread_file = win32_read_file_func; + pzlib_filefunc_def->zwrite_file = win32_write_file_func; + pzlib_filefunc_def->ztell64_file = win32_tell64_file_func; + pzlib_filefunc_def->zseek64_file = win32_seek64_file_func; + pzlib_filefunc_def->zclose_file = win32_close_file_func; + pzlib_filefunc_def->zerror_file = win32_error_file_func; + pzlib_filefunc_def->opaque = NULL; +} + +void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def) +{ + pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW; + pzlib_filefunc_def->zopendisk64_file = win32_opendisk64_file_funcW; + pzlib_filefunc_def->zread_file = win32_read_file_func; + pzlib_filefunc_def->zwrite_file = win32_write_file_func; + pzlib_filefunc_def->ztell64_file = win32_tell64_file_func; + pzlib_filefunc_def->zseek64_file = win32_seek64_file_func; + pzlib_filefunc_def->zclose_file = win32_close_file_func; + pzlib_filefunc_def->zerror_file = win32_error_file_func; + pzlib_filefunc_def->opaque = NULL; +} +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/ioapi_mem.c",".c","4861","193","/* ioapi_mem.h -- IO base function header for compress/uncompress .zip + files using zlib + zip or unzip API + + This version of ioapi is designed to access memory rather than files. + We do use a region of memory to put data in to and take it out of. We do + not have auto-extending buffers and do not inform anyone else that the + data has been written. It is really intended for accessing a zip archive + embedded in an application such that I can write an installer with no + external files. Creation of archives has not been attempted, although + parts of the framework are present. + + Based on Unzip ioapi.c version 0.22, May 19th, 2003 + + Copyright (C) 1998-2003 Gilles Vollant + (C) 2003 Justin Fletcher + + This file is under the same license as the Unzip tool it is distributed + with. +*/ + + +#include +#include +#include + +#include ""zlib.h"" +#include ""ioapi.h"" + +#include ""ioapi_mem.h"" + +#ifndef IOMEM_BUFFERSIZE +# define IOMEM_BUFFERSIZE (64 * 1024) +#endif + +voidpf ZCALLBACK fopen_mem_func (opaque, filename, mode) + voidpf opaque; + const char* filename; + int mode; +{ + ourmemory_t *mem = (ourmemory_t *)opaque; + if (mem == NULL) + return NULL; /* Mem structure passed in was null */ + + if (mode & ZLIB_FILEFUNC_MODE_CREATE) + { + if (mem->grow) + { + mem->size = IOMEM_BUFFERSIZE; + mem->base = (char *)malloc(mem->size); + } + + mem->limit = 0; /* When writing we start with 0 bytes written */ + } + else + mem->limit = mem->size; + + mem->cur_offset = 0; + + return mem; +} + +voidpf ZCALLBACK fopendisk_mem_func (opaque, stream, number_disk, mode) + voidpf opaque; + voidpf stream; + int number_disk; + int mode; +{ + /* Not used */ + return NULL; +} + +uLong ZCALLBACK fread_mem_func (opaque, stream, buf, size) + voidpf opaque; + voidpf stream; + void* buf; + uLong size; +{ + ourmemory_t *mem = (ourmemory_t *)stream; + + if (size > mem->size - mem->cur_offset) + size = mem->size - mem->cur_offset; + + memcpy(buf, mem->base + mem->cur_offset, size); + mem->cur_offset += size; + + return size; +} + + +uLong ZCALLBACK fwrite_mem_func (opaque, stream, buf, size) + voidpf opaque; + voidpf stream; + const void* buf; + uLong size; +{ + ourmemory_t *mem = (ourmemory_t *)stream; + char *newbase = NULL; + uLong newmemsize = 0; + + if (size > mem->size - mem->cur_offset) + { + if (mem->grow) + { + newmemsize = mem->size; + if (size < IOMEM_BUFFERSIZE) + newmemsize += IOMEM_BUFFERSIZE; + else + newmemsize += size; + newbase = (char *)malloc(newmemsize); + memcpy(newbase, mem->base, mem->size); + free(mem->base); + mem->base = newbase; + mem->size = newmemsize; + } + else + size = mem->size - mem->cur_offset; + } + memcpy(mem->base + mem->cur_offset, buf, size); + mem->cur_offset += size; + if (mem->cur_offset > mem->limit) + mem->limit = mem->cur_offset; + + return size; +} + +long ZCALLBACK ftell_mem_func (opaque, stream) + voidpf opaque; + voidpf stream; +{ + ourmemory_t *mem = (ourmemory_t *)stream; + return mem->cur_offset; +} + +long ZCALLBACK fseek_mem_func (opaque, stream, offset, origin) + voidpf opaque; + voidpf stream; + uLong offset; + int origin; +{ + ourmemory_t *mem = (ourmemory_t *)stream; + uLong new_pos; + switch (origin) + { + case ZLIB_FILEFUNC_SEEK_CUR: + new_pos = mem->cur_offset + offset; + break; + case ZLIB_FILEFUNC_SEEK_END: + new_pos = mem->limit + offset; + break; + case ZLIB_FILEFUNC_SEEK_SET: + new_pos = offset; + break; + default: + return -1; + } + + if (new_pos > mem->size) + return 1; /* Failed to seek that far */ + mem->cur_offset = new_pos; + return 0; +} + +int ZCALLBACK fclose_mem_func (opaque, stream) + voidpf opaque; + voidpf stream; +{ + /* Even with grow = 1, caller must always free() memory */ + return 0; +} + +int ZCALLBACK ferror_mem_func (opaque, stream) + voidpf opaque; + voidpf stream; +{ + /* We never return errors */ + return 0; +} + +void fill_memory_filefunc (pzlib_filefunc_def, ourmem) + zlib_filefunc_def* pzlib_filefunc_def; + ourmemory_t *ourmem; +{ + pzlib_filefunc_def->zopen_file = fopen_mem_func; + pzlib_filefunc_def->zopendisk_file = fopendisk_mem_func; + pzlib_filefunc_def->zread_file = fread_mem_func; + pzlib_filefunc_def->zwrite_file = fwrite_mem_func; + pzlib_filefunc_def->ztell_file = ftell_mem_func; + pzlib_filefunc_def->zseek_file = fseek_mem_func; + pzlib_filefunc_def->zclose_file = fclose_mem_func; + pzlib_filefunc_def->zerror_file = ferror_mem_func; + pzlib_filefunc_def->opaque = ourmem; +} +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/ioapi.h",".h","6926","176","/* ioapi.h -- IO base function header for compress/uncompress .zip + part of the MiniZip project + + Copyright (C) 1998-2010 Gilles Vollant + http://www.winimage.com/zLibDll/minizip.html + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson + http://result42.com + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. +*/ + +#ifndef _ZLIBIOAPI64_H +#define _ZLIBIOAPI64_H + +#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) +# ifndef __USE_FILE_OFFSET64 +# define __USE_FILE_OFFSET64 +# endif +# ifndef __USE_LARGEFILE64 +# define __USE_LARGEFILE64 +# endif +# ifndef _LARGEFILE64_SOURCE +# define _LARGEFILE64_SOURCE +# endif +# ifndef _FILE_OFFSET_BIT +# define _FILE_OFFSET_BIT 64 +# endif +#endif + +#include +#include +#include ""zlib.h"" + +#if defined(USE_FILE32API) +# define fopen64 fopen +# define ftello64 ftell +# define fseeko64 fseek +#else +# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) +# define fopen64 fopen +# define ftello64 ftello +# define fseeko64 fseeko +# endif +# ifdef _MSC_VER +# define fopen64 fopen +# if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC))) +# define ftello64 _ftelli64 +# define fseeko64 _fseeki64 +# else /* old MSC */ +# define ftello64 ftell +# define fseeko64 fseek +# endif +# endif +#endif + +/* a type choosen by DEFINE */ +#ifdef HAVE_64BIT_INT_CUSTOM +typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T; +#else +# ifdef HAVE_STDINT_H +# include ""stdint.h"" + typedef uint64_t ZPOS64_T; +# else +# if defined(_MSC_VER) || defined(__BORLANDC__) + typedef unsigned __int64 ZPOS64_T; +# else + typedef unsigned long long int ZPOS64_T; +# endif +# endif +#endif + +#ifdef __cplusplus +extern ""C"" { +#endif + +#define ZLIB_FILEFUNC_SEEK_CUR (1) +#define ZLIB_FILEFUNC_SEEK_END (2) +#define ZLIB_FILEFUNC_SEEK_SET (0) + +#define ZLIB_FILEFUNC_MODE_READ (1) +#define ZLIB_FILEFUNC_MODE_WRITE (2) +#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) +#define ZLIB_FILEFUNC_MODE_EXISTING (4) +#define ZLIB_FILEFUNC_MODE_CREATE (8) + +#ifndef ZCALLBACK +# if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || \ + defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) +# define ZCALLBACK CALLBACK +# else +# define ZCALLBACK +# endif +#endif + +typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); +typedef voidpf (ZCALLBACK *opendisk_file_func) OF((voidpf opaque, voidpf stream, int number_disk, int mode)); +typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); +typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); +typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); +typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); + +typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); +typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); + +/* here is the ""old"" 32 bits structure structure */ +typedef struct zlib_filefunc_def_s +{ + open_file_func zopen_file; + opendisk_file_func zopendisk_file; + read_file_func zread_file; + write_file_func zwrite_file; + tell_file_func ztell_file; + seek_file_func zseek_file; + close_file_func zclose_file; + testerror_file_func zerror_file; + voidpf opaque; +} zlib_filefunc_def; + +typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream)); +typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); +typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode)); +typedef voidpf (ZCALLBACK *opendisk64_file_func)OF((voidpf opaque, voidpf stream, int number_disk, int mode)); + +typedef struct zlib_filefunc64_def_s +{ + open64_file_func zopen64_file; + opendisk64_file_func zopendisk64_file; + read_file_func zread_file; + write_file_func zwrite_file; + tell64_file_func ztell64_file; + seek64_file_func zseek64_file; + close_file_func zclose_file; + testerror_file_func zerror_file; + voidpf opaque; +} zlib_filefunc64_def; + +void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); +void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def)); + +/* now internal definition, only for zip.c and unzip.h */ +typedef struct zlib_filefunc64_32_def_s +{ + zlib_filefunc64_def zfile_func64; + open_file_func zopen32_file; + opendisk_file_func zopendisk32_file; + tell_file_func ztell32_file; + seek_file_func zseek32_file; +} zlib_filefunc64_32_def; + +#define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) +#define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) +/*#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))*/ +/*#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))*/ +#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream)) +#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream)) + +voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)); +voidpf call_zopendisk64 OF((const zlib_filefunc64_32_def* pfilefunc, voidpf filestream, int number_disk, int mode)); +long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)); +ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)); + +void fill_zlib_filefunc64_32_def_from_filefunc32 OF((zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32)); + +#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode))) +#define ZOPENDISK64(filefunc,filestream,diskn,mode) (call_zopendisk64((&(filefunc)),(filestream),(diskn),(mode))) +#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream))) +#define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode))) + +#ifdef __cplusplus +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/ioapi_mem.h",".h","1785","52","/* ioapi_mem.h -- IO base function header for compress/uncompress .zip + files using zlib + zip or unzip API + + This version of ioapi is designed to access memory rather than files. + We do use a region of memory to put data in to and take it out of. + + Copyright (C) 1998-2003 Gilles Vollant + (C) 2003 Justin Fletcher + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. +*/ + +#ifndef _IOAPI_MEM_H +#define _IOAPI_MEM_H + +#include +#include +#include + +#include ""zlib.h"" +#include ""ioapi.h"" + +#ifdef __cplusplus +extern ""C"" { +#endif + +voidpf ZCALLBACK fopen_mem_func OF((voidpf opaque,const char* filename,int mode)); +voidpf ZCALLBACK fopendisk_mem_func OF((voidpf opaque, voidpf stream, int number_disk, int mode)); +uLong ZCALLBACK fread_mem_func OF((voidpf opaque,voidpf stream,void* buf,uLong size)); +uLong ZCALLBACK fwrite_mem_func OF((voidpf opaque,voidpf stream,const void* buf,uLong size)); +long ZCALLBACK ftell_mem_func OF((voidpf opaque,voidpf stream)); +long ZCALLBACK fseek_mem_func OF((voidpf opaque,voidpf stream,uLong offset,int origin)); +int ZCALLBACK fclose_mem_func OF((voidpf opaque,voidpf stream)); +int ZCALLBACK ferror_mem_func OF((voidpf opaque,voidpf stream)); + +typedef struct ourmemory_s { + char *base; /* Base of the region of memory we're using */ + uLong size; /* Size of the region of memory we're using */ + uLong limit; /* Furthest we've written */ + uLong cur_offset; /* Current offset in the area */ + int grow; /* Growable memory buffer */ +} ourmemory_t; + +void fill_memory_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def, ourmemory_t *ourmem)); + +#ifdef __cplusplus +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/ioapi_buf.h",".h","1964","55","/* ioapi_buf.h -- IO base function header for compress/uncompress .zip + files using zlib + zip or unzip API + + This version of ioapi is designed to buffer IO. + + Copyright (C) 1998-2003 Gilles Vollant + (C) 2012-2014 Nathan Moinvaziri + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. +*/ + +#ifndef _IOAPI_BUF_H +#define _IOAPI_BUF_H + +#include +#include +#include + +#include ""zlib.h"" +#include ""ioapi.h"" + +#define IOBUF_BUFFERSIZE (64 * 1024) + +#ifdef __cplusplus +extern ""C"" { +#endif + +voidpf ZCALLBACK fopen_buf_func OF((voidpf opaque,const char* filename,int mode)); +voidpf ZCALLBACK fopen64_buf_func OF((voidpf opaque,const char* filename,int mode)); +voidpf ZCALLBACK fopendisk_buf_func OF((voidpf opaque, voidpf stream_cd, int number_disk, int mode)); +voidpf ZCALLBACK fopendisk64_buf_func OF((voidpf opaque, voidpf stream_cd, int number_disk, int mode)); +uLong ZCALLBACK fread_buf_func OF((voidpf opaque,voidpf stream,void* buf,uLong size)); +uLong ZCALLBACK fwrite_buf_func OF((voidpf opaque,voidpf stream,const void* buf,uLong size)); +long ZCALLBACK ftell_buf_func OF((voidpf opaque,voidpf stream)); +ZPOS64_T ZCALLBACK ftell64_buf_func OF((voidpf opaque, voidpf stream)); +long ZCALLBACK fseek_buf_func OF((voidpf opaque,voidpf stream,uLong offset,int origin)); +long ZCALLBACK fseek64_buf_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); +int ZCALLBACK fclose_buf_func OF((voidpf opaque,voidpf stream)); +int ZCALLBACK ferror_buf_func OF((voidpf opaque,voidpf stream)); + +typedef struct ourbuffer_s { + zlib_filefunc_def filefunc; + zlib_filefunc64_def filefunc64; +} ourbuffer_t; + +void fill_buffer_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def, ourbuffer_t *ourbuf)); +void fill_buffer_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def, ourbuffer_t *ourbuf)); + +#ifdef __cplusplus +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/unzip.h",".h","14443","320","/* unzip.h -- IO for uncompress .zip files using zlib + Version 1.1, February 14h, 2010 + part of the MiniZip project + + Copyright (C) 1998-2010 Gilles Vollant + http://www.winimage.com/zLibDll/minizip.html + Modifications of Unzip for Zip64 + Copyright (C) 2007-2008 Even Rouault + Modifications for Zip64 support on both zip and unzip + Copyright (C) 2009-2010 Mathias Svensson + http://result42.com + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. +*/ + +#ifndef _UNZ_H +#define _UNZ_H + +#ifdef __cplusplus +extern ""C"" { +#endif + +#ifndef _ZLIB_H +#include ""zlib.h"" +#endif + +#ifndef _ZLIBIOAPI_H +#include ""ioapi.h"" +#endif + +#ifdef HAVE_BZIP2 +#include ""bzlib.h"" +#endif + +#define Z_BZIP2ED 12 + +#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) +/* like the STRICT of WIN32, we define a pointer that cannot be converted + from (void*) without cast */ +typedef struct TagunzFile__ { int unused; } unzFile__; +typedef unzFile__ *unzFile; +#else +typedef voidp unzFile; +#endif + +#define UNZ_OK (0) +#define UNZ_END_OF_LIST_OF_FILE (-100) +#define UNZ_ERRNO (Z_ERRNO) +#define UNZ_EOF (0) +#define UNZ_PARAMERROR (-102) +#define UNZ_BADZIPFILE (-103) +#define UNZ_INTERNALERROR (-104) +#define UNZ_CRCERROR (-105) + +/* tm_unz contain date/time info */ +typedef struct tm_unz_s +{ + uInt tm_sec; /* seconds after the minute - [0,59] */ + uInt tm_min; /* minutes after the hour - [0,59] */ + uInt tm_hour; /* hours since midnight - [0,23] */ + uInt tm_mday; /* day of the month - [1,31] */ + uInt tm_mon; /* months since January - [0,11] */ + uInt tm_year; /* years - [1980..2044] */ +} tm_unz; + +/* unz_global_info structure contain global data about the ZIPfile + These data comes from the end of central dir */ +typedef struct unz_global_info64_s +{ + ZPOS64_T number_entry; /* total number of entries in the central dir on this disk */ + uLong number_disk_with_CD; /* number the the disk with central dir, used for spanning ZIP*/ + uLong size_comment; /* size of the global comment of the zipfile */ +} unz_global_info64; + +typedef struct unz_global_info_s +{ + uLong number_entry; /* total number of entries in the central dir on this disk */ + uLong number_disk_with_CD; /* number the the disk with central dir, used for spanning ZIP*/ + uLong size_comment; /* size of the global comment of the zipfile */ +} unz_global_info; + +/* unz_file_info contain information about a file in the zipfile */ +typedef struct unz_file_info64_s +{ + uLong version; /* version made by 2 bytes */ + uLong version_needed; /* version needed to extract 2 bytes */ + uLong flag; /* general purpose bit flag 2 bytes */ + uLong compression_method; /* compression method 2 bytes */ + uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ + uLong crc; /* crc-32 4 bytes */ + ZPOS64_T compressed_size; /* compressed size 8 bytes */ + ZPOS64_T uncompressed_size; /* uncompressed size 8 bytes */ + uLong size_filename; /* filename length 2 bytes */ + uLong size_file_extra; /* extra field length 2 bytes */ + uLong size_file_comment; /* file comment length 2 bytes */ + + uLong disk_num_start; /* disk number start 2 bytes */ + uLong internal_fa; /* internal file attributes 2 bytes */ + uLong external_fa; /* external file attributes 4 bytes */ + + tm_unz tmu_date; + ZPOS64_T disk_offset; + uLong size_file_extra_internal; +} unz_file_info64; + +typedef struct unz_file_info_s +{ + uLong version; /* version made by 2 bytes */ + uLong version_needed; /* version needed to extract 2 bytes */ + uLong flag; /* general purpose bit flag 2 bytes */ + uLong compression_method; /* compression method 2 bytes */ + uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ + uLong crc; /* crc-32 4 bytes */ + uLong compressed_size; /* compressed size 4 bytes */ + uLong uncompressed_size; /* uncompressed size 4 bytes */ + uLong size_filename; /* filename length 2 bytes */ + uLong size_file_extra; /* extra field length 2 bytes */ + uLong size_file_comment; /* file comment length 2 bytes */ + + uLong disk_num_start; /* disk number start 2 bytes */ + uLong internal_fa; /* internal file attributes 2 bytes */ + uLong external_fa; /* external file attributes 4 bytes */ + + tm_unz tmu_date; + uLong disk_offset; +} unz_file_info; + +/***************************************************************************/ +/* Opening and close a zip file */ + +extern unzFile ZEXPORT unzOpen OF((const char *path)); +extern unzFile ZEXPORT unzOpen64 OF((const void *path)); +/* Open a Zip file. + + path should contain the full pathname (by example, on a Windows XP computer + ""c:\\zlib\\zlib113.zip"" or on an Unix computer ""zlib/zlib113.zip"". + return NULL if zipfile cannot be opened or doesn't exist + return unzFile handle if no error + + NOTE: The ""64"" function take a const void* pointer, because the path is just the value passed to the + open64_file_func callback. Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path + is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char* does not describe the reality */ + +extern unzFile ZEXPORT unzOpen2 OF((const char *path, zlib_filefunc_def* pzlib_filefunc_def)); +/* Open a Zip file, like unzOpen, but provide a set of file low level API for read/write operations */ +extern unzFile ZEXPORT unzOpen2_64 OF((const void *path, zlib_filefunc64_def* pzlib_filefunc_def)); +/* Open a Zip file, like unz64Open, but provide a set of file low level API for read/write 64-bit operations */ + +extern int ZEXPORT unzClose OF((unzFile file)); +/* Close a ZipFile opened with unzOpen. If there is files inside the .Zip opened with unzOpenCurrentFile, + these files MUST be closed with unzipCloseCurrentFile before call unzipClose. + + return UNZ_OK if there is no error */ + +extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, unz_global_info *pglobal_info)); +extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file, unz_global_info64 *pglobal_info)); +/* Write info about the ZipFile in the *pglobal_info structure. + + return UNZ_OK if no error */ + +extern int ZEXPORT unzGetGlobalComment OF((unzFile file, char *comment, uLong comment_size)); +/* Get the global comment string of the ZipFile, in the comment buffer. + + uSizeBuf is the size of the szComment buffer. + return the number of byte copied or an error code <0 */ + +/***************************************************************************/ +/* Reading the content of the current zipfile, you can open it, read data from it, and close it + (you can close it before reading all the file) */ + +extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); +/* Open for reading data the current file in the zipfile. + + return UNZ_OK if no error */ + +extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, const char* password)); +/* Open for reading data the current file in the zipfile. + password is a crypting password + + return UNZ_OK if no error */ + +extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, int* method, int* level, int raw)); +/* Same as unzOpenCurrentFile, but open for read raw the file (not uncompress) + if raw==1 *method will receive method of compression, *level will receive level of compression + + NOTE: you can set level parameter as NULL (if you did not want known level, + but you CANNOT set method parameter as NULL */ + +extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, int* method, int* level, int raw, const char* password)); +/* Same as unzOpenCurrentFile, but takes extra parameter password for encrypted files */ + +extern int ZEXPORT unzReadCurrentFile OF((unzFile file, voidp buf, unsigned len)); +/* Read bytes from the current file (opened by unzOpenCurrentFile) + buf contain buffer where data must be copied + len the size of buf. + + return the number of byte copied if somes bytes are copied + return 0 if the end of file was reached + return <0 with error code if there is an error (UNZ_ERRNO for IO error, or zLib error for uncompress error) */ + +extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, unz_file_info *pfile_info, char *filename, + uLong filename_size, void *extrafield, uLong extrafield_size, char *comment, uLong comment_size)); +extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file, unz_file_info64 *pfile_info, char *filename, + uLong filename_size, void *extrafield, uLong extrafield_size, char *comment, uLong comment_size)); +/* Get Info about the current file + + pfile_info if != NULL, the *pfile_info structure will contain somes info about the current file + filename if != NULL, the file name string will be copied in filename + filename_size is the size of the filename buffer + extrafield if != NULL, the extra field information from the central header will be copied in to + extrafield_size is the size of the extraField buffer + comment if != NULL, the comment string of the file will be copied in to + comment_size is the size of the comment buffer */ + +extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); + +extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, voidp buf, unsigned len)); +/* Read extra field from the current file (opened by unzOpenCurrentFile) + This is the local-header version of the extra field (sometimes, there is + more info in the local-header version than in the central-header) + + if buf == NULL, it return the size of the local extra field + if buf != NULL, len is the size of the buffer, the extra header is copied in buf. + + return number of bytes copied in buf, or (if <0) the error code */ + +extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); +/* Close the file in zip opened with unzOpenCurrentFile + + return UNZ_CRCERROR if all the file was read but the CRC is not good */ + +/***************************************************************************/ +/* Browse the directory of the zipfile */ + +typedef int (*unzFileNameComparer)(unzFile file, const char *filename1, const char *filename2); +typedef int (*unzIteratorFunction)(unzFile file); +typedef int (*unzIteratorFunction2)(unzFile file, unz_file_info64 *pfile_info, char *filename, + uLong filename_size, void *extrafield, uLong extrafield_size, char *comment, uLong comment_size); + +extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); +/* Set the current file of the zipfile to the first file. + + return UNZ_OK if no error */ + +extern int ZEXPORT unzGoToFirstFile2 OF((unzFile file, unz_file_info64 *pfile_info, char *filename, + uLong filename_size, void *extrafield, uLong extrafield_size, char *comment, uLong comment_size)); +/* Set the current file of the zipfile to the first file and retrieves the current info on success. + Not as seek intensive as unzGoToFirstFile + unzGetCurrentFileInfo. + + return UNZ_OK if no error */ + +extern int ZEXPORT unzGoToNextFile OF((unzFile file)); +/* Set the current file of the zipfile to the next file. + + return UNZ_OK if no error + return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest */ + +extern int ZEXPORT unzGoToNextFile2 OF((unzFile file, unz_file_info64 *pfile_info, char *filename, + uLong filename_size, void *extrafield, uLong extrafield_size, char *comment, uLong comment_size)); +/* Set the current file of the zipfile to the next file and retrieves the current + info on success. Does less seeking around than unzGotoNextFile + unzGetCurrentFileInfo. + + return UNZ_OK if no error + return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest */ + +extern int ZEXPORT unzLocateFile OF((unzFile file, const char *filename, unzFileNameComparer filename_compare_func)); +/* Try locate the file szFileName in the zipfile. For custom filename comparison pass in comparison function. + + return UNZ_OK if the file is found (it becomes the current file) + return UNZ_END_OF_LIST_OF_FILE if the file is not found */ + +/***************************************************************************/ +/* Raw access to zip file */ + +typedef struct unz_file_pos_s +{ + uLong pos_in_zip_directory; /* offset in zip file directory */ + uLong num_of_file; /* # of file */ +} unz_file_pos; + +extern int ZEXPORT unzGetFilePos OF((unzFile file, unz_file_pos* file_pos)); +extern int ZEXPORT unzGoToFilePos OF((unzFile file, unz_file_pos* file_pos)); + +typedef struct unz64_file_pos_s +{ + ZPOS64_T pos_in_zip_directory; /* offset in zip file directory */ + ZPOS64_T num_of_file; /* # of file */ +} unz64_file_pos; + +extern int ZEXPORT unzGetFilePos64 OF((unzFile file, unz64_file_pos* file_pos)); +extern int ZEXPORT unzGoToFilePos64 OF((unzFile file, const unz64_file_pos* file_pos)); + +extern uLong ZEXPORT unzGetOffset OF((unzFile file)); +extern ZPOS64_T ZEXPORT unzGetOffset64 OF((unzFile file)); +/* Get the current file offset */ + +extern int ZEXPORT unzSetOffset OF((unzFile file, uLong pos)); +extern int ZEXPORT unzSetOffset64 OF((unzFile file, ZPOS64_T pos)); +/* Set the current file offset */ + +extern z_off_t ZEXPORT unztell OF((unzFile file)); +extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file)); +/* return current position in uncompressed data */ + +extern int ZEXPORT unzseek OF((unzFile file, z_off_t offset, int origin)); +extern int ZEXPORT unzseek64 OF((unzFile file, ZPOS64_T offset, int origin)); +/* Seek within the uncompressed data if compression method is storage */ + +extern int ZEXPORT unzeof OF((unzFile file)); +/* return 1 if the end of file was reached, 0 elsewhere */ + +/***************************************************************************/ + +#ifdef __cplusplus +} +#endif + +#endif /* _UNZ_H */ +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/unzip.c",".c","71537","1953","/* unzip.c -- IO for uncompress .zip files using zlib + Version 1.1, February 14h, 2010 + part of the MiniZip project + + Copyright (C) 1998-2010 Gilles Vollant + http://www.winimage.com/zLibDll/minizip.html + Modifications of Unzip for Zip64 + Copyright (C) 2007-2008 Even Rouault + Modifications for Zip64 support on both zip and unzip + Copyright (C) 2009-2010 Mathias Svensson + http://result42.com + Modifications for AES, PKWARE disk spanning + Copyright (C) 2010-2014 Nathan Moinvaziri + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. + + Mar 8th, 2016 - Lucio Cosmo + Fixed support for 64bit builds for archives with ""PKWARE"" password. + Changed long, unsigned long, unsigned to unsigned int in + access functions to crctables and pkeys +*/ + +#include +#include +#include + +/*#ifndef NOUNCRYPT +# define NOUNCRYPT +#endif*/ + +#include ""zlib.h"" +#include ""unzip.h"" + +#ifdef STDC +# include +# include +# include +#endif +#ifdef NO_ERRNO_H + extern int errno; +#else +# include +#endif + +#ifdef HAVE_AES +# define AES_METHOD (99) +# define AES_PWVERIFYSIZE (2) +# define AES_MAXSALTLENGTH (16) +# define AES_AUTHCODESIZE (10) +# define AES_HEADERSIZE (11) +# define AES_KEYSIZE(mode) (64 + (mode * 64)) + +# include ""aes/aes.h"" +# include ""aes/fileenc.h"" +#endif +#ifndef NOUNCRYPT +# include ""crypt.h"" +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +#define DISKHEADERMAGIC (0x08074b50) +#define LOCALHEADERMAGIC (0x04034b50) +#define CENTRALHEADERMAGIC (0x02014b50) +#define ENDHEADERMAGIC (0x06054b50) +#define ZIP64ENDHEADERMAGIC (0x06064b50) +#define ZIP64ENDLOCHEADERMAGIC (0x07064b50) + +#define SIZECENTRALDIRITEM (0x2e) +#define SIZECENTRALHEADERLOCATOR (0x14) /* 20 */ +#define SIZEZIPLOCALHEADER (0x1e) + +#ifndef BUFREADCOMMENT +# define BUFREADCOMMENT (0x400) +#endif + +#ifndef UNZ_BUFSIZE +# define UNZ_BUFSIZE (64 * 1024) +#endif +#ifndef UNZ_MAXFILENAMEINZIP +# define UNZ_MAXFILENAMEINZIP (256) +#endif + +#ifndef ALLOC +# define ALLOC(size) (malloc(size)) +#endif +#ifndef TRYFREE +# define TRYFREE(p) {if (p) free(p);} +#endif + +const char unz_copyright[] = + "" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll""; + +/* unz_file_info_interntal contain internal info about a file in zipfile*/ +typedef struct unz_file_info64_internal_s +{ + ZPOS64_T offset_curfile; /* relative offset of local header 8 bytes */ + ZPOS64_T byte_before_the_zipfile; /* byte before the zipfile, (>0 for sfx) */ +#ifdef HAVE_AES + uLong aes_encryption_mode; + uLong aes_compression_method; + uLong aes_version; +#endif +} unz_file_info64_internal; + +/* file_in_zip_read_info_s contain internal information about a file in zipfile */ +typedef struct +{ + Bytef *read_buffer; /* internal buffer for compressed data */ + z_stream stream; /* zLib stream structure for inflate */ + +#ifdef HAVE_BZIP2 + bz_stream bstream; /* bzLib stream structure for bziped */ +#endif +#ifdef HAVE_AES + fcrypt_ctx aes_ctx; +#endif + + ZPOS64_T pos_in_zipfile; /* position in byte on the zipfile, for fseek */ + uLong stream_initialised; /* flag set if stream structure is initialised */ + + ZPOS64_T offset_local_extrafield; /* offset of the local extra field */ + uInt size_local_extrafield; /* size of the local extra field */ + ZPOS64_T pos_local_extrafield; /* position in the local extra field in read */ + ZPOS64_T total_out_64; + + uLong crc32; /* crc32 of all data uncompressed */ + uLong crc32_wait; /* crc32 we must obtain after decompress all */ + ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */ + ZPOS64_T rest_read_uncompressed; /* number of byte to be obtained after decomp */ + + zlib_filefunc64_32_def z_filefunc; + + voidpf filestream; /* io structore of the zipfile */ + uLong compression_method; /* compression method (0==store) */ + ZPOS64_T byte_before_the_zipfile; /* byte before the zipfile, (>0 for sfx) */ + int raw; +} file_in_zip64_read_info_s; + +/* unz64_s contain internal information about the zipfile */ +typedef struct +{ + zlib_filefunc64_32_def z_filefunc; + voidpf filestream; /* io structure of the current zipfile */ + voidpf filestream_with_CD; /* io structure of the disk with the central directory */ + unz_global_info64 gi; /* public global information */ + ZPOS64_T byte_before_the_zipfile; /* byte before the zipfile, (>0 for sfx)*/ + ZPOS64_T num_file; /* number of the current file in the zipfile*/ + ZPOS64_T pos_in_central_dir; /* pos of the current file in the central dir*/ + ZPOS64_T current_file_ok; /* flag about the usability of the current file*/ + ZPOS64_T central_pos; /* position of the beginning of the central dir*/ + uLong number_disk; /* number of the current disk, used for spanning ZIP*/ + ZPOS64_T size_central_dir; /* size of the central directory */ + ZPOS64_T offset_central_dir; /* offset of start of central directory with + respect to the starting disk number */ + + unz_file_info64 cur_file_info; /* public info about the current file in zip*/ + unz_file_info64_internal cur_file_info_internal; + /* private info about it*/ + file_in_zip64_read_info_s* pfile_in_zip_read; + /* structure about the current file if we are decompressing it */ + int isZip64; /* is the current file zip64 */ +#ifndef NOUNCRYPT + unsigned int keys[3]; /* keys defining the pseudo-random sequence */ + const unsigned int* pcrc_32_tab; +#endif +} unz64_s; + +/* Translate date/time from Dos format to tm_unz (readable more easily) */ +local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm) +{ + ZPOS64_T uDate = (ZPOS64_T)(ulDosDate>>16); + + ptm->tm_mday = (uInt)(uDate&0x1f); + ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1); + ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980); + ptm->tm_hour = (uInt)((ulDosDate &0xF800)/0x800); + ptm->tm_min = (uInt)((ulDosDate&0x7E0)/0x20); + ptm->tm_sec = (uInt)(2*(ulDosDate&0x1f)); + +#define unz64local_in_range(min, max, value) ((min) <= (value) && (value) <= (max)) + if (!unz64local_in_range(0, 11, ptm->tm_mon) || + !unz64local_in_range(1, 31, ptm->tm_mday) || + !unz64local_in_range(0, 23, ptm->tm_hour) || + !unz64local_in_range(0, 59, ptm->tm_min) || + !unz64local_in_range(0, 59, ptm->tm_sec)) + /* Invalid date stored, so don't return it. */ + memset(ptm, 0, sizeof(tm_unz)); +#undef unz64local_in_range +} + +/* Read a byte from a gz_stream; Return EOF for end of file. */ +local int unz64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)); +local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi) +{ + unsigned char c; + int err = (int)ZREAD64(*pzlib_filefunc_def, filestream, &c, 1); + if (err == 1) + { + *pi = (int)c; + return UNZ_OK; + } + *pi = 0; + if (ZERROR64(*pzlib_filefunc_def, filestream)) + return UNZ_ERRNO; + return UNZ_EOF; +} + +local int unz64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX)); +local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX) +{ + uLong x; + int i = 0; + int err; + + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x = (uLong)i; + if (err == UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x |= ((uLong)i)<<8; + + if (err == UNZ_OK) + *pX = x; + else + *pX = 0; + return err; +} + +local int unz64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX)); +local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX) +{ + uLong x; + int i = 0; + int err; + + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x = (uLong)i; + if (err == UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x |= ((uLong)i)<<8; + if (err == UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x |= ((uLong)i)<<16; + if (err == UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x += ((uLong)i)<<24; + + if (err == UNZ_OK) + *pX = x; + else + *pX = 0; + return err; +} + +local int unz64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)); +local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) +{ + ZPOS64_T x; + int i = 0; + int err; + + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x = (ZPOS64_T)i; + if (err == UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x |= ((ZPOS64_T)i)<<8; + if (err == UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x |= ((ZPOS64_T)i)<<16; + if (err == UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x |= ((ZPOS64_T)i)<<24; + if (err == UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x |= ((ZPOS64_T)i)<<32; + if (err == UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x |= ((ZPOS64_T)i)<<40; + if (err == UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x |= ((ZPOS64_T)i)<<48; + if (err == UNZ_OK) + err = unz64local_getByte(pzlib_filefunc_def, filestream, &i); + x |= ((ZPOS64_T)i)<<56; + + if (err == UNZ_OK) + *pX = x; + else + *pX = 0; + return err; +} + +/* Locate the Central directory of a zip file (at the end, just before the global comment) */ +local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); +local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) +{ + unsigned char* buf; + ZPOS64_T file_size; + ZPOS64_T back_read = 4; + ZPOS64_T max_back = 0xffff; /* maximum size of global comment */ + ZPOS64_T pos_found = 0; + uLong read_size; + ZPOS64_T read_pos; + int i; + + buf = (unsigned char*)ALLOC(BUFREADCOMMENT + 4); + if (buf == NULL) + return 0; + + if (ZSEEK64(*pzlib_filefunc_def, filestream, 0, ZLIB_FILEFUNC_SEEK_END) != 0) + { + TRYFREE(buf); + return 0; + } + + file_size = ZTELL64(*pzlib_filefunc_def, filestream); + + if (max_back > file_size) + max_back = file_size; + + while (back_read < max_back) + { + if (back_read + BUFREADCOMMENT > max_back) + back_read = max_back; + else + back_read += BUFREADCOMMENT; + + read_pos = file_size - back_read; + read_size = ((BUFREADCOMMENT + 4) < (file_size - read_pos)) ? + (BUFREADCOMMENT + 4) : (uLong)(file_size - read_pos); + + if (ZSEEK64(*pzlib_filefunc_def, filestream, read_pos, ZLIB_FILEFUNC_SEEK_SET) != 0) + break; + if (ZREAD64(*pzlib_filefunc_def, filestream, buf, read_size) != read_size) + break; + + for (i = (int)read_size-3; (i--) > 0;) + if (((*(buf+i)) == (ENDHEADERMAGIC & 0xff)) && + ((*(buf+i+1)) == (ENDHEADERMAGIC >> 8 & 0xff)) && + ((*(buf+i+2)) == (ENDHEADERMAGIC >> 16 & 0xff)) && + ((*(buf+i+3)) == (ENDHEADERMAGIC >> 24 & 0xff))) + { + pos_found = read_pos+i; + break; + } + + if (pos_found != 0) + break; + } + TRYFREE(buf); + return pos_found; +} + +/* Locate the Central directory 64 of a zipfile (at the end, just before the global comment) */ +local ZPOS64_T unz64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, + const ZPOS64_T endcentraloffset)); +local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, + const ZPOS64_T endcentraloffset) +{ + ZPOS64_T offset; + uLong uL; + + /* Zip64 end of central directory locator */ + if (ZSEEK64(*pzlib_filefunc_def, filestream, endcentraloffset - SIZECENTRALHEADERLOCATOR, ZLIB_FILEFUNC_SEEK_SET) != 0) + return 0; + + /* read locator signature */ + if (unz64local_getLong(pzlib_filefunc_def, filestream, &uL) != UNZ_OK) + return 0; + if (uL != ZIP64ENDLOCHEADERMAGIC) + return 0; + /* number of the disk with the start of the zip64 end of central directory */ + if (unz64local_getLong(pzlib_filefunc_def, filestream, &uL) != UNZ_OK) + return 0; + /* relative offset of the zip64 end of central directory record */ + if (unz64local_getLong64(pzlib_filefunc_def, filestream, &offset) != UNZ_OK) + return 0; + /* total number of disks */ + if (unz64local_getLong(pzlib_filefunc_def, filestream, &uL) != UNZ_OK) + return 0; + /* Goto end of central directory record */ + if (ZSEEK64(*pzlib_filefunc_def, filestream, offset, ZLIB_FILEFUNC_SEEK_SET) != 0) + return 0; + /* the signature */ + if (unz64local_getLong(pzlib_filefunc_def, filestream, &uL) != UNZ_OK) + return 0; + if (uL != ZIP64ENDHEADERMAGIC) + return 0; + + return offset; +} + +local unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) +{ + unz64_s us; + unz64_s *s; + ZPOS64_T central_pos; + ZPOS64_T central_pos64; + uLong uL; + ZPOS64_T uL64; + voidpf filestream = NULL; + ZPOS64_T number_entry_CD; + int err = UNZ_OK; + + if (unz_copyright[0]!=' ') + return NULL; + + us.filestream = NULL; + us.filestream_with_CD = NULL; + us.z_filefunc.zseek32_file = NULL; + us.z_filefunc.ztell32_file = NULL; + if (pzlib_filefunc64_32_def == NULL) + fill_fopen64_filefunc(&us.z_filefunc.zfile_func64); + else + us.z_filefunc = *pzlib_filefunc64_32_def; + + us.filestream = ZOPEN64(us.z_filefunc, path, ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_EXISTING); + + if (us.filestream == NULL) + return NULL; + + us.filestream_with_CD = us.filestream; + us.isZip64 = 0; + + /* Search for end of central directory header */ + central_pos = unz64local_SearchCentralDir(&us.z_filefunc, us.filestream); + if (central_pos) + { + if (ZSEEK64(us.z_filefunc, us.filestream, central_pos, ZLIB_FILEFUNC_SEEK_SET) != 0) + err = UNZ_ERRNO; + + /* the signature, already checked */ + if (unz64local_getLong(&us.z_filefunc, us.filestream, &uL) != UNZ_OK) + err = UNZ_ERRNO; + /* number of this disk */ + if (unz64local_getShort(&us.z_filefunc, us.filestream, &uL) != UNZ_OK) + err = UNZ_ERRNO; + us.number_disk = uL; + /* number of the disk with the start of the central directory */ + if (unz64local_getShort(&us.z_filefunc, us.filestream,& uL) != UNZ_OK) + err = UNZ_ERRNO; + us.gi.number_disk_with_CD = uL; + /* total number of entries in the central directory on this disk */ + if (unz64local_getShort(&us.z_filefunc, us.filestream, &uL) != UNZ_OK) + err = UNZ_ERRNO; + us.gi.number_entry = uL; + /* total number of entries in the central directory */ + if (unz64local_getShort(&us.z_filefunc, us.filestream, &uL) != UNZ_OK) + err = UNZ_ERRNO; + number_entry_CD = uL; + if (number_entry_CD != us.gi.number_entry) + err = UNZ_BADZIPFILE; + /* size of the central directory */ + if (unz64local_getLong(&us.z_filefunc, us.filestream, &uL) != UNZ_OK) + err = UNZ_ERRNO; + us.size_central_dir = uL; + /* offset of start of central directory with respect to the starting disk number */ + if (unz64local_getLong(&us.z_filefunc, us.filestream, &uL) != UNZ_OK) + err = UNZ_ERRNO; + us.offset_central_dir = uL; + /* zipfile comment length */ + if (unz64local_getShort(&us.z_filefunc, us.filestream, &us.gi.size_comment) != UNZ_OK) + err = UNZ_ERRNO; + + if (err == UNZ_OK) + { + /* Search for Zip64 end of central directory header */ + central_pos64 = unz64local_SearchCentralDir64(&us.z_filefunc, us.filestream, central_pos); + if (central_pos64) + { + central_pos = central_pos64; + us.isZip64 = 1; + + if (ZSEEK64(us.z_filefunc, us.filestream, central_pos, ZLIB_FILEFUNC_SEEK_SET) != 0) + err = UNZ_ERRNO; + + /* the signature, already checked */ + if (unz64local_getLong(&us.z_filefunc, us.filestream, &uL) != UNZ_OK) + err = UNZ_ERRNO; + /* size of zip64 end of central directory record */ + if (unz64local_getLong64(&us.z_filefunc, us.filestream, &uL64) != UNZ_OK) + err = UNZ_ERRNO; + /* version made by */ + if (unz64local_getShort(&us.z_filefunc, us.filestream, &uL) != UNZ_OK) + err = UNZ_ERRNO; + /* version needed to extract */ + if (unz64local_getShort(&us.z_filefunc, us.filestream, &uL) != UNZ_OK) + err = UNZ_ERRNO; + /* number of this disk */ + if (unz64local_getLong(&us.z_filefunc, us.filestream, &us.number_disk) != UNZ_OK) + err = UNZ_ERRNO; + /* number of the disk with the start of the central directory */ + if (unz64local_getLong(&us.z_filefunc, us.filestream, &us.gi.number_disk_with_CD) != UNZ_OK) + err = UNZ_ERRNO; + /* total number of entries in the central directory on this disk */ + if (unz64local_getLong64(&us.z_filefunc, us.filestream, &us.gi.number_entry) != UNZ_OK) + err = UNZ_ERRNO; + /* total number of entries in the central directory */ + if (unz64local_getLong64(&us.z_filefunc, us.filestream, &number_entry_CD) != UNZ_OK) + err = UNZ_ERRNO; + if (number_entry_CD != us.gi.number_entry) + err = UNZ_BADZIPFILE; + /* size of the central directory */ + if (unz64local_getLong64(&us.z_filefunc, us.filestream, &us.size_central_dir) != UNZ_OK) + err = UNZ_ERRNO; + /* offset of start of central directory with respect to the starting disk number */ + if (unz64local_getLong64(&us.z_filefunc, us.filestream, &us.offset_central_dir) != UNZ_OK) + err = UNZ_ERRNO; + } + else if ((us.gi.number_entry == 0xffff) || (us.size_central_dir == 0xffff) || (us.offset_central_dir == 0xffffffff)) + err = UNZ_BADZIPFILE; + } + } + else + err = UNZ_ERRNO; + + if ((err == UNZ_OK) && (central_pos < us.offset_central_dir + us.size_central_dir)) + err = UNZ_BADZIPFILE; + + if (err != UNZ_OK) + { + ZCLOSE64(us.z_filefunc, us.filestream); + return NULL; + } + + if (us.gi.number_disk_with_CD == 0) + { + /* If there is only one disk open another stream so we don't have to seek between the CD + and the file headers constantly */ + filestream = ZOPEN64(us.z_filefunc, path, ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_EXISTING); + if (filestream != NULL) + us.filestream = filestream; + } + + /* Hack for zip files that have no respect for zip64 + if ((central_pos > 0xffffffff) && (us.offset_central_dir < 0xffffffff)) + us.offset_central_dir = central_pos - us.size_central_dir;*/ + + us.byte_before_the_zipfile = central_pos - (us.offset_central_dir + us.size_central_dir); + us.central_pos = central_pos; + us.pfile_in_zip_read = NULL; + + s = (unz64_s*)ALLOC(sizeof(unz64_s)); + if (s != NULL) + { + *s = us; + unzGoToFirstFile((unzFile)s); + } + return (unzFile)s; +} + +extern unzFile ZEXPORT unzOpen2(const char *path, zlib_filefunc_def* pzlib_filefunc32_def) +{ + if (pzlib_filefunc32_def != NULL) + { + zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; + fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill, pzlib_filefunc32_def); + return unzOpenInternal(path, &zlib_filefunc64_32_def_fill); + } + return unzOpenInternal(path, NULL); +} + +extern unzFile ZEXPORT unzOpen2_64(const void *path, zlib_filefunc64_def* pzlib_filefunc_def) +{ + if (pzlib_filefunc_def != NULL) + { + zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; + zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def; + zlib_filefunc64_32_def_fill.ztell32_file = NULL; + zlib_filefunc64_32_def_fill.zseek32_file = NULL; + return unzOpenInternal(path, &zlib_filefunc64_32_def_fill); + } + return unzOpenInternal(path, NULL); +} + +extern unzFile ZEXPORT unzOpen(const char *path) +{ + return unzOpenInternal(path, NULL); +} + +extern unzFile ZEXPORT unzOpen64(const void *path) +{ + return unzOpenInternal(path, NULL); +} + +extern int ZEXPORT unzClose(unzFile file) +{ + unz64_s* s; + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + + if (s->pfile_in_zip_read != NULL) + unzCloseCurrentFile(file); + + if ((s->filestream != NULL) && (s->filestream != s->filestream_with_CD)) + ZCLOSE64(s->z_filefunc, s->filestream); + if (s->filestream_with_CD != NULL) + ZCLOSE64(s->z_filefunc, s->filestream_with_CD); + + s->filestream = NULL; + s->filestream_with_CD = NULL; + TRYFREE(s); + return UNZ_OK; +} + +/* Goto to the next available disk for spanned archives */ +local int unzGoToNextDisk OF((unzFile file)); +local int unzGoToNextDisk(unzFile file) +{ + unz64_s* s; + uLong number_disk_next = 0; + + s = (unz64_s*)file; + if (s == NULL) + return UNZ_PARAMERROR; + number_disk_next = s->number_disk; + + if ((s->pfile_in_zip_read != NULL) && (s->pfile_in_zip_read->rest_read_uncompressed > 0)) + /* We are currently reading a file and we need the next sequential disk */ + number_disk_next += 1; + else + /* Goto the disk for the current file */ + number_disk_next = s->cur_file_info.disk_num_start; + + if (number_disk_next != s->number_disk) + { + /* Switch disks */ + if ((s->filestream != NULL) && (s->filestream != s->filestream_with_CD)) + ZCLOSE64(s->z_filefunc, s->filestream); + + if (number_disk_next == s->gi.number_disk_with_CD) + { + s->filestream = s->filestream_with_CD; + } + else + { + s->filestream = ZOPENDISK64(s->z_filefunc, s->filestream_with_CD, number_disk_next, + ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_EXISTING); + } + + if (s->filestream == NULL) + return UNZ_ERRNO; + + s->number_disk = number_disk_next; + } + + return UNZ_OK; +} + +extern int ZEXPORT unzGetGlobalInfo(unzFile file, unz_global_info* pglobal_info32) +{ + unz64_s* s; + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + /* to do : check if number_entry is not truncated */ + pglobal_info32->number_entry = (uLong)s->gi.number_entry; + pglobal_info32->size_comment = s->gi.size_comment; + pglobal_info32->number_disk_with_CD = s->gi.number_disk_with_CD; + return UNZ_OK; +} + +extern int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64* pglobal_info) +{ + unz64_s* s; + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + *pglobal_info = s->gi; + return UNZ_OK; +} + +extern int ZEXPORT unzGetGlobalComment(unzFile file, char *comment, uLong comment_size) +{ + unz64_s* s; + uLong bytes_to_read = comment_size; + if (file == NULL) + return (int)UNZ_PARAMERROR; + s = (unz64_s*)file; + + if (bytes_to_read > s->gi.size_comment) + bytes_to_read = s->gi.size_comment; + + if (ZSEEK64(s->z_filefunc, s->filestream_with_CD, s->central_pos + 22, ZLIB_FILEFUNC_SEEK_SET) != 0) + return UNZ_ERRNO; + + if (bytes_to_read>0) + { + *comment = 0; + if (ZREAD64(s->z_filefunc, s->filestream_with_CD, comment, bytes_to_read) != bytes_to_read) + return UNZ_ERRNO; + } + + if ((comment != NULL) && (comment_size > s->gi.size_comment)) + *(comment+s->gi.size_comment) = 0; + return (int)bytes_to_read; +} + +/* Get Info about the current file in the zipfile, with internal only info */ +local int unz64local_GetCurrentFileInfoInternal(unzFile file, unz_file_info64 *pfile_info, + unz_file_info64_internal *pfile_info_internal, char *filename, uLong filename_size, void *extrafield, + uLong extrafield_size, char *comment, uLong comment_size) +{ + unz64_s* s; + unz_file_info64 file_info; + unz_file_info64_internal file_info_internal; + ZPOS64_T bytes_to_read; + int err = UNZ_OK; + uLong uMagic; + long lSeek = 0; + ZPOS64_T current_pos = 0; + uLong acc = 0; + uLong uL; + ZPOS64_T uL64; + + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + + if (ZSEEK64(s->z_filefunc, s->filestream_with_CD, + s->pos_in_central_dir + s->byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0) + err = UNZ_ERRNO; + + /* Check the magic */ + if (err == UNZ_OK) + { + if (unz64local_getLong(&s->z_filefunc, s->filestream_with_CD, &uMagic) != UNZ_OK) + err = UNZ_ERRNO; + else if (uMagic != CENTRALHEADERMAGIC) + err = UNZ_BADZIPFILE; + } + + /* Read central directory header */ + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &file_info.version) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &file_info.version_needed) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &file_info.flag) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &file_info.compression_method) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getLong(&s->z_filefunc, s->filestream_with_CD, &file_info.dosDate) != UNZ_OK) + err = UNZ_ERRNO; + unz64local_DosDateToTmuDate(file_info.dosDate, &file_info.tmu_date); + if (unz64local_getLong(&s->z_filefunc, s->filestream_with_CD, &file_info.crc) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getLong(&s->z_filefunc, s->filestream_with_CD, &uL) != UNZ_OK) + err = UNZ_ERRNO; + file_info.compressed_size = uL; + if (unz64local_getLong(&s->z_filefunc, s->filestream_with_CD, &uL) != UNZ_OK) + err = UNZ_ERRNO; + file_info.uncompressed_size = uL; + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &file_info.size_filename) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &file_info.size_file_extra) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &file_info.size_file_comment) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &file_info.disk_num_start) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &file_info.internal_fa) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getLong(&s->z_filefunc, s->filestream_with_CD, &file_info.external_fa) != UNZ_OK) + err = UNZ_ERRNO; + /* Relative offset of local header */ + if (unz64local_getLong(&s->z_filefunc, s->filestream_with_CD, &uL) != UNZ_OK) + err = UNZ_ERRNO; + + file_info.size_file_extra_internal = 0; + file_info.disk_offset = uL; + file_info_internal.offset_curfile = uL; +#ifdef HAVE_AES + file_info_internal.aes_compression_method = 0; + file_info_internal.aes_encryption_mode = 0; + file_info_internal.aes_version = 0; +#endif + + lSeek += file_info.size_filename; + + if ((err == UNZ_OK) && (filename != NULL)) + { + if (file_info.size_filename < filename_size) + { + *(filename+file_info.size_filename) = 0; + bytes_to_read = file_info.size_filename; + } + else + bytes_to_read = filename_size; + + if ((file_info.size_filename > 0) && (filename_size > 0)) + if (ZREAD64(s->z_filefunc, s->filestream_with_CD,filename, (uLong)bytes_to_read) != bytes_to_read) + err = UNZ_ERRNO; + lSeek -= (uLong)bytes_to_read; + } + + /* Read extrafield */ + if ((err == UNZ_OK) && (extrafield != NULL)) + { + if (file_info.size_file_extra < extrafield_size) + bytes_to_read = file_info.size_file_extra; + else + bytes_to_read = extrafield_size; + + if (lSeek != 0) + { + if (ZSEEK64(s->z_filefunc, s->filestream_with_CD, lSeek, ZLIB_FILEFUNC_SEEK_CUR) == 0) + lSeek=0; + else + err = UNZ_ERRNO; + } + + if ((file_info.size_file_extra > 0) && (extrafield_size > 0)) + if (ZREAD64(s->z_filefunc, s->filestream_with_CD, extrafield, (uLong)bytes_to_read) != bytes_to_read) + err = UNZ_ERRNO; + lSeek += file_info.size_file_extra - (uLong)bytes_to_read; + } + else + lSeek += file_info.size_file_extra; + + if ((err == UNZ_OK) && (file_info.size_file_extra != 0)) + { + if (lSeek != 0) + { + if (ZSEEK64(s->z_filefunc, s->filestream_with_CD, lSeek, ZLIB_FILEFUNC_SEEK_CUR) == 0) + lSeek=0; + else + err = UNZ_ERRNO; + } + + /* We are going to parse the extra field so we need to move back */ + current_pos = ZTELL64(s->z_filefunc, s->filestream_with_CD); + if (current_pos < file_info.size_file_extra) + err = UNZ_ERRNO; + current_pos -= file_info.size_file_extra; + if (ZSEEK64(s->z_filefunc, s->filestream_with_CD, current_pos, ZLIB_FILEFUNC_SEEK_SET) != 0) + err = UNZ_ERRNO; + + while((err != UNZ_ERRNO) && (acc < file_info.size_file_extra)) + { + uLong headerid; + uLong datasize; + + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &headerid) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &datasize) != UNZ_OK) + err = UNZ_ERRNO; + + /* ZIP64 extra fields */ + if (headerid == 0x0001) + { + /* Subtract size of ZIP64 field, since ZIP64 is handled internally */ + file_info.size_file_extra_internal += 2 + 2 + datasize; + + if (file_info.uncompressed_size == 0xffffffff) + { + if (unz64local_getLong64(&s->z_filefunc, s->filestream_with_CD, &file_info.uncompressed_size) != UNZ_OK) + err = UNZ_ERRNO; + } + if (file_info.compressed_size == 0xffffffff) + { + if (unz64local_getLong64(&s->z_filefunc, s->filestream_with_CD, &file_info.compressed_size) != UNZ_OK) + err = UNZ_ERRNO; + } + if (file_info_internal.offset_curfile == 0xffffffff) + { + /* Relative Header offset */ + if (unz64local_getLong64(&s->z_filefunc, s->filestream_with_CD, &uL64) != UNZ_OK) + err = UNZ_ERRNO; + file_info_internal.offset_curfile = uL64; + file_info.disk_offset = uL64; + } + if (file_info.disk_num_start == 0xffffffff) + { + /* Disk Start Number */ + if (unz64local_getLong(&s->z_filefunc, s->filestream_with_CD, &file_info.disk_num_start) != UNZ_OK) + err = UNZ_ERRNO; + } + } +#ifdef HAVE_AES + /* AES header */ + else if (headerid == 0x9901) + { + /* Subtract size of AES field, since AES is handled internally */ + file_info.size_file_extra_internal += 2 + 2 + datasize; + + /* Verify version info */ + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &uL) != UNZ_OK) + err = UNZ_ERRNO; + /* Support AE-1 and AE-2 */ + if (uL != 1 && uL != 2) + err = UNZ_ERRNO; + file_info_internal.aes_version = uL; + if (unz64local_getByte(&s->z_filefunc, s->filestream_with_CD, &uL) != UNZ_OK) + err = UNZ_ERRNO; + if ((char)uL != 'A') + err = UNZ_ERRNO; + if (unz64local_getByte(&s->z_filefunc, s->filestream_with_CD, &uL) != UNZ_OK) + err = UNZ_ERRNO; + if ((char)uL != 'E') + err = UNZ_ERRNO; + /* Get AES encryption strength and actual compression method */ + if (unz64local_getByte(&s->z_filefunc, s->filestream_with_CD, &uL) != UNZ_OK) + err = UNZ_ERRNO; + file_info_internal.aes_encryption_mode = uL; + if (unz64local_getShort(&s->z_filefunc, s->filestream_with_CD, &uL) != UNZ_OK) + err = UNZ_ERRNO; + file_info_internal.aes_compression_method = uL; + } +#endif + else + { + if (ZSEEK64(s->z_filefunc, s->filestream_with_CD,datasize, ZLIB_FILEFUNC_SEEK_CUR) != 0) + err = UNZ_ERRNO; + } + + acc += 2 + 2 + datasize; + } + } + + if (file_info.disk_num_start == s->gi.number_disk_with_CD) + file_info_internal.byte_before_the_zipfile = s->byte_before_the_zipfile; + else + file_info_internal.byte_before_the_zipfile = 0; + + if ((err == UNZ_OK) && (comment != NULL)) + { + if (file_info.size_file_comment < comment_size) + { + *(comment+file_info.size_file_comment) = 0; + bytes_to_read = file_info.size_file_comment; + } + else + bytes_to_read = comment_size; + + if (lSeek != 0) + { + if (ZSEEK64(s->z_filefunc, s->filestream_with_CD, lSeek, ZLIB_FILEFUNC_SEEK_CUR) != 0) + err = UNZ_ERRNO; + } + + if ((file_info.size_file_comment > 0) && (comment_size > 0)) + if (ZREAD64(s->z_filefunc, s->filestream_with_CD, comment, (uLong)bytes_to_read) != bytes_to_read) + err = UNZ_ERRNO; + lSeek += file_info.size_file_comment - (uLong)bytes_to_read; + } + else + lSeek += file_info.size_file_comment; + + if ((err == UNZ_OK) && (pfile_info != NULL)) + *pfile_info = file_info; + + if ((err == UNZ_OK) && (pfile_info_internal != NULL)) + *pfile_info_internal = file_info_internal; + + return err; +} + +extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, unz_file_info * pfile_info, char *filename, + uLong filename_size, void *extrafield, uLong extrafield_size, char* comment, uLong comment_size) +{ + unz_file_info64 file_info64; + int err; + + err = unz64local_GetCurrentFileInfoInternal(file, &file_info64, NULL, filename, filename_size, + extrafield, extrafield_size, comment, comment_size); + + if ((err == UNZ_OK) && (pfile_info != NULL)) + { + pfile_info->version = file_info64.version; + pfile_info->version_needed = file_info64.version_needed; + pfile_info->flag = file_info64.flag; + pfile_info->compression_method = file_info64.compression_method; + pfile_info->dosDate = file_info64.dosDate; + pfile_info->crc = file_info64.crc; + + pfile_info->size_filename = file_info64.size_filename; + pfile_info->size_file_extra = file_info64.size_file_extra - file_info64.size_file_extra_internal; + pfile_info->size_file_comment = file_info64.size_file_comment; + + pfile_info->disk_num_start = file_info64.disk_num_start; + pfile_info->internal_fa = file_info64.internal_fa; + pfile_info->external_fa = file_info64.external_fa; + + pfile_info->tmu_date = file_info64.tmu_date, + + pfile_info->compressed_size = (uLong)file_info64.compressed_size; + pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size; + + } + return err; +} + +extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 * pfile_info, char *filename, + uLong filename_size, void *extrafield, uLong extrafield_size, char* comment, uLong comment_size) +{ + return unz64local_GetCurrentFileInfoInternal(file, pfile_info, NULL, filename, filename_size, + extrafield, extrafield_size, comment,comment_size); +} + +/* Read the local header of the current zipfile. Check the coherency of the local header and info in the + end of central directory about this file store in *piSizeVar the size of extra info in local header + (filename and size of extra field data) */ +local int unz64local_CheckCurrentFileCoherencyHeader(unz64_s* s, uInt* piSizeVar, ZPOS64_T *poffset_local_extrafield, + uInt *psize_local_extrafield) +{ + uLong uMagic, uL, uFlags; + uLong size_filename; + uLong size_extra_field; + int err = UNZ_OK; + int compression_method = 0; + + *piSizeVar = 0; + *poffset_local_extrafield = 0; + *psize_local_extrafield = 0; + + err = unzGoToNextDisk((unzFile)s); + if (err != UNZ_OK) + return err; + + if (ZSEEK64(s->z_filefunc, s->filestream, s->cur_file_info_internal.offset_curfile + + s->cur_file_info_internal.byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0) + return UNZ_ERRNO; + + if (err == UNZ_OK) + { + if (unz64local_getLong(&s->z_filefunc, s->filestream, &uMagic) != UNZ_OK) + err = UNZ_ERRNO; + else if (uMagic != LOCALHEADERMAGIC) + err = UNZ_BADZIPFILE; + } + + if (unz64local_getShort(&s->z_filefunc, s->filestream, &uL) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getShort(&s->z_filefunc, s->filestream, &uFlags) != UNZ_OK) + err = UNZ_ERRNO; + if (unz64local_getShort(&s->z_filefunc, s->filestream, &uL) != UNZ_OK) + err = UNZ_ERRNO; + else if ((err == UNZ_OK) && (uL != s->cur_file_info.compression_method)) + err = UNZ_BADZIPFILE; + + compression_method = (int)s->cur_file_info.compression_method; +#ifdef HAVE_AES + if (compression_method == AES_METHOD) + compression_method = (int)s->cur_file_info_internal.aes_compression_method; +#endif + + if ((err == UNZ_OK) && (compression_method != 0) && +#ifdef HAVE_BZIP2 + (compression_method != Z_BZIP2ED) && +#endif + (compression_method != Z_DEFLATED)) + err = UNZ_BADZIPFILE; + + if (unz64local_getLong(&s->z_filefunc, s->filestream, &uL) != UNZ_OK) /* date/time */ + err = UNZ_ERRNO; + if (unz64local_getLong(&s->z_filefunc, s->filestream, &uL) != UNZ_OK) /* crc */ + err = UNZ_ERRNO; + else if ((err == UNZ_OK) && (uL != s->cur_file_info.crc) && ((uFlags & 8) == 0)) + err = UNZ_BADZIPFILE; + if (unz64local_getLong(&s->z_filefunc, s->filestream, &uL) != UNZ_OK) /* size compr */ + err = UNZ_ERRNO; + else if ((uL != 0xffffffff) && (err == UNZ_OK) && (uL != s->cur_file_info.compressed_size) && ((uFlags & 8) == 0)) + err = UNZ_BADZIPFILE; + if (unz64local_getLong(&s->z_filefunc, s->filestream, &uL) != UNZ_OK) /* size uncompr */ + err = UNZ_ERRNO; + else if ((uL != 0xffffffff) && (err == UNZ_OK) && (uL != s->cur_file_info.uncompressed_size) && ((uFlags & 8) == 0)) + err = UNZ_BADZIPFILE; + if (unz64local_getShort(&s->z_filefunc, s->filestream, &size_filename) != UNZ_OK) + err = UNZ_ERRNO; + else if ((err == UNZ_OK) && (size_filename != s->cur_file_info.size_filename)) + err = UNZ_BADZIPFILE; + + *piSizeVar += (uInt)size_filename; + + if (unz64local_getShort(&s->z_filefunc, s->filestream, &size_extra_field) != UNZ_OK) + err = UNZ_ERRNO; + *poffset_local_extrafield = s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + size_filename; + *psize_local_extrafield = (uInt)size_extra_field; + + *piSizeVar += (uInt)size_extra_field; + + return err; +} + +/* + Open for reading data the current file in the zipfile. + If there is no error and the file is opened, the return value is UNZ_OK. +*/ +extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method, int* level, int raw, const char* password) +{ + int err = UNZ_OK; + int compression_method; + uInt iSizeVar; + unz64_s* s; + file_in_zip64_read_info_s* pfile_in_zip_read_info; + ZPOS64_T offset_local_extrafield; + uInt size_local_extrafield; +#ifndef NOUNCRYPT + char source[12]; +#else + if (password != NULL) + return UNZ_PARAMERROR; +#endif + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + if (!s->current_file_ok) + return UNZ_PARAMERROR; + + if (s->pfile_in_zip_read != NULL) + unzCloseCurrentFile(file); + + if (unz64local_CheckCurrentFileCoherencyHeader(s, &iSizeVar, &offset_local_extrafield, &size_local_extrafield) != UNZ_OK) + return UNZ_BADZIPFILE; + + pfile_in_zip_read_info = (file_in_zip64_read_info_s*)ALLOC(sizeof(file_in_zip64_read_info_s)); + if (pfile_in_zip_read_info == NULL) + return UNZ_INTERNALERROR; + + pfile_in_zip_read_info->read_buffer = (Bytef*)ALLOC(UNZ_BUFSIZE); + pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield; + pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield; + pfile_in_zip_read_info->pos_local_extrafield = 0; + pfile_in_zip_read_info->raw = raw; + + if (pfile_in_zip_read_info->read_buffer == NULL) + { + TRYFREE(pfile_in_zip_read_info); + return UNZ_INTERNALERROR; + } + + pfile_in_zip_read_info->stream_initialised = 0; + + compression_method = (int)s->cur_file_info.compression_method; +#ifdef HAVE_AES + if (compression_method == AES_METHOD) + compression_method = (int)s->cur_file_info_internal.aes_compression_method; +#endif + + if (method != NULL) + *method = compression_method; + + if (level != NULL) + { + *level = 6; + switch (s->cur_file_info.flag & 0x06) + { + case 6 : *level = 1; break; + case 4 : *level = 2; break; + case 2 : *level = 9; break; + } + } + + if ((compression_method != 0) && +#ifdef HAVE_BZIP2 + (compression_method != Z_BZIP2ED) && +#endif + (compression_method != Z_DEFLATED)) + err = UNZ_BADZIPFILE; + + pfile_in_zip_read_info->crc32_wait = s->cur_file_info.crc; + pfile_in_zip_read_info->crc32 = 0; + pfile_in_zip_read_info->total_out_64 = 0; + pfile_in_zip_read_info->compression_method = compression_method; + pfile_in_zip_read_info->filestream = s->filestream; + pfile_in_zip_read_info->z_filefunc = s->z_filefunc; + if (s->number_disk == s->gi.number_disk_with_CD) + pfile_in_zip_read_info->byte_before_the_zipfile = s->byte_before_the_zipfile; + else + pfile_in_zip_read_info->byte_before_the_zipfile = 0; + pfile_in_zip_read_info->stream.total_out = 0; + pfile_in_zip_read_info->stream.total_in = 0; + pfile_in_zip_read_info->stream.next_in = NULL; + + if (!raw) + { + if (compression_method == Z_BZIP2ED) + { +#ifdef HAVE_BZIP2 + pfile_in_zip_read_info->bstream.bzalloc = (void *(*) (void *, int, int))0; + pfile_in_zip_read_info->bstream.bzfree = (free_func)0; + pfile_in_zip_read_info->bstream.opaque = (voidpf)0; + pfile_in_zip_read_info->bstream.state = (voidpf)0; + + pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; + pfile_in_zip_read_info->stream.zfree = (free_func)0; + pfile_in_zip_read_info->stream.opaque = (voidpf)0; + pfile_in_zip_read_info->stream.next_in = (voidpf)0; + pfile_in_zip_read_info->stream.avail_in = 0; + + err = BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0); + if (err == Z_OK) + pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED; + else + { + TRYFREE(pfile_in_zip_read_info); + return err; + } +#else + pfile_in_zip_read_info->raw = 1; +#endif + } + else if (compression_method == Z_DEFLATED) + { + pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; + pfile_in_zip_read_info->stream.zfree = (free_func)0; + pfile_in_zip_read_info->stream.opaque = (voidpf)s; + pfile_in_zip_read_info->stream.next_in = 0; + pfile_in_zip_read_info->stream.avail_in = 0; + + err = inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); + if (err == Z_OK) + pfile_in_zip_read_info->stream_initialised = Z_DEFLATED; + else + { + TRYFREE(pfile_in_zip_read_info); + return err; + } + /* windowBits is passed < 0 to tell that there is no zlib header. + * Note that in this case inflate *requires* an extra ""dummy"" byte + * after the compressed stream in order to complete decompression and + * return Z_STREAM_END. + * In unzip, i don't wait absolutely Z_STREAM_END because I known the + * size of both compressed and uncompressed data + */ + } + } + + pfile_in_zip_read_info->rest_read_compressed = s->cur_file_info.compressed_size; + pfile_in_zip_read_info->rest_read_uncompressed = s->cur_file_info.uncompressed_size; + pfile_in_zip_read_info->pos_in_zipfile = s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + iSizeVar; + pfile_in_zip_read_info->stream.avail_in = (uInt)0; + + s->pfile_in_zip_read = pfile_in_zip_read_info; + +#ifndef NOUNCRYPT + s->pcrc_32_tab = NULL; + + if ((password != NULL) && ((s->cur_file_info.flag & 1) != 0)) + { + if (ZSEEK64(s->z_filefunc, s->filestream, + s->pfile_in_zip_read->pos_in_zipfile + s->pfile_in_zip_read->byte_before_the_zipfile, + ZLIB_FILEFUNC_SEEK_SET) != 0) + return UNZ_INTERNALERROR; +#ifdef HAVE_AES + if (s->cur_file_info.compression_method == AES_METHOD) + { + unsigned char passverify[AES_PWVERIFYSIZE]; + unsigned char saltvalue[AES_MAXSALTLENGTH]; + uInt saltlength; + + if ((s->cur_file_info_internal.aes_encryption_mode < 1) || + (s->cur_file_info_internal.aes_encryption_mode > 3)) + return UNZ_INTERNALERROR; + + saltlength = SALT_LENGTH(s->cur_file_info_internal.aes_encryption_mode); + + if (ZREAD64(s->z_filefunc, s->filestream, saltvalue, saltlength) != saltlength) + return UNZ_INTERNALERROR; + if (ZREAD64(s->z_filefunc, s->filestream, passverify, AES_PWVERIFYSIZE) != AES_PWVERIFYSIZE) + return UNZ_INTERNALERROR; + + fcrypt_init(s->cur_file_info_internal.aes_encryption_mode, password, strlen(password), saltvalue, + passverify, &s->pfile_in_zip_read->aes_ctx); + + s->pfile_in_zip_read->rest_read_compressed -= saltlength + AES_PWVERIFYSIZE; + s->pfile_in_zip_read->rest_read_compressed -= AES_AUTHCODESIZE; + + s->pfile_in_zip_read->pos_in_zipfile += saltlength + AES_PWVERIFYSIZE; + } + else +#endif + { + int i; + s->pcrc_32_tab = (const unsigned int*)get_crc_table(); + init_keys(password, s->keys, s->pcrc_32_tab); + + if (ZREAD64(s->z_filefunc, s->filestream, source, 12) < 12) + return UNZ_INTERNALERROR; + + for (i = 0; i < 12; i++) + zdecode(s->keys, s->pcrc_32_tab, source[i]); + + s->pfile_in_zip_read->rest_read_compressed -= 12; + + s->pfile_in_zip_read->pos_in_zipfile += 12; + } + } +#endif + + return UNZ_OK; +} + +extern int ZEXPORT unzOpenCurrentFile(unzFile file) +{ + return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL); +} + +extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, const char* password) +{ + return unzOpenCurrentFile3(file, NULL, NULL, 0, password); +} + +extern int ZEXPORT unzOpenCurrentFile2(unzFile file, int* method, int* level, int raw) +{ + return unzOpenCurrentFile3(file, method, level, raw, NULL); +} + +/* Read bytes from the current file. + buf contain buffer where data must be copied + len the size of buf. + + return the number of byte copied if some bytes are copied + return 0 if the end of file was reached + return <0 with error code if there is an error (UNZ_ERRNO for IO error, or zLib error for uncompress error) */ +extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) +{ + int err = UNZ_OK; + uInt read = 0; + unz64_s* s; + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + + if (s->pfile_in_zip_read == NULL) + return UNZ_PARAMERROR; + if (s->pfile_in_zip_read->read_buffer == NULL) + return UNZ_END_OF_LIST_OF_FILE; + if (len == 0) + return 0; + + s->pfile_in_zip_read->stream.next_out = (Bytef*)buf; + s->pfile_in_zip_read->stream.avail_out = (uInt)len; + + if (s->pfile_in_zip_read->raw) + { + if (len > s->pfile_in_zip_read->rest_read_compressed + s->pfile_in_zip_read->stream.avail_in) + s->pfile_in_zip_read->stream.avail_out = (uInt)s->pfile_in_zip_read->rest_read_compressed + + s->pfile_in_zip_read->stream.avail_in; + } + else + { + if (len > s->pfile_in_zip_read->rest_read_uncompressed) + s->pfile_in_zip_read->stream.avail_out = (uInt)s->pfile_in_zip_read->rest_read_uncompressed; + } + + while (s->pfile_in_zip_read->stream.avail_out > 0) + { + if (s->pfile_in_zip_read->stream.avail_in == 0) + { + uLong bytes_to_read = UNZ_BUFSIZE; + uLong bytes_not_read = 0; + uLong bytes_read = 0; + uLong total_bytes_read = 0; + + if (s->pfile_in_zip_read->stream.next_in != NULL) + bytes_not_read = s->pfile_in_zip_read->read_buffer + UNZ_BUFSIZE - + s->pfile_in_zip_read->stream.next_in; + bytes_to_read -= bytes_not_read; + if (bytes_not_read > 0) + memcpy(s->pfile_in_zip_read->read_buffer, s->pfile_in_zip_read->stream.next_in, bytes_not_read); + if (s->pfile_in_zip_read->rest_read_compressed < bytes_to_read) + bytes_to_read = (uInt)s->pfile_in_zip_read->rest_read_compressed; + + while (total_bytes_read != bytes_to_read) + { + if (ZSEEK64(s->pfile_in_zip_read->z_filefunc, s->pfile_in_zip_read->filestream, + s->pfile_in_zip_read->pos_in_zipfile + s->pfile_in_zip_read->byte_before_the_zipfile, + ZLIB_FILEFUNC_SEEK_SET) != 0) + return UNZ_ERRNO; + + bytes_read = ZREAD64(s->pfile_in_zip_read->z_filefunc, s->pfile_in_zip_read->filestream, + s->pfile_in_zip_read->read_buffer + bytes_not_read + total_bytes_read, + bytes_to_read - total_bytes_read); + + total_bytes_read += bytes_read; + s->pfile_in_zip_read->pos_in_zipfile += bytes_read; + + if (bytes_read == 0) + { + if (ZERROR64(s->pfile_in_zip_read->z_filefunc, s->pfile_in_zip_read->filestream)) + return UNZ_ERRNO; + + err = unzGoToNextDisk(file); + if (err != UNZ_OK) + return err; + + s->pfile_in_zip_read->pos_in_zipfile = 0; + s->pfile_in_zip_read->filestream = s->filestream; + } + } + +#ifndef NOUNCRYPT + if ((s->cur_file_info.flag & 1) != 0) + { +#ifdef HAVE_AES + if (s->cur_file_info.compression_method == AES_METHOD) + { + fcrypt_decrypt(s->pfile_in_zip_read->read_buffer, bytes_to_read, &s->pfile_in_zip_read->aes_ctx); + } + else +#endif + if (s->pcrc_32_tab != NULL) + { + uInt i; + for(i = 0; i < total_bytes_read; i++) + s->pfile_in_zip_read->read_buffer[i] = + zdecode(s->keys, s->pcrc_32_tab, s->pfile_in_zip_read->read_buffer[i]); + } + } +#endif + + s->pfile_in_zip_read->rest_read_compressed -= total_bytes_read; + s->pfile_in_zip_read->stream.next_in = (Bytef*)s->pfile_in_zip_read->read_buffer; + s->pfile_in_zip_read->stream.avail_in = (uInt)(bytes_not_read + total_bytes_read); + } + + if ((s->pfile_in_zip_read->compression_method == 0) || (s->pfile_in_zip_read->raw)) + { + uInt copy, i; + + if ((s->pfile_in_zip_read->stream.avail_in == 0) && + (s->pfile_in_zip_read->rest_read_compressed == 0)) + return (read == 0) ? UNZ_EOF : read; + + if (s->pfile_in_zip_read->stream.avail_out < s->pfile_in_zip_read->stream.avail_in) + copy = s->pfile_in_zip_read->stream.avail_out; + else + copy = s->pfile_in_zip_read->stream.avail_in; + + for (i = 0; i < copy; i++) + *(s->pfile_in_zip_read->stream.next_out+i) = + *(s->pfile_in_zip_read->stream.next_in+i); + + s->pfile_in_zip_read->total_out_64 = s->pfile_in_zip_read->total_out_64 + copy; + s->pfile_in_zip_read->rest_read_uncompressed -= copy; + s->pfile_in_zip_read->crc32 = crc32(s->pfile_in_zip_read->crc32, + s->pfile_in_zip_read->stream.next_out, copy); + + s->pfile_in_zip_read->stream.avail_in -= copy; + s->pfile_in_zip_read->stream.avail_out -= copy; + s->pfile_in_zip_read->stream.next_out += copy; + s->pfile_in_zip_read->stream.next_in += copy; + s->pfile_in_zip_read->stream.total_out += copy; + read += copy; + } + else if (s->pfile_in_zip_read->compression_method == Z_BZIP2ED) + { +#ifdef HAVE_BZIP2 + uLong total_out_before, total_out_after; + const Bytef *buf_before; + uLong out_bytes; + + s->pfile_in_zip_read->bstream.next_in = (char*)s->pfile_in_zip_read->stream.next_in; + s->pfile_in_zip_read->bstream.avail_in = s->pfile_in_zip_read->stream.avail_in; + s->pfile_in_zip_read->bstream.total_in_lo32 = (uInt)s->pfile_in_zip_read->stream.total_in; + s->pfile_in_zip_read->bstream.total_in_hi32 = s->pfile_in_zip_read->stream.total_in >> 32; + + s->pfile_in_zip_read->bstream.next_out = (char*)s->pfile_in_zip_read->stream.next_out; + s->pfile_in_zip_read->bstream.avail_out = s->pfile_in_zip_read->stream.avail_out; + s->pfile_in_zip_read->bstream.total_out_lo32 = (uInt)s->pfile_in_zip_read->stream.total_out; + s->pfile_in_zip_read->bstream.total_out_hi32 = s->pfile_in_zip_read->stream.total_out >> 32; + + total_out_before = s->pfile_in_zip_read->bstream.total_out_lo32 + + (((uLong)s->pfile_in_zip_read->bstream.total_out_hi32) << 32); + buf_before = (const Bytef *)s->pfile_in_zip_read->bstream.next_out; + + err = BZ2_bzDecompress(&s->pfile_in_zip_read->bstream); + + total_out_after = s->pfile_in_zip_read->bstream.total_out_lo32 + + (((uLong)s->pfile_in_zip_read->bstream.total_out_hi32) << 32); + + out_bytes = total_out_after-total_out_before; + + s->pfile_in_zip_read->total_out_64 = s->pfile_in_zip_read->total_out_64 + out_bytes; + s->pfile_in_zip_read->rest_read_uncompressed -= out_bytes; + s->pfile_in_zip_read->crc32 = crc32(s->pfile_in_zip_read->crc32,buf_before, (uInt)(out_bytes)); + + read += (uInt)(total_out_after - total_out_before); + + s->pfile_in_zip_read->stream.next_in = (Bytef*)s->pfile_in_zip_read->bstream.next_in; + s->pfile_in_zip_read->stream.avail_in = s->pfile_in_zip_read->bstream.avail_in; + s->pfile_in_zip_read->stream.total_in = s->pfile_in_zip_read->bstream.total_in_lo32; + s->pfile_in_zip_read->stream.next_out = (Bytef*)s->pfile_in_zip_read->bstream.next_out; + s->pfile_in_zip_read->stream.avail_out = s->pfile_in_zip_read->bstream.avail_out; + s->pfile_in_zip_read->stream.total_out = s->pfile_in_zip_read->bstream.total_out_lo32; + + if (err == BZ_STREAM_END) + return (read == 0) ? UNZ_EOF : read; + if (err != BZ_OK) + break; +#endif + } + else + { + ZPOS64_T total_out_before, total_out_after; + const Bytef *buf_before; + ZPOS64_T out_bytes; + int flush=Z_SYNC_FLUSH; + + total_out_before = s->pfile_in_zip_read->stream.total_out; + buf_before = s->pfile_in_zip_read->stream.next_out; + + /* + if ((pfile_in_zip_read_info->rest_read_uncompressed == + pfile_in_zip_read_info->stream.avail_out) && + (pfile_in_zip_read_info->rest_read_compressed == 0)) + flush = Z_FINISH; + */ + err = inflate(&s->pfile_in_zip_read->stream,flush); + + if ((err >= 0) && (s->pfile_in_zip_read->stream.msg != NULL)) + err = Z_DATA_ERROR; + + total_out_after = s->pfile_in_zip_read->stream.total_out; + out_bytes = total_out_after-total_out_before; + + s->pfile_in_zip_read->total_out_64 += out_bytes; + s->pfile_in_zip_read->rest_read_uncompressed -= out_bytes; + s->pfile_in_zip_read->crc32 = + crc32(s->pfile_in_zip_read->crc32,buf_before, (uInt)(out_bytes)); + + read += (uInt)(total_out_after - total_out_before); + + if (err == Z_STREAM_END) + return (read == 0) ? UNZ_EOF : read; + if (err != Z_OK) + break; + } + } + + if (err == Z_OK) + return read; + return err; +} + +extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file) +{ + unz64_s* s; + s = (unz64_s*)file; + if (file == NULL) + return 0; /* UNZ_PARAMERROR */ + if (s->pfile_in_zip_read == NULL) + return 0; /* UNZ_PARAMERROR */ + return s->pfile_in_zip_read->pos_in_zipfile + s->pfile_in_zip_read->byte_before_the_zipfile; +} + +extern int ZEXPORT unzGetLocalExtrafield(unzFile file, voidp buf, unsigned len) +{ + unz64_s* s; + uInt read_now; + ZPOS64_T size_to_read; + + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + if (s->pfile_in_zip_read == NULL) + return UNZ_PARAMERROR; + + size_to_read = s->pfile_in_zip_read->size_local_extrafield - s->pfile_in_zip_read->pos_local_extrafield; + + if (buf == NULL) + return (int)size_to_read; + + if (len > size_to_read) + read_now = (uInt)size_to_read; + else + read_now = (uInt)len ; + + if (read_now == 0) + return 0; + + if (ZSEEK64(s->pfile_in_zip_read->z_filefunc, s->pfile_in_zip_read->filestream, + s->pfile_in_zip_read->offset_local_extrafield + s->pfile_in_zip_read->pos_local_extrafield, + ZLIB_FILEFUNC_SEEK_SET) != 0) + return UNZ_ERRNO; + + if (ZREAD64(s->pfile_in_zip_read->z_filefunc, s->pfile_in_zip_read->filestream, buf, read_now) != read_now) + return UNZ_ERRNO; + + return (int)read_now; +} + +extern int ZEXPORT unzCloseCurrentFile(unzFile file) +{ + int err = UNZ_OK; + + unz64_s* s; + file_in_zip64_read_info_s* pfile_in_zip_read_info; + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + pfile_in_zip_read_info=s->pfile_in_zip_read; + + if (pfile_in_zip_read_info == NULL) + return UNZ_PARAMERROR; + +#ifdef HAVE_AES + if (s->cur_file_info.compression_method == AES_METHOD) + { + unsigned char authcode[AES_AUTHCODESIZE]; + unsigned char rauthcode[AES_AUTHCODESIZE]; + + if (ZREAD64(s->z_filefunc, s->filestream, authcode, AES_AUTHCODESIZE) != AES_AUTHCODESIZE) + return UNZ_ERRNO; + + if (fcrypt_end(rauthcode, &s->pfile_in_zip_read->aes_ctx) != AES_AUTHCODESIZE) + err = UNZ_CRCERROR; + if (memcmp(authcode, rauthcode, AES_AUTHCODESIZE) != 0) + err = UNZ_CRCERROR; + } + /* AES zip version AE-1 will expect a valid crc as well */ + if ((s->cur_file_info.compression_method != AES_METHOD) || + (s->cur_file_info_internal.aes_version == 0x0001)) +#endif + { + if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) && + (!pfile_in_zip_read_info->raw)) + { + if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) + err = UNZ_CRCERROR; + } + } + + TRYFREE(pfile_in_zip_read_info->read_buffer); + pfile_in_zip_read_info->read_buffer = NULL; + if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED) + inflateEnd(&pfile_in_zip_read_info->stream); +#ifdef HAVE_BZIP2 + else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED) + BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream); +#endif + + pfile_in_zip_read_info->stream_initialised = 0; + TRYFREE(pfile_in_zip_read_info); + + s->pfile_in_zip_read = NULL; + + return err; +} + +extern int ZEXPORT unzGoToFirstFile2(unzFile file, unz_file_info64 *pfile_info, char *filename, + uLong filename_size, void *extrafield, uLong extrafield_size, char *comment, uLong comment_size) +{ + int err = UNZ_OK; + unz64_s* s; + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + s->pos_in_central_dir = s->offset_central_dir; + s->num_file = 0; + err = unz64local_GetCurrentFileInfoInternal(file, &s->cur_file_info, &s->cur_file_info_internal, + filename,filename_size, extrafield,extrafield_size, comment,comment_size); + s->current_file_ok = (err == UNZ_OK); + if ((err == UNZ_OK) && (pfile_info != NULL)) + memcpy(pfile_info, &s->cur_file_info, sizeof(unz_file_info64)); + return err; +} + +extern int ZEXPORT unzGoToFirstFile(unzFile file) +{ + return unzGoToFirstFile2(file, NULL, NULL, 0, NULL, 0, NULL, 0); +} + +extern int ZEXPORT unzGoToNextFile2(unzFile file, unz_file_info64 *pfile_info, char *filename, + uLong filename_size, void *extrafield, uLong extrafield_size, char *comment, uLong comment_size) +{ + unz64_s* s; + int err; + + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + if (!s->current_file_ok) + return UNZ_END_OF_LIST_OF_FILE; + if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */ + if (s->num_file+1 == s->gi.number_entry) + return UNZ_END_OF_LIST_OF_FILE; + s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + + s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment; + s->num_file++; + err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, &s->cur_file_info_internal, + filename, filename_size, extrafield,extrafield_size, comment,comment_size); + s->current_file_ok = (err == UNZ_OK); + if ((err == UNZ_OK) && (pfile_info != NULL)) + memcpy(pfile_info, &s->cur_file_info, sizeof(unz_file_info64)); + return err; +} + +extern int ZEXPORT unzGoToNextFile(unzFile file) +{ + return unzGoToNextFile2(file, NULL, NULL, 0, NULL, 0, NULL, 0); +} + +extern int ZEXPORT unzLocateFile(unzFile file, const char *filename, unzFileNameComparer filename_compare_func) +{ + unz64_s* s; + int err; + unz_file_info64 cur_file_info_saved; + unz_file_info64_internal cur_file_info_internal_saved; + ZPOS64_T num_file_saved; + ZPOS64_T pos_in_central_dir_saved; + char current_filename[UNZ_MAXFILENAMEINZIP+1]; + + if (file == NULL) + return UNZ_PARAMERROR; + if (strlen(filename) >= UNZ_MAXFILENAMEINZIP) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + if (!s->current_file_ok) + return UNZ_END_OF_LIST_OF_FILE; + + /* Save the current state */ + num_file_saved = s->num_file; + pos_in_central_dir_saved = s->pos_in_central_dir; + cur_file_info_saved = s->cur_file_info; + cur_file_info_internal_saved = s->cur_file_info_internal; + + err = unzGoToFirstFile2(file, NULL, current_filename, sizeof(current_filename)-1, NULL, 0, NULL, 0); + + while (err == UNZ_OK) + { + if (filename_compare_func != NULL) + err = filename_compare_func(file, current_filename, filename); + else + err = strcmp(current_filename, filename); + if (err == 0) + return UNZ_OK; + err = unzGoToNextFile2(file, NULL, current_filename, sizeof(current_filename)-1, NULL, 0, NULL, 0); + } + + /* We failed, so restore the state of the 'current file' to where we were. */ + s->num_file = num_file_saved; + s->pos_in_central_dir = pos_in_central_dir_saved; + s->cur_file_info = cur_file_info_saved; + s->cur_file_info_internal = cur_file_info_internal_saved; + return err; +} + +extern int ZEXPORT unzGetFilePos(unzFile file, unz_file_pos* file_pos) +{ + unz64_file_pos file_pos64; + int err = unzGetFilePos64(file,&file_pos64); + if (err == UNZ_OK) + { + file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory; + file_pos->num_of_file = (uLong)file_pos64.num_of_file; + } + return err; +} + +extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos* file_pos) +{ + unz64_file_pos file_pos64; + + if (file_pos == NULL) + return UNZ_PARAMERROR; + file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory; + file_pos64.num_of_file = file_pos->num_of_file; + return unzGoToFilePos64(file,&file_pos64); +} + +extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) +{ + unz64_s* s; + + if (file == NULL || file_pos == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + if (!s->current_file_ok) + return UNZ_END_OF_LIST_OF_FILE; + + file_pos->pos_in_zip_directory = s->pos_in_central_dir; + file_pos->num_of_file = s->num_file; + + return UNZ_OK; +} + +extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos) +{ + unz64_s* s; + int err; + + if (file == NULL || file_pos == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + + /* jump to the right spot */ + s->pos_in_central_dir = file_pos->pos_in_zip_directory; + s->num_file = file_pos->num_of_file; + + /* set the current file */ + err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, &s->cur_file_info_internal,NULL,0,NULL,0,NULL,0); + /* return results */ + s->current_file_ok = (err == UNZ_OK); + return err; +} + +extern uLong ZEXPORT unzGetOffset(unzFile file) +{ + ZPOS64_T offset64; + + if (file == NULL) + return 0; /* UNZ_PARAMERROR; */ + offset64 = unzGetOffset64(file); + return (uLong)offset64; +} + +extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) +{ + unz64_s* s; + + if (file == NULL) + return 0; /* UNZ_PARAMERROR; */ + s = (unz64_s*)file; + if (!s->current_file_ok) + return 0; + if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff) + if (s->num_file == s->gi.number_entry) + return 0; + return s->pos_in_central_dir; +} + +extern int ZEXPORT unzSetOffset(unzFile file, uLong pos) +{ + return unzSetOffset64(file, pos); +} + +extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) +{ + unz64_s* s; + int err; + + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + s->pos_in_central_dir = pos; + s->num_file = s->gi.number_entry; /* hack */ + + err = unz64local_GetCurrentFileInfoInternal(file, &s->cur_file_info, &s->cur_file_info_internal, NULL, 0, NULL, 0, NULL, 0); + + s->current_file_ok = (err == UNZ_OK); + return err; +} + +extern z_off_t ZEXPORT unztell(unzFile file) +{ + unz64_s* s; + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + if (s->pfile_in_zip_read == NULL) + return UNZ_PARAMERROR; + return (z_off_t)s->pfile_in_zip_read->stream.total_out; +} + +extern ZPOS64_T ZEXPORT unztell64(unzFile file) +{ + unz64_s* s; + if (file == NULL) + return (ZPOS64_T)-1; + s = (unz64_s*)file; + if (s->pfile_in_zip_read == NULL) + return (ZPOS64_T)-1; + return s->pfile_in_zip_read->total_out_64; +} + +extern int ZEXPORT unzseek(unzFile file, z_off_t offset, int origin) +{ + return unzseek64(file, (ZPOS64_T)offset, origin); +} + +extern int ZEXPORT unzseek64(unzFile file, ZPOS64_T offset, int origin) +{ + unz64_s* s; + ZPOS64_T stream_pos_begin; + ZPOS64_T stream_pos_end; + int isWithinBuffer; + ZPOS64_T position; + + if (file == NULL) + return UNZ_PARAMERROR; + + s = (unz64_s*)file; + + if (s->pfile_in_zip_read == NULL) + return UNZ_ERRNO; + if (s->pfile_in_zip_read->compression_method != 0) + return UNZ_ERRNO; + + if (origin == SEEK_SET) + position = offset; + else if (origin == SEEK_CUR) + position = s->pfile_in_zip_read->total_out_64 + offset; + else if (origin == SEEK_END) + position = s->cur_file_info.compressed_size + offset; + else + return UNZ_PARAMERROR; + + if (position > s->cur_file_info.compressed_size) + return UNZ_PARAMERROR; + + stream_pos_end = s->pfile_in_zip_read->pos_in_zipfile; + stream_pos_begin = stream_pos_end; + + if (stream_pos_begin > UNZ_BUFSIZE) + stream_pos_begin -= UNZ_BUFSIZE; + else + stream_pos_begin = 0; + + isWithinBuffer = s->pfile_in_zip_read->stream.avail_in != 0 && + (s->pfile_in_zip_read->rest_read_compressed != 0 || s->cur_file_info.compressed_size < UNZ_BUFSIZE) && + position >= stream_pos_begin && position < stream_pos_end; + + if (isWithinBuffer) + { + s->pfile_in_zip_read->stream.next_in += position - s->pfile_in_zip_read->total_out_64; + s->pfile_in_zip_read->stream.avail_in = (uInt)(stream_pos_end - position); + } + else + { + s->pfile_in_zip_read->stream.avail_in = 0; + s->pfile_in_zip_read->stream.next_in = 0; + + s->pfile_in_zip_read->pos_in_zipfile = s->pfile_in_zip_read->offset_local_extrafield + position; + s->pfile_in_zip_read->rest_read_compressed = s->cur_file_info.compressed_size - position; + } + + s->pfile_in_zip_read->rest_read_uncompressed -= (position - s->pfile_in_zip_read->total_out_64); + s->pfile_in_zip_read->stream.total_out = (uLong)position; + s->pfile_in_zip_read->total_out_64 = position; + + return UNZ_OK; +} + +extern int ZEXPORT unzeof(unzFile file) +{ + unz64_s* s; + if (file == NULL) + return UNZ_PARAMERROR; + s = (unz64_s*)file; + if (s->pfile_in_zip_read == NULL) + return UNZ_PARAMERROR; + if (s->pfile_in_zip_read->rest_read_uncompressed == 0) + return 1; + return 0; +} +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/iowin32.h",".h","918","34","/* iowin32.h -- IO base function header for compress/uncompress .zip + Version 1.1, February 14h, 2010 + part of the MiniZip project + + Copyright (C) 1998-2010 Gilles Vollant + http://www.winimage.com/zLibDll/minizip.html + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson + http://result42.com + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. +*/ + +#ifndef _IOWIN32_H +#define _IOWIN32_H + +#include + +#ifdef __cplusplus +extern ""C"" { +#endif + +void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); +void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def)); +void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def)); +void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def)); + +#ifdef __cplusplus +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/crypt.h",".h","5052","138","/* crypt.h -- base code for traditional PKWARE encryption + Version 1.01e, February 12th, 2005 + + Copyright (C) 1998-2005 Gilles Vollant + Modifications for Info-ZIP crypting + Copyright (C) 2003 Terry Thorsen + + This code is a modified version of crypting code in Info-ZIP distribution + + Copyright (C) 1990-2000 Info-ZIP. All rights reserved. + + See the Info-ZIP LICENSE file version 2000-Apr-09 or later for terms of use + which also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html + + The encryption/decryption parts of this source code (as opposed to the + non-echoing password parts) were originally written in Europe. The + whole source package can be freely distributed, including from the USA. + (Prior to January 2000, re-export from the US was a violation of US law.) + + This encryption code is a direct transcription of the algorithm from + Roger Schlafly, described by Phil Katz in the file appnote.txt. This + file (appnote.txt) is distributed with the PKZIP program (even in the + version without encryption capabilities). + + If you don't need crypting in your application, just define symbols + NOCRYPT and NOUNCRYPT. + + Mar 8th, 2016 - Lucio Cosmo + Fixed support for 64bit builds for archives with ""PKWARE"" password. + Changed long, unsigned long, unsigned to unsigned int in + access functions to crctables and pkeys + +*/ + +#define CRC32(c, b) ((*(pcrc_32_tab+(((unsigned int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) + +/*********************************************************************** + * Return the next byte in the pseudo-random sequence + */ +static int decrypt_byte(unsigned int* pkeys) +{ + unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an + * unpredictable manner on 16-bit systems; not a problem + * with any known compiler so far, though */ + + temp = ((unsigned int)(*(pkeys+2)) & 0xffff) | 2; + return (unsigned int)(((temp * (temp ^ 1)) >> 8) & 0xff); +} + +/*********************************************************************** + * Update the encryption keys with the next byte of plain text + */ +static int update_keys(unsigned int* pkeys,const unsigned int* pcrc_32_tab,int c) +{ + (*(pkeys+0)) = CRC32((*(pkeys+0)), c); + (*(pkeys+1)) += (*(pkeys+0)) & 0xff; + (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; + { + register int keyshift = (int)((*(pkeys+1)) >> 24); + (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); + } + return c; +} + + +/*********************************************************************** + * Initialize the encryption keys and the random header according to + * the given password. + */ +static void init_keys(const char* passwd,unsigned int* pkeys,const unsigned int* pcrc_32_tab) +{ + *(pkeys+0) = 305419896L; + *(pkeys+1) = 591751049L; + *(pkeys+2) = 878082192L; + while (*passwd != 0) + { + update_keys(pkeys,pcrc_32_tab,(int)*passwd); + passwd++; + } +} + +#define zdecode(pkeys,pcrc_32_tab,c) \ + (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys))) + +#define zencode(pkeys,pcrc_32_tab,c,t) \ + (t=decrypt_byte(pkeys), update_keys(pkeys,pcrc_32_tab,c), t^(c)) + +#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED + +#define RAND_HEAD_LEN 12 + /* ""last resort"" source for second part of crypt seed pattern */ +# ifndef ZCR_SEED2 +# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ +# endif + +static int crypthead(const char* passwd, /* password string */ + unsigned char* buf, /* where to write header */ + int bufSize, + unsigned int* pkeys, + const unsigned int* pcrc_32_tab, + unsigned int crcForCrypting) +{ + int n; /* index in random header */ + int t; /* temporary */ + int c; /* random byte */ + unsigned char header[RAND_HEAD_LEN-2]; /* random header */ + static unsigned calls = 0; /* ensure different random header each time */ + + if (bufSize < RAND_HEAD_LEN) + return 0; + + /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the + * output of rand() to get less predictability, since rand() is + * often poorly implemented. + */ + if (++calls == 1) + { + srand((unsigned)(time(NULL) ^ ZCR_SEED2)); + } + init_keys(passwd, pkeys, pcrc_32_tab); + for (n = 0; n < RAND_HEAD_LEN-2; n++) + { + c = (rand() >> 7) & 0xff; + header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); + } + /* Encrypt random header (last two bytes is high word of crc) */ + init_keys(passwd, pkeys, pcrc_32_tab); + for (n = 0; n < RAND_HEAD_LEN-2; n++) + { + buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); + } + buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); + buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); + return n; +} + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/ioapi_buf.c",".c","17427","515","/* ioapi_buf.h -- IO base function header for compress/uncompress .zip + files using zlib + zip or unzip API + + This version of ioapi is designed to buffer IO. + + Copyright (C) 1998-2003 Gilles Vollant + (C) 2012-2014 Nathan Moinvaziri + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. +*/ + + +#include +#include +#include +#include + +#include ""zlib.h"" +#include ""ioapi.h"" + +#include ""ioapi_buf.h"" + +#if defined(_WIN32) +# include +# define PRINTF _cprintf +# define VPRINTF _vcprintf +#else +# define PRINTF printf +# define VPRINTF vprintf +#endif + +//#define IOBUF_VERBOSE + +#ifdef __GNUC__ +#ifndef max +#define max(x,y) ({ \ +const typeof(x) _x = (x); \ +const typeof(y) _y = (y); \ +(void) (&_x == &_y); \ +_x > _y ? _x : _y; }) +#endif /* __GNUC__ */ + +#ifndef min +#define min(x,y) ({ \ +const typeof(x) _x = (x); \ +const typeof(y) _y = (y); \ +(void) (&_x == &_y); \ +_x < _y ? _x : _y; }) +#endif +#endif + +typedef struct ourstream_s { + char readBuffer[IOBUF_BUFFERSIZE]; + uInt readBufferLength; + uInt readBufferPos; + uInt readBufferHits; + uInt readBufferMisses; + char writeBuffer[IOBUF_BUFFERSIZE]; + uInt writeBufferLength; + uInt writeBufferPos; + uInt writeBufferHits; + uInt writeBufferMisses; + ZPOS64_T position; + voidpf stream; +} ourstream_t; + +#if defined(IOBUF_VERBOSE) +# define print_buf(o,s,f,...) print_buf_internal(o,s,f,__VA_ARGS__); +#else +# define print_buf(o,s,f,...) +#endif + +void print_buf_internal(voidpf opaque, voidpf stream, char *format, ...) +{ + ourstream_t *streamio = (ourstream_t *)stream; + va_list arglist; + PRINTF(""Buf stream %p - "", streamio); + va_start(arglist, format); + VPRINTF(format, arglist); + va_end(arglist); +} + +voidpf fopen_buf_internal_func (opaque, stream, number_disk, mode) + voidpf opaque; + voidpf stream; + int number_disk; + int mode; +{ + ourstream_t *streamio = NULL; + if (stream == NULL) + return NULL; + streamio = (ourstream_t *)malloc(sizeof(ourstream_t)); + if (streamio == NULL) + return NULL; + memset(streamio, 0, sizeof(ourstream_t)); + streamio->stream = stream; + print_buf(opaque, streamio, ""open [num %d mode %d]\n"", number_disk, mode); + return streamio; +} + +voidpf ZCALLBACK fopen_buf_func (opaque, filename, mode) + voidpf opaque; + const char* filename; + int mode; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + voidpf stream = bufio->filefunc.zopen_file(bufio->filefunc.opaque, filename, mode); + return fopen_buf_internal_func(opaque, stream, 0, mode); +} + +voidpf ZCALLBACK fopen64_buf_func (opaque, filename, mode) + voidpf opaque; + const char* filename; + int mode; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + voidpf stream = bufio->filefunc64.zopen64_file(bufio->filefunc64.opaque, filename, mode); + return fopen_buf_internal_func(opaque, stream, 0, mode); +} + +voidpf ZCALLBACK fopendisk_buf_func (opaque, stream_cd, number_disk, mode) + voidpf opaque; + voidpf stream_cd; + int number_disk; + int mode; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + ourstream_t *streamio = (ourstream_t *)stream_cd; + voidpf *stream = bufio->filefunc.zopendisk_file(bufio->filefunc.opaque, streamio->stream, number_disk, mode); + return fopen_buf_internal_func(opaque, stream, number_disk, mode); +} + +voidpf ZCALLBACK fopendisk64_buf_func (opaque, stream_cd, number_disk, mode) + voidpf opaque; + voidpf stream_cd; + int number_disk; + int mode; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + ourstream_t *streamio = (ourstream_t *)stream_cd; + voidpf stream = bufio->filefunc64.zopendisk64_file(bufio->filefunc64.opaque, streamio->stream, number_disk, mode); + return fopen_buf_internal_func(opaque, stream, number_disk, mode); +} + +long fflush_buf OF((voidpf opaque, voidpf stream)); +long fflush_buf (opaque, stream) + voidpf opaque; + voidpf stream; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + ourstream_t *streamio = (ourstream_t *)stream; + uInt totalBytesWritten = 0; + uInt bytesToWrite = streamio->writeBufferLength; + uInt bytesLeftToWrite = streamio->writeBufferLength; + int bytesWritten = 0; + + while (bytesLeftToWrite > 0) + { + if (bufio->filefunc64.zwrite_file != NULL) + bytesWritten = bufio->filefunc64.zwrite_file(bufio->filefunc64.opaque, streamio->stream, streamio->writeBuffer + (bytesToWrite - bytesLeftToWrite), bytesLeftToWrite); + else + bytesWritten = bufio->filefunc.zwrite_file(bufio->filefunc.opaque, streamio->stream, streamio->writeBuffer + (bytesToWrite - bytesLeftToWrite), bytesLeftToWrite); + + streamio->writeBufferMisses += 1; + + print_buf(opaque, stream, ""write flush [%d:%d len %d]\n"", bytesToWrite, bytesLeftToWrite, streamio->writeBufferLength); + + if (bytesWritten < 0) + return bytesWritten; + + totalBytesWritten += bytesWritten; + bytesLeftToWrite -= bytesWritten; + streamio->position += bytesWritten; + } + streamio->writeBufferLength = 0; + streamio->writeBufferPos = 0; + return totalBytesWritten; +} + +uLong ZCALLBACK fread_buf_func (opaque, stream, buf, size) + voidpf opaque; + voidpf stream; + void* buf; + uLong size; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + ourstream_t *streamio = (ourstream_t *)stream; + uInt bytesToRead = 0; + uInt bufLength = 0; + uInt bytesToCopy = 0; + uInt bytesLeftToRead = size; + uInt bytesRead = -1; + + print_buf(opaque, stream, ""read [size %ld pos %lld]\n"", size, streamio->position); + + if (streamio->writeBufferLength > 0) + { + print_buf(opaque, stream, ""switch from write to read, not yet supported [%lld]\n"", streamio->position); + } + + while (bytesLeftToRead > 0) + { + if ((streamio->readBufferLength == 0) || (streamio->readBufferPos == streamio->readBufferLength)) + { + if (streamio->readBufferLength == IOBUF_BUFFERSIZE) + { + streamio->readBufferPos = 0; + streamio->readBufferLength = 0; + } + + bytesToRead = IOBUF_BUFFERSIZE -(streamio->readBufferLength - streamio->readBufferPos); + + if (bufio->filefunc64.zread_file != NULL) + bytesRead = bufio->filefunc64.zread_file(bufio->filefunc64.opaque, streamio->stream, streamio->readBuffer + streamio->readBufferPos, bytesToRead); + else + bytesRead = bufio->filefunc.zread_file(bufio->filefunc.opaque, streamio->stream, streamio->readBuffer + streamio->readBufferPos, bytesToRead); + + streamio->readBufferMisses += 1; + streamio->readBufferLength += bytesRead; + streamio->position += bytesRead; + + print_buf(opaque, stream, ""filled [read %d/%d buf %d:%d pos %lld]\n"", bytesRead, bytesToRead, streamio->readBufferPos, streamio->readBufferLength, streamio->position); + + if (bytesRead == 0) + break; + } + + if ((streamio->readBufferLength - streamio->readBufferPos) > 0) + { + bytesToCopy = min(bytesLeftToRead, (streamio->readBufferLength - streamio->readBufferPos)); + memcpy((char *)buf + bufLength, streamio->readBuffer + streamio->readBufferPos, bytesToCopy); + + bufLength += bytesToCopy; + bytesLeftToRead -= bytesToCopy; + + streamio->readBufferHits += 1; + streamio->readBufferPos += bytesToCopy; + + print_buf(opaque, stream, ""emptied [copied %d remaining %d buf %d:%d pos %lld]\n"", bytesToCopy, bytesLeftToRead, streamio->readBufferPos, streamio->readBufferLength, streamio->position); + } + } + + return size - bytesLeftToRead; +} + +uLong ZCALLBACK fwrite_buf_func (opaque, stream, buf, size) + voidpf opaque; + voidpf stream; + const void* buf; + uLong size; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + ourstream_t *streamio = (ourstream_t *)stream; + uInt bytesToWrite = size; + uInt bytesLeftToWrite = size; + uInt bytesToCopy = 0; + int retVal = 0; + + print_buf(opaque, stream, ""write [size %ld len %d pos %lld]\n"", size, streamio->writeBufferLength, streamio->position); + + if (streamio->readBufferLength > 0) + { + streamio->position -= streamio->readBufferLength; + streamio->position += streamio->readBufferPos; + + streamio->readBufferLength = 0; + streamio->readBufferPos = 0; + + print_buf(opaque, stream, ""switch from read to write [%lld]\n"", streamio->position); + + if (bufio->filefunc64.zseek64_file != NULL) + retVal = bufio->filefunc64.zseek64_file(bufio->filefunc64.opaque, streamio->stream, streamio->position, ZLIB_FILEFUNC_SEEK_SET); + else + retVal = bufio->filefunc.zseek_file(bufio->filefunc.opaque, streamio->stream, (uLong)streamio->position, ZLIB_FILEFUNC_SEEK_SET); + + if (retVal != 0) + return -1; + } + + while (bytesLeftToWrite > 0) + { + bytesToCopy = min(bytesLeftToWrite, (IOBUF_BUFFERSIZE - min(streamio->writeBufferLength, streamio->writeBufferPos))); + + if (bytesToCopy == 0) + { + if (fflush_buf(opaque, stream) <= 0) + return 0; + + continue; + } + + memcpy(streamio->writeBuffer + streamio->writeBufferPos, (char *)buf + (bytesToWrite - bytesLeftToWrite), bytesToCopy); + + print_buf(opaque, stream, ""write copy [remaining %d write %d:%d len %d]\n"", bytesToCopy, bytesToWrite, bytesLeftToWrite, streamio->writeBufferLength); + + bytesLeftToWrite -= bytesToCopy; + + streamio->writeBufferPos += bytesToCopy; + streamio->writeBufferHits += 1; + if (streamio->writeBufferPos > streamio->writeBufferLength) + streamio->writeBufferLength += streamio->writeBufferPos - streamio->writeBufferLength; + } + + return size - bytesLeftToWrite; +} + +ZPOS64_T ftell_buf_internal_func (opaque, stream, position) + voidpf opaque; + voidpf stream; + ZPOS64_T position; +{ + ourstream_t *streamio = (ourstream_t *)stream; + streamio->position = position; + print_buf(opaque, stream, ""tell [pos %llu readpos %d writepos %d err %d]\n"", streamio->position, streamio->readBufferPos, streamio->writeBufferPos, errno); + if (streamio->readBufferLength > 0) + position -= (streamio->readBufferLength - streamio->readBufferPos); + if (streamio->writeBufferLength > 0) + position += streamio->writeBufferPos; + return position; +} + +long ZCALLBACK ftell_buf_func (opaque, stream) + voidpf opaque; + voidpf stream; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + ourstream_t *streamio = (ourstream_t *)stream; + ZPOS64_T position = bufio->filefunc.ztell_file(bufio->filefunc.opaque, streamio->stream); + return (long)ftell_buf_internal_func(opaque, stream, position); +} + +ZPOS64_T ZCALLBACK ftell64_buf_func (opaque, stream) + voidpf opaque; + voidpf stream; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + ourstream_t *streamio = (ourstream_t *)stream; + ZPOS64_T position = bufio->filefunc64.ztell64_file(bufio->filefunc64.opaque, streamio->stream); + return ftell_buf_internal_func(opaque, stream, position); +} + +int fseek_buf_internal_func (opaque, stream, offset, origin) + voidpf opaque; + voidpf stream; + ZPOS64_T offset; + int origin; +{ + ourstream_t *streamio = (ourstream_t *)stream; + + print_buf(opaque, stream, ""seek [origin %d offset %llu pos %lld]\n"", origin, offset, streamio->position); + + switch (origin) + { + case ZLIB_FILEFUNC_SEEK_SET: + + if (streamio->writeBufferLength > 0) + { + if ((offset >= streamio->position) && (offset <= streamio->position + streamio->writeBufferLength)) + { + streamio->writeBufferPos = (uLong)(offset - streamio->position); + return 0; + } + } + if ((streamio->readBufferLength > 0) && (offset < streamio->position) && (offset >= streamio->position - streamio->readBufferLength)) + { + streamio->readBufferPos = (uLong)(offset - (streamio->position - streamio->readBufferLength)); + return 0; + } + if (fflush_buf(opaque, stream) < 0) + return -1; + streamio->position = offset; + break; + + case ZLIB_FILEFUNC_SEEK_CUR: + + if (streamio->readBufferLength > 0) + { + if (offset <= (streamio->readBufferLength - streamio->readBufferPos)) + { + streamio->readBufferPos += (uLong)offset; + return 0; + } + offset -= (streamio->readBufferLength - streamio->readBufferPos); + streamio->position += offset; + } + if (streamio->writeBufferLength > 0) + { + if (offset <= (streamio->writeBufferLength - streamio->writeBufferPos)) + { + streamio->writeBufferPos += (uLong)offset; + return 0; + } + offset -= (streamio->writeBufferLength - streamio->writeBufferPos); + } + + if (fflush_buf(opaque, stream) < 0) + return -1; + + break; + + case ZLIB_FILEFUNC_SEEK_END: + + if (streamio->writeBufferLength > 0) + { + streamio->writeBufferPos = streamio->writeBufferLength; + return 0; + } + break; + } + + streamio->readBufferLength = 0; + streamio->readBufferPos = 0; + streamio->writeBufferLength = 0; + streamio->writeBufferPos = 0; + return 1; +} + +long ZCALLBACK fseek_buf_func (opaque, stream, offset, origin) + voidpf opaque; + voidpf stream; + uLong offset; + int origin; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + ourstream_t *streamio = (ourstream_t *)stream; + int retVal = -1; + if (bufio->filefunc.zseek_file == NULL) + return retVal; + retVal = fseek_buf_internal_func(opaque, stream, offset, origin); + if (retVal == 1) + retVal = bufio->filefunc.zseek_file(bufio->filefunc.opaque, streamio->stream, offset, origin); + return retVal; +} + +long ZCALLBACK fseek64_buf_func (opaque, stream, offset, origin) + voidpf opaque; + voidpf stream; + ZPOS64_T offset; + int origin; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + ourstream_t *streamio = (ourstream_t *)stream; + int retVal = -1; + if (bufio->filefunc64.zseek64_file == NULL) + return retVal; + retVal = fseek_buf_internal_func(opaque, stream, offset, origin); + if (retVal == 1) + retVal = bufio->filefunc64.zseek64_file(bufio->filefunc64.opaque, streamio->stream, offset, origin); + return retVal; +} + +int ZCALLBACK fclose_buf_func (opaque, stream) + voidpf opaque; + voidpf stream; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + ourstream_t *streamio = (ourstream_t *)stream; + int retVal = 0; + fflush_buf(opaque, stream); + print_buf(opaque, stream, ""close\n""); + if (streamio->readBufferHits + streamio->readBufferMisses > 0) + print_buf(opaque, stream, ""read efficency %.02f%%\n"", (streamio->readBufferHits / ((float)streamio->readBufferHits + streamio->readBufferMisses)) * 100); + if (streamio->writeBufferHits + streamio->writeBufferMisses > 0) + print_buf(opaque, stream, ""write efficency %.02f%%\n"", (streamio->writeBufferHits / ((float)streamio->writeBufferHits + streamio->writeBufferMisses)) * 100); + if (bufio->filefunc64.zclose_file != NULL) + retVal = bufio->filefunc64.zclose_file(bufio->filefunc64.opaque, streamio->stream); + else + retVal = bufio->filefunc.zclose_file(bufio->filefunc.opaque, streamio->stream); + free(streamio); + return retVal; +} + +int ZCALLBACK ferror_buf_func (opaque, stream) + voidpf opaque; + voidpf stream; +{ + ourbuffer_t *bufio = (ourbuffer_t *)opaque; + ourstream_t *streamio = (ourstream_t *)stream; + if (bufio->filefunc64.zerror_file != NULL) + return bufio->filefunc64.zerror_file(bufio->filefunc64.opaque, streamio->stream); + return bufio->filefunc.zerror_file(bufio->filefunc.opaque, streamio->stream); +} + + +void fill_buffer_filefunc (pzlib_filefunc_def, ourbuf) + zlib_filefunc_def* pzlib_filefunc_def; + ourbuffer_t *ourbuf; +{ + pzlib_filefunc_def->zopen_file = fopen_buf_func; + pzlib_filefunc_def->zopendisk_file = fopendisk_buf_func; + pzlib_filefunc_def->zread_file = fread_buf_func; + pzlib_filefunc_def->zwrite_file = fwrite_buf_func; + pzlib_filefunc_def->ztell_file = ftell_buf_func; + pzlib_filefunc_def->zseek_file = fseek_buf_func; + pzlib_filefunc_def->zclose_file = fclose_buf_func; + pzlib_filefunc_def->zerror_file = ferror_buf_func; + pzlib_filefunc_def->opaque = ourbuf; +} + +void fill_buffer_filefunc64 (pzlib_filefunc_def, ourbuf) + zlib_filefunc64_def* pzlib_filefunc_def; + ourbuffer_t *ourbuf; +{ + pzlib_filefunc_def->zopen64_file = fopen64_buf_func; + pzlib_filefunc_def->zopendisk64_file = fopendisk64_buf_func; + pzlib_filefunc_def->zread_file = fread_buf_func; + pzlib_filefunc_def->zwrite_file = fwrite_buf_func; + pzlib_filefunc_def->ztell64_file = ftell64_buf_func; + pzlib_filefunc_def->zseek64_file = fseek64_buf_func; + pzlib_filefunc_def->zclose_file = fclose_buf_func; + pzlib_filefunc_def->zerror_file = ferror_buf_func; + pzlib_filefunc_def->opaque = ourbuf; +} +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/minizip.c",".c","12336","440","/* minizip.c + Version 1.1, February 14h, 2010 + sample part of the MiniZip project + + Copyright (C) 1998-2010 Gilles Vollant + http://www.winimage.com/zLibDll/minizip.html + Modifications of Unzip for Zip64 + Copyright (C) 2007-2008 Even Rouault + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson + http://result42.com + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. +*/ + +#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) +# ifndef __USE_FILE_OFFSET64 +# define __USE_FILE_OFFSET64 +# endif +# ifndef __USE_LARGEFILE64 +# define __USE_LARGEFILE64 +# endif +# ifndef _LARGEFILE64_SOURCE +# define _LARGEFILE64_SOURCE +# endif +# ifndef _FILE_OFFSET_BIT +# define _FILE_OFFSET_BIT 64 +# endif +#endif + +#ifdef __APPLE__ +/* In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions */ +# define FOPEN_FUNC(filename, mode) fopen(filename, mode) +# define FTELLO_FUNC(stream) ftello(stream) +# define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) +#else +# define FOPEN_FUNC(filename, mode) fopen64(filename, mode) +# define FTELLO_FUNC(stream) ftello64(stream) +# define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin) +#endif + +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +# include +# include +#else +# include +# include +# include +# include +#endif + +#include ""zip.h"" + +#ifdef _WIN32 +# define USEWIN32IOAPI +# include ""iowin32.h"" +#endif + +#define WRITEBUFFERSIZE (16384) +#define MAXFILENAME (256) + +uLong filetime(const char *filename, tm_zip *tmzip, uLong *dostime) +{ + int ret = 0; +#ifdef _WIN32 + FILETIME ftLocal; + HANDLE hFind; + WIN32_FIND_DATAA ff32; + + hFind = FindFirstFileA(filename, &ff32); + if (hFind != INVALID_HANDLE_VALUE) + { + FileTimeToLocalFileTime(&(ff32.ftLastWriteTime), &ftLocal); + FileTimeToDosDateTime(&ftLocal,((LPWORD)dostime)+1,((LPWORD)dostime)+0); + FindClose(hFind); + ret = 1; + } +#else +#if defined unix || defined __APPLE__ + struct stat s = {0}; + struct tm* filedate; + time_t tm_t = 0; + + if (strcmp(filename,""-"") != 0) + { + char name[MAXFILENAME+1]; + int len = strlen(filename); + if (len > MAXFILENAME) + len = MAXFILENAME; + + strncpy(name, filename, MAXFILENAME - 1); + name[MAXFILENAME] = 0; + + if (name[len - 1] == '/') + name[len - 1] = 0; + + /* not all systems allow stat'ing a file with / appended */ + if (stat(name,&s) == 0) + { + tm_t = s.st_mtime; + ret = 1; + } + } + + filedate = localtime(&tm_t); + + tmzip->tm_sec = filedate->tm_sec; + tmzip->tm_min = filedate->tm_min; + tmzip->tm_hour = filedate->tm_hour; + tmzip->tm_mday = filedate->tm_mday; + tmzip->tm_mon = filedate->tm_mon ; + tmzip->tm_year = filedate->tm_year; +#endif +#endif + return ret; +} + +int check_file_exists(const char* filename) +{ + FILE* ftestexist = FOPEN_FUNC(filename, ""rb""); + if (ftestexist == NULL) + return 0; + fclose(ftestexist); + return 1; +} + +int is_large_file(const char* filename) +{ + ZPOS64_T pos = 0; + FILE* pFile = FOPEN_FUNC(filename, ""rb""); + + if (pFile == NULL) + return 0; + + FSEEKO_FUNC(pFile, 0, SEEK_END); + pos = FTELLO_FUNC(pFile); + fclose(pFile); + + printf(""File : %s is %lld bytes\n"", filename, pos); + + return (pos >= 0xffffffff); +} + +/* Calculate the CRC32 of a file, because to encrypt a file, we need known the CRC32 of the file before */ +int get_file_crc(const char* filenameinzip, void *buf, unsigned long size_buf, unsigned long* result_crc) +{ + FILE *fin = NULL; + unsigned long calculate_crc = 0; + unsigned long size_read = 0; + int err = ZIP_OK; + + fin = FOPEN_FUNC(filenameinzip,""rb""); + if (fin == NULL) + err = ZIP_ERRNO; + else + { + do + { + size_read = (int)fread(buf,1,size_buf,fin); + + if ((size_read < size_buf) && (feof(fin) == 0)) + { + printf(""error in reading %s\n"",filenameinzip); + err = ZIP_ERRNO; + } + + if (size_read > 0) + calculate_crc = crc32(calculate_crc,buf,size_read); + } + while ((err == ZIP_OK) && (size_read > 0)); + } + + if (fin) + fclose(fin); + + printf(""file %s crc %lx\n"", filenameinzip, calculate_crc); + *result_crc = calculate_crc; + return err; +} + +void do_banner() +{ + printf(""MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n""); + printf(""more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n""); +} + +void do_help() +{ + printf(""Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n"" \ + "" -o Overwrite existing file.zip\n"" \ + "" -a Append to existing file.zip\n"" \ + "" -0 Store only\n"" \ + "" -1 Compress faster\n"" \ + "" -9 Compress better\n\n"" \ + "" -j exclude path. store only the file name.\n\n""); +} + +int main(int argc, char *argv[]) +{ + zipFile zf = NULL; +#ifdef USEWIN32IOAPI + zlib_filefunc64_def ffunc = {0}; +#endif + char *zipfilename = NULL; + const char* password = NULL; + void* buf = NULL; + int size_buf = WRITEBUFFERSIZE; + int zipfilenamearg = 0; + int errclose = 0; + int err = 0; + int i = 0; + int opt_overwrite = APPEND_STATUS_CREATE; + int opt_compress_level = Z_DEFAULT_COMPRESSION; + int opt_exclude_path = 0; + + do_banner(); + if (argc == 1) + { + do_help(); + return 0; + } + + /* Parse command line options */ + for (i = 1; i < argc; i++) + { + if ((*argv[i]) == '-') + { + const char *p = argv[i]+1; + + while ((*p) != '\0') + { + char c = *(p++);; + if ((c == 'o') || (c == 'O')) + opt_overwrite = APPEND_STATUS_CREATEAFTER; + if ((c == 'a') || (c == 'A')) + opt_overwrite = APPEND_STATUS_ADDINZIP; + if ((c >= '0') && (c <= '9')) + opt_compress_level = (c - '0'); + if ((c == 'j') || (c == 'J')) + opt_exclude_path = 1; + + if (((c == 'p') || (c == 'P')) && (i+1 < argc)) + { + password=argv[i+1]; + i++; + } + } + } + else + { + if (zipfilenamearg == 0) + zipfilenamearg = i; + } + } + + if (zipfilenamearg == 0) + { + do_help(); + return 0; + } + zipfilename = argv[zipfilenamearg]; + + buf = (void*)malloc(size_buf); + if (buf == NULL) + { + printf(""Error allocating memory\n""); + return ZIP_INTERNALERROR; + } + + if (opt_overwrite == 2) + { + /* If the file don't exist, we not append file */ + if (check_file_exists(zipfilename) == 0) + opt_overwrite = 1; + } + else if (opt_overwrite == 0) + { + /* If ask the user what to do because append and overwrite args not set */ + if (check_file_exists(zipfilename) != 0) + { + char rep = 0; + do + { + char answer[128]; + printf(""The file %s exists. Overwrite ? [y]es, [n]o, [a]ppend : "", zipfilename); + if (scanf(""%1s"", answer) != 1) + exit(EXIT_FAILURE); + rep = answer[0]; + + if ((rep >= 'a') && (rep <= 'z')) + rep -= 0x20; + } + while ((rep != 'Y') && (rep != 'N') && (rep != 'A')); + + if (rep == 'A') + opt_overwrite = 2; + else if (rep == 'N') + { + do_help(); + free(buf); + return 0; + } + } + } + +#ifdef USEWIN32IOAPI + fill_win32_filefunc64A(&ffunc); + zf = zipOpen2_64(zipfilename, opt_overwrite, NULL, &ffunc); +#else + zf = zipOpen64(zipfilename, opt_overwrite); +#endif + + if (zf == NULL) + { + printf(""error opening %s\n"", zipfilename); + err = ZIP_ERRNO; + } + else + printf(""creating %s\n"", zipfilename); + + /* Go through command line args looking for files to add to zip */ + for (i = zipfilenamearg + 1; (i < argc) && (err == ZIP_OK); i++) + { + FILE *fin = NULL; + int size_read = 0; + const char* filenameinzip = argv[i]; + const char *savefilenameinzip; + zip_fileinfo zi = {0}; + unsigned long crcFile = 0; + int zip64 = 0; + + /* Skip command line options */ + if ((((*(argv[i])) == '-') || ((*(argv[i])) == '/')) && (strlen(argv[i]) == 2) && + ((argv[i][1] == 'o') || (argv[i][1] == 'O') || (argv[i][1] == 'a') || (argv[i][1] == 'A') || + (argv[i][1] == 'p') || (argv[i][1] == 'P') || ((argv[i][1] >= '0') && (argv[i][1] <= '9')))) + continue; + + /* Get information about the file on disk so we can store it in zip */ + filetime(filenameinzip, &zi.tmz_date, &zi.dosDate); + + if ((password != NULL) && (err == ZIP_OK)) + err = get_file_crc(filenameinzip, buf, size_buf, &crcFile); + + zip64 = is_large_file(filenameinzip); + + /* Construct the filename that our file will be stored in the zip as. + The path name saved, should not include a leading slash. + If it did, windows/xp and dynazip couldn't read the zip file. */ + + savefilenameinzip = filenameinzip; + while (savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/') + savefilenameinzip++; + + /* Should the file be stored with any path info at all? */ + if (opt_exclude_path) + { + const char *tmpptr = NULL; + const char *lastslash = 0; + + for (tmpptr = savefilenameinzip; *tmpptr; tmpptr++) + { + if (*tmpptr == '\\' || *tmpptr == '/') + lastslash = tmpptr; + } + + if (lastslash != NULL) + savefilenameinzip = lastslash + 1; /* base filename follows last slash. */ + } + + /* Add to zip file */ + err = zipOpenNewFileInZip3_64(zf, savefilenameinzip, &zi, + NULL, 0, NULL, 0, NULL /* comment*/, + (opt_compress_level != 0) ? Z_DEFLATED : 0, + opt_compress_level,0, + -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, + password, crcFile, zip64); + + if (err != ZIP_OK) + printf(""error in opening %s in zipfile (%d)\n"", filenameinzip, err); + else + { + fin = FOPEN_FUNC(filenameinzip, ""rb""); + if (fin == NULL) + { + err = ZIP_ERRNO; + printf(""error in opening %s for reading\n"", filenameinzip); + } + } + + if (err == ZIP_OK) + { + /* Read contents of file and write it to zip */ + do + { + size_read = (int)fread(buf, 1, size_buf, fin); + if ((size_read < size_buf) && (feof(fin) == 0)) + { + printf(""error in reading %s\n"",filenameinzip); + err = ZIP_ERRNO; + } + + if (size_read > 0) + { + err = zipWriteInFileInZip(zf, buf, size_read); + if (err < 0) + printf(""error in writing %s in the zipfile (%d)\n"", filenameinzip, err); + } + } + while ((err == ZIP_OK) && (size_read > 0)); + } + + if (fin) + fclose(fin); + + if (err < 0) + err = ZIP_ERRNO; + else + { + err = zipCloseFileInZip(zf); + if (err != ZIP_OK) + printf(""error in closing %s in the zipfile (%d)\n"", filenameinzip, err); + } + } + + errclose = zipClose(zf, NULL); + if (errclose != ZIP_OK) + printf(""error in closing %s (%d)\n"", zipfilename, errclose); + + free(buf); + return err; +} +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/ioapi.c",".c","12343","370","/* ioapi.h -- IO base function header for compress/uncompress .zip + part of the MiniZip project + + Copyright (C) 1998-2010 Gilles Vollant + http://www.winimage.com/zLibDll/minizip.html + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson + http://result42.com + + This program is distributed under the terms of the same license as zlib. + See the accompanying LICENSE file for the full text of the license. +*/ + +#include +#include + +#include ""ioapi.h"" + +#if defined(_WIN32) +# define snprintf _snprintf +#endif + +#ifdef __APPLE__ +/* In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions */ +# define FOPEN_FUNC(filename, mode) fopen(filename, mode) +# define FTELLO_FUNC(stream) ftello(stream) +# define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) +#else +# define FOPEN_FUNC(filename, mode) fopen64(filename, mode) +# define FTELLO_FUNC(stream) ftello64(stream) +# define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin) +#endif + +/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ +#ifndef SEEK_CUR +# define SEEK_CUR 1 +#endif +#ifndef SEEK_END +# define SEEK_END 2 +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 +#endif + +voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode) +{ + if (pfilefunc->zfile_func64.zopen64_file != NULL) + return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode); + return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode); +} + +voidpf call_zopendisk64 OF((const zlib_filefunc64_32_def* pfilefunc, voidpf filestream, int number_disk, int mode)) +{ + if (pfilefunc->zfile_func64.zopendisk64_file != NULL) + return (*(pfilefunc->zfile_func64.zopendisk64_file)) (pfilefunc->zfile_func64.opaque,filestream,number_disk,mode); + return (*(pfilefunc->zopendisk32_file))(pfilefunc->zfile_func64.opaque,filestream,number_disk,mode); +} + +long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) +{ + uLong offsetTruncated; + if (pfilefunc->zfile_func64.zseek64_file != NULL) + return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin); + offsetTruncated = (uLong)offset; + if (offsetTruncated != offset) + return -1; + return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin); +} + +ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream) +{ + uLong tell_uLong; + if (pfilefunc->zfile_func64.zseek64_file != NULL) + return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream); + tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); + if ((tell_uLong) == 0xffffffff) + return (ZPOS64_T)-1; + return tell_uLong; +} + +void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32) +{ + p_filefunc64_32->zfile_func64.zopen64_file = NULL; + p_filefunc64_32->zfile_func64.zopendisk64_file = NULL; + p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file; + p_filefunc64_32->zopendisk32_file = p_filefunc32->zopendisk_file; + p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; + p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file; + p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file; + p_filefunc64_32->zfile_func64.ztell64_file = NULL; + p_filefunc64_32->zfile_func64.zseek64_file = NULL; + p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file; + p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; + p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque; + p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file; + p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file; +} + +static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode)); +static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); +static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size)); +static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream)); +static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); +static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream)); +static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream)); + +typedef struct +{ + FILE *file; + int filenameLength; + void *filename; +} FILE_IOPOSIX; + +static voidpf file_build_ioposix(FILE *file, const char *filename) +{ + FILE_IOPOSIX *ioposix = NULL; + if (file == NULL) + return NULL; + ioposix = (FILE_IOPOSIX*)malloc(sizeof(FILE_IOPOSIX)); + ioposix->file = file; + ioposix->filenameLength = strlen(filename) + 1; + ioposix->filename = (char*)malloc(ioposix->filenameLength * sizeof(char)); + strncpy(ioposix->filename, filename, ioposix->filenameLength); + return (voidpf)ioposix; +} + +static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode) +{ + FILE* file = NULL; + const char* mode_fopen = NULL; + if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) == ZLIB_FILEFUNC_MODE_READ) + mode_fopen = ""rb""; + else if (mode & ZLIB_FILEFUNC_MODE_EXISTING) + mode_fopen = ""r+b""; + else if (mode & ZLIB_FILEFUNC_MODE_CREATE) + mode_fopen = ""wb""; + + if ((filename != NULL) && (mode_fopen != NULL)) + { + file = fopen(filename, mode_fopen); + return file_build_ioposix(file, filename); + } + return file; +} + +static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode) +{ + FILE* file = NULL; + const char* mode_fopen = NULL; + if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) == ZLIB_FILEFUNC_MODE_READ) + mode_fopen = ""rb""; + else if (mode & ZLIB_FILEFUNC_MODE_EXISTING) + mode_fopen = ""r+b""; + else if (mode & ZLIB_FILEFUNC_MODE_CREATE) + mode_fopen = ""wb""; + + if ((filename != NULL) && (mode_fopen != NULL)) + { + file = FOPEN_FUNC((const char*)filename, mode_fopen); + return file_build_ioposix(file, (const char*)filename); + } + return file; +} + +static voidpf ZCALLBACK fopendisk64_file_func (voidpf opaque, voidpf stream, int number_disk, int mode) +{ + FILE_IOPOSIX *ioposix = NULL; + char *diskFilename = NULL; + voidpf ret = NULL; + int i = 0; + + if (stream == NULL) + return NULL; + ioposix = (FILE_IOPOSIX*)stream; + diskFilename = (char*)malloc(ioposix->filenameLength * sizeof(char)); + strncpy(diskFilename, ioposix->filename, ioposix->filenameLength); + for (i = ioposix->filenameLength - 1; i >= 0; i -= 1) + { + if (diskFilename[i] != '.') + continue; + snprintf(&diskFilename[i], ioposix->filenameLength - i, "".z%02d"", number_disk + 1); + break; + } + if (i >= 0) + ret = fopen64_file_func(opaque, diskFilename, mode); + free(diskFilename); + return ret; +} + +static voidpf ZCALLBACK fopendisk_file_func (voidpf opaque, voidpf stream, int number_disk, int mode) +{ + FILE_IOPOSIX *ioposix = NULL; + char *diskFilename = NULL; + voidpf ret = NULL; + int i = 0; + + if (stream == NULL) + return NULL; + ioposix = (FILE_IOPOSIX*)stream; + diskFilename = (char*)malloc(ioposix->filenameLength * sizeof(char)); + strncpy(diskFilename, ioposix->filename, ioposix->filenameLength); + for (i = ioposix->filenameLength - 1; i >= 0; i -= 1) + { + if (diskFilename[i] != '.') + continue; + snprintf(&diskFilename[i], ioposix->filenameLength - i, "".z%02d"", number_disk + 1); + break; + } + if (i >= 0) + ret = fopen_file_func(opaque, diskFilename, mode); + free(diskFilename); + return ret; +} + +static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size) +{ + FILE_IOPOSIX *ioposix = NULL; + uLong ret; + if (stream == NULL) + return -1; + ioposix = (FILE_IOPOSIX*)stream; + ret = (uLong)fread(buf, 1, (size_t)size, ioposix->file); + return ret; +} + +static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size) +{ + FILE_IOPOSIX *ioposix = NULL; + uLong ret; + if (stream == NULL) + return -1; + ioposix = (FILE_IOPOSIX*)stream; + ret = (uLong)fwrite(buf, 1, (size_t)size, ioposix->file); + return ret; +} + +static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) +{ + FILE_IOPOSIX *ioposix = NULL; + long ret = -1; + if (stream == NULL) + return ret; + ioposix = (FILE_IOPOSIX*)stream; + ret = ftell(ioposix->file); + return ret; +} + +static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) +{ + FILE_IOPOSIX *ioposix = NULL; + ZPOS64_T ret = -1; + if (stream == NULL) + return ret; + ioposix = (FILE_IOPOSIX*)stream; + ret = FTELLO_FUNC(ioposix->file); + return ret; +} + +static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin) +{ + FILE_IOPOSIX *ioposix = NULL; + int fseek_origin = 0; + long ret = 0; + + if (stream == NULL) + return -1; + ioposix = (FILE_IOPOSIX*)stream; + + switch (origin) + { + case ZLIB_FILEFUNC_SEEK_CUR: + fseek_origin = SEEK_CUR; + break; + case ZLIB_FILEFUNC_SEEK_END: + fseek_origin = SEEK_END; + break; + case ZLIB_FILEFUNC_SEEK_SET: + fseek_origin = SEEK_SET; + break; + default: + return -1; + } + if (fseek(ioposix->file, offset, fseek_origin) != 0) + ret = -1; + return ret; +} + +static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) +{ + FILE_IOPOSIX *ioposix = NULL; + int fseek_origin = 0; + long ret = 0; + + if (stream == NULL) + return -1; + ioposix = (FILE_IOPOSIX*)stream; + + switch (origin) + { + case ZLIB_FILEFUNC_SEEK_CUR: + fseek_origin = SEEK_CUR; + break; + case ZLIB_FILEFUNC_SEEK_END: + fseek_origin = SEEK_END; + break; + case ZLIB_FILEFUNC_SEEK_SET: + fseek_origin = SEEK_SET; + break; + default: + return -1; + } + + if(FSEEKO_FUNC(ioposix->file, offset, fseek_origin) != 0) + ret = -1; + + return ret; +} + + +static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) +{ + FILE_IOPOSIX *ioposix = NULL; + int ret = -1; + if (stream == NULL) + return ret; + ioposix = (FILE_IOPOSIX*)stream; + if (ioposix->filename != NULL) + free(ioposix->filename); + ret = fclose(ioposix->file); + free(ioposix); + return ret; +} + +static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream) +{ + FILE_IOPOSIX *ioposix = NULL; + int ret = -1; + if (stream == NULL) + return ret; + ioposix = (FILE_IOPOSIX*)stream; + ret = ferror(ioposix->file); + return ret; +} + +void fill_fopen_filefunc (zlib_filefunc_def* pzlib_filefunc_def) +{ + pzlib_filefunc_def->zopen_file = fopen_file_func; + pzlib_filefunc_def->zopendisk_file = fopendisk_file_func; + pzlib_filefunc_def->zread_file = fread_file_func; + pzlib_filefunc_def->zwrite_file = fwrite_file_func; + pzlib_filefunc_def->ztell_file = ftell_file_func; + pzlib_filefunc_def->zseek_file = fseek_file_func; + pzlib_filefunc_def->zclose_file = fclose_file_func; + pzlib_filefunc_def->zerror_file = ferror_file_func; + pzlib_filefunc_def->opaque = NULL; +} + +void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def) +{ + pzlib_filefunc_def->zopen64_file = fopen64_file_func; + pzlib_filefunc_def->zopendisk64_file = fopendisk64_file_func; + pzlib_filefunc_def->zread_file = fread_file_func; + pzlib_filefunc_def->zwrite_file = fwrite_file_func; + pzlib_filefunc_def->ztell64_file = ftell64_file_func; + pzlib_filefunc_def->zseek64_file = fseek64_file_func; + pzlib_filefunc_def->zclose_file = fclose_file_func; + pzlib_filefunc_def->zerror_file = ferror_file_func; + pzlib_filefunc_def->opaque = NULL; +} +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/aesopt.h",".h","26106","740","/* +--------------------------------------------------------------------------- +Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved. + +The redistribution and use of this software (with or without changes) +is allowed without the payment of fees or royalties provided that: + + source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation. + +This software is provided 'as is' with no explicit or implied warranties +in respect of its operation, including, but not limited to, correctness +and fitness for purpose. +--------------------------------------------------------------------------- +Issue Date: 20/12/2007 + + This file contains the compilation options for AES (Rijndael) and code + that is common across encryption, key scheduling and table generation. + + OPERATION + + These source code files implement the AES algorithm Rijndael designed by + Joan Daemen and Vincent Rijmen. This version is designed for the standard + block size of 16 bytes and for key sizes of 128, 192 and 256 bits (16, 24 + and 32 bytes). + + This version is designed for flexibility and speed using operations on + 32-bit words rather than operations on bytes. It can be compiled with + either big or little endian internal byte order but is faster when the + native byte order for the processor is used. + + THE CIPHER INTERFACE + + The cipher interface is implemented as an array of bytes in which lower + AES bit sequence indexes map to higher numeric significance within bytes. + + uint_8t (an unsigned 8-bit type) + uint_32t (an unsigned 32-bit type) + struct aes_encrypt_ctx (structure for the cipher encryption context) + struct aes_decrypt_ctx (structure for the cipher decryption context) + AES_RETURN the function return type + + C subroutine calls: + + AES_RETURN aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]); + AES_RETURN aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]); + AES_RETURN aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]); + AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, + const aes_encrypt_ctx cx[1]); + + AES_RETURN aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]); + AES_RETURN aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]); + AES_RETURN aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]); + AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, + const aes_decrypt_ctx cx[1]); + + IMPORTANT NOTE: If you are using this C interface with dynamic tables make sure that + you call aes_init() before AES is used so that the tables are initialised. + + C++ aes class subroutines: + + Class AESencrypt for encryption + + Construtors: + AESencrypt(void) + AESencrypt(const unsigned char *key) - 128 bit key + Members: + AES_RETURN key128(const unsigned char *key) + AES_RETURN key192(const unsigned char *key) + AES_RETURN key256(const unsigned char *key) + AES_RETURN encrypt(const unsigned char *in, unsigned char *out) const + + Class AESdecrypt for encryption + Construtors: + AESdecrypt(void) + AESdecrypt(const unsigned char *key) - 128 bit key + Members: + AES_RETURN key128(const unsigned char *key) + AES_RETURN key192(const unsigned char *key) + AES_RETURN key256(const unsigned char *key) + AES_RETURN decrypt(const unsigned char *in, unsigned char *out) const +*/ + +#if !defined( _AESOPT_H ) +#define _AESOPT_H + +#if defined( __cplusplus ) +#include ""aescpp.h"" +#else +#include ""aes.h"" +#endif + +/* PLATFORM SPECIFIC INCLUDES */ + +#include ""brg_endian.h"" + +/* CONFIGURATION - THE USE OF DEFINES + + Later in this section there are a number of defines that control the + operation of the code. In each section, the purpose of each define is + explained so that the relevant form can be included or excluded by + setting either 1's or 0's respectively on the branches of the related + #if clauses. The following local defines should not be changed. +*/ + +#define ENCRYPTION_IN_C 1 +#define DECRYPTION_IN_C 2 +#define ENC_KEYING_IN_C 4 +#define DEC_KEYING_IN_C 8 + +#define NO_TABLES 0 +#define ONE_TABLE 1 +#define FOUR_TABLES 4 +#define NONE 0 +#define PARTIAL 1 +#define FULL 2 + +/* --- START OF USER CONFIGURED OPTIONS --- */ + +/* 1. BYTE ORDER WITHIN 32 BIT WORDS + + The fundamental data processing units in Rijndael are 8-bit bytes. The + input, output and key input are all enumerated arrays of bytes in which + bytes are numbered starting at zero and increasing to one less than the + number of bytes in the array in question. This enumeration is only used + for naming bytes and does not imply any adjacency or order relationship + from one byte to another. When these inputs and outputs are considered + as bit sequences, bits 8*n to 8*n+7 of the bit sequence are mapped to + byte[n] with bit 8n+i in the sequence mapped to bit 7-i within the byte. + In this implementation bits are numbered from 0 to 7 starting at the + numerically least significant end of each byte (bit n represents 2^n). + + However, Rijndael can be implemented more efficiently using 32-bit + words by packing bytes into words so that bytes 4*n to 4*n+3 are placed + into word[n]. While in principle these bytes can be assembled into words + in any positions, this implementation only supports the two formats in + which bytes in adjacent positions within words also have adjacent byte + numbers. This order is called big-endian if the lowest numbered bytes + in words have the highest numeric significance and little-endian if the + opposite applies. + + This code can work in either order irrespective of the order used by the + machine on which it runs. Normally the internal byte order will be set + to the order of the processor on which the code is to be run but this + define can be used to reverse this in special situations + + WARNING: Assembler code versions rely on PLATFORM_BYTE_ORDER being set. + This define will hence be redefined later (in section 4) if necessary +*/ + +#if 1 +# define ALGORITHM_BYTE_ORDER PLATFORM_BYTE_ORDER +#elif 0 +# define ALGORITHM_BYTE_ORDER IS_LITTLE_ENDIAN +#elif 0 +# define ALGORITHM_BYTE_ORDER IS_BIG_ENDIAN +#else +# error The algorithm byte order is not defined +#endif + +/* 2. VIA ACE SUPPORT */ + +#if !defined(__APPLE__) && defined( __GNUC__ ) && defined( __i386__ ) \ + || defined( _WIN32 ) && defined( _M_IX86 ) \ + && !(defined( _WIN64 ) || defined( _WIN32_WCE ) || defined( _MSC_VER ) && ( _MSC_VER <= 800 )) +# define VIA_ACE_POSSIBLE +#endif + +/* Define this option if support for the VIA ACE is required. This uses + inline assembler instructions and is only implemented for the Microsoft, + Intel and GCC compilers. If VIA ACE is known to be present, then defining + ASSUME_VIA_ACE_PRESENT will remove the ordinary encryption/decryption + code. If USE_VIA_ACE_IF_PRESENT is defined then VIA ACE will be used if + it is detected (both present and enabled) but the normal AES code will + also be present. + + When VIA ACE is to be used, all AES encryption contexts MUST be 16 byte + aligned; other input/output buffers do not need to be 16 byte aligned + but there are very large performance gains if this can be arranged. + VIA ACE also requires the decryption key schedule to be in reverse + order (which later checks below ensure). +*/ + +#if 1 && defined( VIA_ACE_POSSIBLE ) && !defined( USE_VIA_ACE_IF_PRESENT ) +# define USE_VIA_ACE_IF_PRESENT +#endif + +#if 0 && defined( VIA_ACE_POSSIBLE ) && !defined( ASSUME_VIA_ACE_PRESENT ) +# define ASSUME_VIA_ACE_PRESENT +# endif + +/* 3. ASSEMBLER SUPPORT + + This define (which can be on the command line) enables the use of the + assembler code routines for encryption, decryption and key scheduling + as follows: + + ASM_X86_V1C uses the assembler (aes_x86_v1.asm) with large tables for + encryption and decryption and but with key scheduling in C + ASM_X86_V2 uses assembler (aes_x86_v2.asm) with compressed tables for + encryption, decryption and key scheduling + ASM_X86_V2C uses assembler (aes_x86_v2.asm) with compressed tables for + encryption and decryption and but with key scheduling in C + ASM_AMD64_C uses assembler (aes_amd64.asm) with compressed tables for + encryption and decryption and but with key scheduling in C + + Change one 'if 0' below to 'if 1' to select the version or define + as a compilation option. +*/ + +#if 0 && !defined( ASM_X86_V1C ) +# define ASM_X86_V1C +#elif 0 && !defined( ASM_X86_V2 ) +# define ASM_X86_V2 +#elif 0 && !defined( ASM_X86_V2C ) +# define ASM_X86_V2C +#elif 0 && !defined( ASM_AMD64_C ) +# define ASM_AMD64_C +#endif + +#if (defined ( ASM_X86_V1C ) || defined( ASM_X86_V2 ) || defined( ASM_X86_V2C )) \ + && !defined( _M_IX86 ) || defined( ASM_AMD64_C ) && !defined( _M_X64 ) +# error Assembler code is only available for x86 and AMD64 systems +#endif + +/* 4. FAST INPUT/OUTPUT OPERATIONS. + + On some machines it is possible to improve speed by transferring the + bytes in the input and output arrays to and from the internal 32-bit + variables by addressing these arrays as if they are arrays of 32-bit + words. On some machines this will always be possible but there may + be a large performance penalty if the byte arrays are not aligned on + the normal word boundaries. On other machines this technique will + lead to memory access errors when such 32-bit word accesses are not + properly aligned. The option SAFE_IO avoids such problems but will + often be slower on those machines that support misaligned access + (especially so if care is taken to align the input and output byte + arrays on 32-bit word boundaries). If SAFE_IO is not defined it is + assumed that access to byte arrays as if they are arrays of 32-bit + words will not cause problems when such accesses are misaligned. +*/ +#if 1 && !defined( _MSC_VER ) +# define SAFE_IO +#endif + +/* 5. LOOP UNROLLING + + The code for encryption and decrytpion cycles through a number of rounds + that can be implemented either in a loop or by expanding the code into a + long sequence of instructions, the latter producing a larger program but + one that will often be much faster. The latter is called loop unrolling. + There are also potential speed advantages in expanding two iterations in + a loop with half the number of iterations, which is called partial loop + unrolling. The following options allow partial or full loop unrolling + to be set independently for encryption and decryption +*/ +#if 1 +# define ENC_UNROLL FULL +#elif 0 +# define ENC_UNROLL PARTIAL +#else +# define ENC_UNROLL NONE +#endif + +#if 1 +# define DEC_UNROLL FULL +#elif 0 +# define DEC_UNROLL PARTIAL +#else +# define DEC_UNROLL NONE +#endif + +#if 1 +# define ENC_KS_UNROLL +#endif + +#if 1 +# define DEC_KS_UNROLL +#endif + +/* 6. FAST FINITE FIELD OPERATIONS + + If this section is included, tables are used to provide faster finite + field arithmetic (this has no effect if FIXED_TABLES is defined). +*/ +#if 1 +# define FF_TABLES +#endif + +/* 7. INTERNAL STATE VARIABLE FORMAT + + The internal state of Rijndael is stored in a number of local 32-bit + word varaibles which can be defined either as an array or as individual + names variables. Include this section if you want to store these local + varaibles in arrays. Otherwise individual local variables will be used. +*/ +#if 1 +# define ARRAYS +#endif + +/* 8. FIXED OR DYNAMIC TABLES + + When this section is included the tables used by the code are compiled + statically into the binary file. Otherwise the subroutine aes_init() + must be called to compute them before the code is first used. +*/ +#if 1 && !(defined( _MSC_VER ) && ( _MSC_VER <= 800 )) +# define FIXED_TABLES +#endif + +/* 9. MASKING OR CASTING FROM LONGER VALUES TO BYTES + + In some systems it is better to mask longer values to extract bytes + rather than using a cast. This option allows this choice. +*/ +#if 0 +# define to_byte(x) ((uint_8t)(x)) +#else +# define to_byte(x) ((x) & 0xff) +#endif + +/* 10. TABLE ALIGNMENT + + On some sytsems speed will be improved by aligning the AES large lookup + tables on particular boundaries. This define should be set to a power of + two giving the desired alignment. It can be left undefined if alignment + is not needed. This option is specific to the Microsft VC++ compiler - + it seems to sometimes cause trouble for the VC++ version 6 compiler. +*/ + +#if 1 && defined( _MSC_VER ) && ( _MSC_VER >= 1300 ) +# define TABLE_ALIGN 32 +#endif + +/* 11. REDUCE CODE AND TABLE SIZE + + This replaces some expanded macros with function calls if AES_ASM_V2 or + AES_ASM_V2C are defined +*/ + +#if 1 && (defined( ASM_X86_V2 ) || defined( ASM_X86_V2C )) +# define REDUCE_CODE_SIZE +#endif + +/* 12. TABLE OPTIONS + + This cipher proceeds by repeating in a number of cycles known as 'rounds' + which are implemented by a round function which can optionally be speeded + up using tables. The basic tables are each 256 32-bit words, with either + one or four tables being required for each round function depending on + how much speed is required. The encryption and decryption round functions + are different and the last encryption and decrytpion round functions are + different again making four different round functions in all. + + This means that: + 1. Normal encryption and decryption rounds can each use either 0, 1 + or 4 tables and table spaces of 0, 1024 or 4096 bytes each. + 2. The last encryption and decryption rounds can also use either 0, 1 + or 4 tables and table spaces of 0, 1024 or 4096 bytes each. + + Include or exclude the appropriate definitions below to set the number + of tables used by this implementation. +*/ + +#if 1 /* set tables for the normal encryption round */ +# define ENC_ROUND FOUR_TABLES +#elif 0 +# define ENC_ROUND ONE_TABLE +#else +# define ENC_ROUND NO_TABLES +#endif + +#if 1 /* set tables for the last encryption round */ +# define LAST_ENC_ROUND FOUR_TABLES +#elif 0 +# define LAST_ENC_ROUND ONE_TABLE +#else +# define LAST_ENC_ROUND NO_TABLES +#endif + +#if 1 /* set tables for the normal decryption round */ +# define DEC_ROUND FOUR_TABLES +#elif 0 +# define DEC_ROUND ONE_TABLE +#else +# define DEC_ROUND NO_TABLES +#endif + +#if 1 /* set tables for the last decryption round */ +# define LAST_DEC_ROUND FOUR_TABLES +#elif 0 +# define LAST_DEC_ROUND ONE_TABLE +#else +# define LAST_DEC_ROUND NO_TABLES +#endif + +/* The decryption key schedule can be speeded up with tables in the same + way that the round functions can. Include or exclude the following + defines to set this requirement. +*/ +#if 1 +# define KEY_SCHED FOUR_TABLES +#elif 0 +# define KEY_SCHED ONE_TABLE +#else +# define KEY_SCHED NO_TABLES +#endif + +/* ---- END OF USER CONFIGURED OPTIONS ---- */ + +/* VIA ACE support is only available for VC++ and GCC */ + +#if !defined( _MSC_VER ) && !defined( __GNUC__ ) +# if defined( ASSUME_VIA_ACE_PRESENT ) +# undef ASSUME_VIA_ACE_PRESENT +# endif +# if defined( USE_VIA_ACE_IF_PRESENT ) +# undef USE_VIA_ACE_IF_PRESENT +# endif +#endif + +#if defined( ASSUME_VIA_ACE_PRESENT ) && !defined( USE_VIA_ACE_IF_PRESENT ) +# define USE_VIA_ACE_IF_PRESENT +#endif + +#if defined( USE_VIA_ACE_IF_PRESENT ) && !defined ( AES_REV_DKS ) +# define AES_REV_DKS +#endif + +/* Assembler support requires the use of platform byte order */ + +#if ( defined( ASM_X86_V1C ) || defined( ASM_X86_V2C ) || defined( ASM_AMD64_C ) ) \ + && (ALGORITHM_BYTE_ORDER != PLATFORM_BYTE_ORDER) +# undef ALGORITHM_BYTE_ORDER +# define ALGORITHM_BYTE_ORDER PLATFORM_BYTE_ORDER +#endif + +/* In this implementation the columns of the state array are each held in + 32-bit words. The state array can be held in various ways: in an array + of words, in a number of individual word variables or in a number of + processor registers. The following define maps a variable name x and + a column number c to the way the state array variable is to be held. + The first define below maps the state into an array x[c] whereas the + second form maps the state into a number of individual variables x0, + x1, etc. Another form could map individual state colums to machine + register names. +*/ + +#if defined( ARRAYS ) +# define s(x,c) x[c] +#else +# define s(x,c) x##c +#endif + +/* This implementation provides subroutines for encryption, decryption + and for setting the three key lengths (separately) for encryption + and decryption. Since not all functions are needed, masks are set + up here to determine which will be implemented in C +*/ + +#if !defined( AES_ENCRYPT ) +# define EFUNCS_IN_C 0 +#elif defined( ASSUME_VIA_ACE_PRESENT ) || defined( ASM_X86_V1C ) \ + || defined( ASM_X86_V2C ) || defined( ASM_AMD64_C ) +# define EFUNCS_IN_C ENC_KEYING_IN_C +#elif !defined( ASM_X86_V2 ) +# define EFUNCS_IN_C ( ENCRYPTION_IN_C | ENC_KEYING_IN_C ) +#else +# define EFUNCS_IN_C 0 +#endif + +#if !defined( AES_DECRYPT ) +# define DFUNCS_IN_C 0 +#elif defined( ASSUME_VIA_ACE_PRESENT ) || defined( ASM_X86_V1C ) \ + || defined( ASM_X86_V2C ) || defined( ASM_AMD64_C ) +# define DFUNCS_IN_C DEC_KEYING_IN_C +#elif !defined( ASM_X86_V2 ) +# define DFUNCS_IN_C ( DECRYPTION_IN_C | DEC_KEYING_IN_C ) +#else +# define DFUNCS_IN_C 0 +#endif + +#define FUNCS_IN_C ( EFUNCS_IN_C | DFUNCS_IN_C ) + +/* END OF CONFIGURATION OPTIONS */ + +#define RC_LENGTH (5 * (AES_BLOCK_SIZE / 4 - 2)) + +/* Disable or report errors on some combinations of options */ + +#if ENC_ROUND == NO_TABLES && LAST_ENC_ROUND != NO_TABLES +# undef LAST_ENC_ROUND +# define LAST_ENC_ROUND NO_TABLES +#elif ENC_ROUND == ONE_TABLE && LAST_ENC_ROUND == FOUR_TABLES +# undef LAST_ENC_ROUND +# define LAST_ENC_ROUND ONE_TABLE +#endif + +#if ENC_ROUND == NO_TABLES && ENC_UNROLL != NONE +# undef ENC_UNROLL +# define ENC_UNROLL NONE +#endif + +#if DEC_ROUND == NO_TABLES && LAST_DEC_ROUND != NO_TABLES +# undef LAST_DEC_ROUND +# define LAST_DEC_ROUND NO_TABLES +#elif DEC_ROUND == ONE_TABLE && LAST_DEC_ROUND == FOUR_TABLES +# undef LAST_DEC_ROUND +# define LAST_DEC_ROUND ONE_TABLE +#endif + +#if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE +# undef DEC_UNROLL +# define DEC_UNROLL NONE +#endif + +#if defined( bswap32 ) +# define aes_sw32 bswap32 +#elif defined( bswap_32 ) +# define aes_sw32 bswap_32 +#else +# define brot(x,n) (((uint_32t)(x) << n) | ((uint_32t)(x) >> (32 - n))) +# define aes_sw32(x) ((brot((x),8) & 0x00ff00ff) | (brot((x),24) & 0xff00ff00)) +#endif + +/* upr(x,n): rotates bytes within words by n positions, moving bytes to + higher index positions with wrap around into low positions + ups(x,n): moves bytes by n positions to higher index positions in + words but without wrap around + bval(x,n): extracts a byte from a word + + WARNING: The definitions given here are intended only for use with + unsigned variables and with shift counts that are compile + time constants +*/ + +#if ( ALGORITHM_BYTE_ORDER == IS_LITTLE_ENDIAN ) +# define upr(x,n) (((uint_32t)(x) << (8 * (n))) | ((uint_32t)(x) >> (32 - 8 * (n)))) +# define ups(x,n) ((uint_32t) (x) << (8 * (n))) +# define bval(x,n) to_byte((x) >> (8 * (n))) +# define bytes2word(b0, b1, b2, b3) \ + (((uint_32t)(b3) << 24) | ((uint_32t)(b2) << 16) | ((uint_32t)(b1) << 8) | (b0)) +#endif + +#if ( ALGORITHM_BYTE_ORDER == IS_BIG_ENDIAN ) +# define upr(x,n) (((uint_32t)(x) >> (8 * (n))) | ((uint_32t)(x) << (32 - 8 * (n)))) +# define ups(x,n) ((uint_32t) (x) >> (8 * (n))) +# define bval(x,n) to_byte((x) >> (24 - 8 * (n))) +# define bytes2word(b0, b1, b2, b3) \ + (((uint_32t)(b0) << 24) | ((uint_32t)(b1) << 16) | ((uint_32t)(b2) << 8) | (b3)) +#endif + +#if defined( SAFE_IO ) +# define word_in(x,c) bytes2word(((const uint_8t*)(x)+4*c)[0], ((const uint_8t*)(x)+4*c)[1], \ + ((const uint_8t*)(x)+4*c)[2], ((const uint_8t*)(x)+4*c)[3]) +# define word_out(x,c,v) { ((uint_8t*)(x)+4*c)[0] = bval(v,0); ((uint_8t*)(x)+4*c)[1] = bval(v,1); \ + ((uint_8t*)(x)+4*c)[2] = bval(v,2); ((uint_8t*)(x)+4*c)[3] = bval(v,3); } +#elif ( ALGORITHM_BYTE_ORDER == PLATFORM_BYTE_ORDER ) +# define word_in(x,c) (*((uint_32t*)(x)+(c))) +# define word_out(x,c,v) (*((uint_32t*)(x)+(c)) = (v)) +#else +# define word_in(x,c) aes_sw32(*((uint_32t*)(x)+(c))) +# define word_out(x,c,v) (*((uint_32t*)(x)+(c)) = aes_sw32(v)) +#endif + +/* the finite field modular polynomial and elements */ + +#define WPOLY 0x011b +#define BPOLY 0x1b + +/* multiply four bytes in GF(2^8) by 'x' {02} in parallel */ + +#define gf_c1 0x80808080 +#define gf_c2 0x7f7f7f7f +#define gf_mulx(x) ((((x) & gf_c2) << 1) ^ ((((x) & gf_c1) >> 7) * BPOLY)) + +/* The following defines provide alternative definitions of gf_mulx that might + give improved performance if a fast 32-bit multiply is not available. Note + that a temporary variable u needs to be defined where gf_mulx is used. + +#define gf_mulx(x) (u = (x) & gf_c1, u |= (u >> 1), ((x) & gf_c2) << 1) ^ ((u >> 3) | (u >> 6)) +#define gf_c4 (0x01010101 * BPOLY) +#define gf_mulx(x) (u = (x) & gf_c1, ((x) & gf_c2) << 1) ^ ((u - (u >> 7)) & gf_c4) +*/ + +/* Work out which tables are needed for the different options */ + +#if defined( ASM_X86_V1C ) +# if defined( ENC_ROUND ) +# undef ENC_ROUND +# endif +# define ENC_ROUND FOUR_TABLES +# if defined( LAST_ENC_ROUND ) +# undef LAST_ENC_ROUND +# endif +# define LAST_ENC_ROUND FOUR_TABLES +# if defined( DEC_ROUND ) +# undef DEC_ROUND +# endif +# define DEC_ROUND FOUR_TABLES +# if defined( LAST_DEC_ROUND ) +# undef LAST_DEC_ROUND +# endif +# define LAST_DEC_ROUND FOUR_TABLES +# if defined( KEY_SCHED ) +# undef KEY_SCHED +# define KEY_SCHED FOUR_TABLES +# endif +#endif + +#if ( FUNCS_IN_C & ENCRYPTION_IN_C ) || defined( ASM_X86_V1C ) +# if ENC_ROUND == ONE_TABLE +# define FT1_SET +# elif ENC_ROUND == FOUR_TABLES +# define FT4_SET +# else +# define SBX_SET +# endif +# if LAST_ENC_ROUND == ONE_TABLE +# define FL1_SET +# elif LAST_ENC_ROUND == FOUR_TABLES +# define FL4_SET +# elif !defined( SBX_SET ) +# define SBX_SET +# endif +#endif + +#if ( FUNCS_IN_C & DECRYPTION_IN_C ) || defined( ASM_X86_V1C ) +# if DEC_ROUND == ONE_TABLE +# define IT1_SET +# elif DEC_ROUND == FOUR_TABLES +# define IT4_SET +# else +# define ISB_SET +# endif +# if LAST_DEC_ROUND == ONE_TABLE +# define IL1_SET +# elif LAST_DEC_ROUND == FOUR_TABLES +# define IL4_SET +# elif !defined(ISB_SET) +# define ISB_SET +# endif +#endif + +#if !(defined( REDUCE_CODE_SIZE ) && (defined( ASM_X86_V2 ) || defined( ASM_X86_V2C ))) +# if ((FUNCS_IN_C & ENC_KEYING_IN_C) || (FUNCS_IN_C & DEC_KEYING_IN_C)) +# if KEY_SCHED == ONE_TABLE +# if !defined( FL1_SET ) && !defined( FL4_SET ) +# define LS1_SET +# endif +# elif KEY_SCHED == FOUR_TABLES +# if !defined( FL4_SET ) +# define LS4_SET +# endif +# elif !defined( SBX_SET ) +# define SBX_SET +# endif +# endif +# if (FUNCS_IN_C & DEC_KEYING_IN_C) +# if KEY_SCHED == ONE_TABLE +# define IM1_SET +# elif KEY_SCHED == FOUR_TABLES +# define IM4_SET +# elif !defined( SBX_SET ) +# define SBX_SET +# endif +# endif +#endif + +/* generic definitions of Rijndael macros that use tables */ + +#define no_table(x,box,vf,rf,c) bytes2word( \ + box[bval(vf(x,0,c),rf(0,c))], \ + box[bval(vf(x,1,c),rf(1,c))], \ + box[bval(vf(x,2,c),rf(2,c))], \ + box[bval(vf(x,3,c),rf(3,c))]) + +#define one_table(x,op,tab,vf,rf,c) \ + ( tab[bval(vf(x,0,c),rf(0,c))] \ + ^ op(tab[bval(vf(x,1,c),rf(1,c))],1) \ + ^ op(tab[bval(vf(x,2,c),rf(2,c))],2) \ + ^ op(tab[bval(vf(x,3,c),rf(3,c))],3)) + +#define four_tables(x,tab,vf,rf,c) \ + ( tab[0][bval(vf(x,0,c),rf(0,c))] \ + ^ tab[1][bval(vf(x,1,c),rf(1,c))] \ + ^ tab[2][bval(vf(x,2,c),rf(2,c))] \ + ^ tab[3][bval(vf(x,3,c),rf(3,c))]) + +#define vf1(x,r,c) (x) +#define rf1(r,c) (r) +#define rf2(r,c) ((8+r-c)&3) + +/* perform forward and inverse column mix operation on four bytes in long word x in */ +/* parallel. NOTE: x must be a simple variable, NOT an expression in these macros. */ + +#if !(defined( REDUCE_CODE_SIZE ) && (defined( ASM_X86_V2 ) || defined( ASM_X86_V2C ))) + +#if defined( FM4_SET ) /* not currently used */ +# define fwd_mcol(x) four_tables(x,t_use(f,m),vf1,rf1,0) +#elif defined( FM1_SET ) /* not currently used */ +# define fwd_mcol(x) one_table(x,upr,t_use(f,m),vf1,rf1,0) +#else +# define dec_fmvars uint_32t g2 +# define fwd_mcol(x) (g2 = gf_mulx(x), g2 ^ upr((x) ^ g2, 3) ^ upr((x), 2) ^ upr((x), 1)) +#endif + +#if defined( IM4_SET ) +# define inv_mcol(x) four_tables(x,t_use(i,m),vf1,rf1,0) +#elif defined( IM1_SET ) +# define inv_mcol(x) one_table(x,upr,t_use(i,m),vf1,rf1,0) +#else +# define dec_imvars uint_32t g2, g4, g9 +# define inv_mcol(x) (g2 = gf_mulx(x), g4 = gf_mulx(g2), g9 = (x) ^ gf_mulx(g4), g4 ^= g9, \ + (x) ^ g2 ^ g4 ^ upr(g2 ^ g9, 3) ^ upr(g4, 2) ^ upr(g9, 1)) +#endif + +#if defined( FL4_SET ) +# define ls_box(x,c) four_tables(x,t_use(f,l),vf1,rf2,c) +#elif defined( LS4_SET ) +# define ls_box(x,c) four_tables(x,t_use(l,s),vf1,rf2,c) +#elif defined( FL1_SET ) +# define ls_box(x,c) one_table(x,upr,t_use(f,l),vf1,rf2,c) +#elif defined( LS1_SET ) +# define ls_box(x,c) one_table(x,upr,t_use(l,s),vf1,rf2,c) +#else +# define ls_box(x,c) no_table(x,t_use(s,box),vf1,rf2,c) +#endif + +#endif + +#if defined( ASM_X86_V1C ) && defined( AES_DECRYPT ) && !defined( ISB_SET ) +# define ISB_SET +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/sha1.h",".h","2357","74","/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 01/08/2005 +*/ + +#ifndef _SHA1_H +#define _SHA1_H + +#include +#include ""brg_types.h"" + +#define SHA1_BLOCK_SIZE 64 +#define SHA1_DIGEST_SIZE 20 + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +/* type to hold the SHA256 context */ + +typedef struct +{ uint_32t count[2]; + uint_32t hash[5]; + uint_32t wbuf[16]; +} sha1_ctx; + +/* Note that these prototypes are the same for both bit and */ +/* byte oriented implementations. However the length fields */ +/* are in bytes or bits as appropriate for the version used */ +/* and bit sequences are input as arrays of bytes in which */ +/* bit sequences run from the most to the least significant */ +/* end of each byte */ + +VOID_RETURN sha1_compile(sha1_ctx ctx[1]); + +VOID_RETURN sha1_begin(sha1_ctx ctx[1]); +VOID_RETURN sha1_hash(const unsigned char data[], unsigned long len, sha1_ctx ctx[1]); +VOID_RETURN sha1_end(unsigned char hval[], sha1_ctx ctx[1]); +VOID_RETURN sha1(unsigned char hval[], const unsigned char data[], unsigned long len); + +#if defined(__cplusplus) +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/aestab.c",".c","15278","392","/* +--------------------------------------------------------------------------- +Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved. + +The redistribution and use of this software (with or without changes) +is allowed without the payment of fees or royalties provided that: + + source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation. + +This software is provided 'as is' with no explicit or implied warranties +in respect of its operation, including, but not limited to, correctness +and fitness for purpose. +--------------------------------------------------------------------------- +Issue Date: 20/12/2007 +*/ + +#define DO_TABLES + +#include ""aes.h"" +#include ""aesopt.h"" + +#if defined(FIXED_TABLES) + +#define sb_data(w) {\ + w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), w(0xc5),\ + w(0x30), w(0x01), w(0x67), w(0x2b), w(0xfe), w(0xd7), w(0xab), w(0x76),\ + w(0xca), w(0x82), w(0xc9), w(0x7d), w(0xfa), w(0x59), w(0x47), w(0xf0),\ + w(0xad), w(0xd4), w(0xa2), w(0xaf), w(0x9c), w(0xa4), w(0x72), w(0xc0),\ + w(0xb7), w(0xfd), w(0x93), w(0x26), w(0x36), w(0x3f), w(0xf7), w(0xcc),\ + w(0x34), w(0xa5), w(0xe5), w(0xf1), w(0x71), w(0xd8), w(0x31), w(0x15),\ + w(0x04), w(0xc7), w(0x23), w(0xc3), w(0x18), w(0x96), w(0x05), w(0x9a),\ + w(0x07), w(0x12), w(0x80), w(0xe2), w(0xeb), w(0x27), w(0xb2), w(0x75),\ + w(0x09), w(0x83), w(0x2c), w(0x1a), w(0x1b), w(0x6e), w(0x5a), w(0xa0),\ + w(0x52), w(0x3b), w(0xd6), w(0xb3), w(0x29), w(0xe3), w(0x2f), w(0x84),\ + w(0x53), w(0xd1), w(0x00), w(0xed), w(0x20), w(0xfc), w(0xb1), w(0x5b),\ + w(0x6a), w(0xcb), w(0xbe), w(0x39), w(0x4a), w(0x4c), w(0x58), w(0xcf),\ + w(0xd0), w(0xef), w(0xaa), w(0xfb), w(0x43), w(0x4d), w(0x33), w(0x85),\ + w(0x45), w(0xf9), w(0x02), w(0x7f), w(0x50), w(0x3c), w(0x9f), w(0xa8),\ + w(0x51), w(0xa3), w(0x40), w(0x8f), w(0x92), w(0x9d), w(0x38), w(0xf5),\ + w(0xbc), w(0xb6), w(0xda), w(0x21), w(0x10), w(0xff), w(0xf3), w(0xd2),\ + w(0xcd), w(0x0c), w(0x13), w(0xec), w(0x5f), w(0x97), w(0x44), w(0x17),\ + w(0xc4), w(0xa7), w(0x7e), w(0x3d), w(0x64), w(0x5d), w(0x19), w(0x73),\ + w(0x60), w(0x81), w(0x4f), w(0xdc), w(0x22), w(0x2a), w(0x90), w(0x88),\ + w(0x46), w(0xee), w(0xb8), w(0x14), w(0xde), w(0x5e), w(0x0b), w(0xdb),\ + w(0xe0), w(0x32), w(0x3a), w(0x0a), w(0x49), w(0x06), w(0x24), w(0x5c),\ + w(0xc2), w(0xd3), w(0xac), w(0x62), w(0x91), w(0x95), w(0xe4), w(0x79),\ + w(0xe7), w(0xc8), w(0x37), w(0x6d), w(0x8d), w(0xd5), w(0x4e), w(0xa9),\ + w(0x6c), w(0x56), w(0xf4), w(0xea), w(0x65), w(0x7a), w(0xae), w(0x08),\ + w(0xba), w(0x78), w(0x25), w(0x2e), w(0x1c), w(0xa6), w(0xb4), w(0xc6),\ + w(0xe8), w(0xdd), w(0x74), w(0x1f), w(0x4b), w(0xbd), w(0x8b), w(0x8a),\ + w(0x70), w(0x3e), w(0xb5), w(0x66), w(0x48), w(0x03), w(0xf6), w(0x0e),\ + w(0x61), w(0x35), w(0x57), w(0xb9), w(0x86), w(0xc1), w(0x1d), w(0x9e),\ + w(0xe1), w(0xf8), w(0x98), w(0x11), w(0x69), w(0xd9), w(0x8e), w(0x94),\ + w(0x9b), w(0x1e), w(0x87), w(0xe9), w(0xce), w(0x55), w(0x28), w(0xdf),\ + w(0x8c), w(0xa1), w(0x89), w(0x0d), w(0xbf), w(0xe6), w(0x42), w(0x68),\ + w(0x41), w(0x99), w(0x2d), w(0x0f), w(0xb0), w(0x54), w(0xbb), w(0x16) } + +#define isb_data(w) {\ + w(0x52), w(0x09), w(0x6a), w(0xd5), w(0x30), w(0x36), w(0xa5), w(0x38),\ + w(0xbf), w(0x40), w(0xa3), w(0x9e), w(0x81), w(0xf3), w(0xd7), w(0xfb),\ + w(0x7c), w(0xe3), w(0x39), w(0x82), w(0x9b), w(0x2f), w(0xff), w(0x87),\ + w(0x34), w(0x8e), w(0x43), w(0x44), w(0xc4), w(0xde), w(0xe9), w(0xcb),\ + w(0x54), w(0x7b), w(0x94), w(0x32), w(0xa6), w(0xc2), w(0x23), w(0x3d),\ + w(0xee), w(0x4c), w(0x95), w(0x0b), w(0x42), w(0xfa), w(0xc3), w(0x4e),\ + w(0x08), w(0x2e), w(0xa1), w(0x66), w(0x28), w(0xd9), w(0x24), w(0xb2),\ + w(0x76), w(0x5b), w(0xa2), w(0x49), w(0x6d), w(0x8b), w(0xd1), w(0x25),\ + w(0x72), w(0xf8), w(0xf6), w(0x64), w(0x86), w(0x68), w(0x98), w(0x16),\ + w(0xd4), w(0xa4), w(0x5c), w(0xcc), w(0x5d), w(0x65), w(0xb6), w(0x92),\ + w(0x6c), w(0x70), w(0x48), w(0x50), w(0xfd), w(0xed), w(0xb9), w(0xda),\ + w(0x5e), w(0x15), w(0x46), w(0x57), w(0xa7), w(0x8d), w(0x9d), w(0x84),\ + w(0x90), w(0xd8), w(0xab), w(0x00), w(0x8c), w(0xbc), w(0xd3), w(0x0a),\ + w(0xf7), w(0xe4), w(0x58), w(0x05), w(0xb8), w(0xb3), w(0x45), w(0x06),\ + w(0xd0), w(0x2c), w(0x1e), w(0x8f), w(0xca), w(0x3f), w(0x0f), w(0x02),\ + w(0xc1), w(0xaf), w(0xbd), w(0x03), w(0x01), w(0x13), w(0x8a), w(0x6b),\ + w(0x3a), w(0x91), w(0x11), w(0x41), w(0x4f), w(0x67), w(0xdc), w(0xea),\ + w(0x97), w(0xf2), w(0xcf), w(0xce), w(0xf0), w(0xb4), w(0xe6), w(0x73),\ + w(0x96), w(0xac), w(0x74), w(0x22), w(0xe7), w(0xad), w(0x35), w(0x85),\ + w(0xe2), w(0xf9), w(0x37), w(0xe8), w(0x1c), w(0x75), w(0xdf), w(0x6e),\ + w(0x47), w(0xf1), w(0x1a), w(0x71), w(0x1d), w(0x29), w(0xc5), w(0x89),\ + w(0x6f), w(0xb7), w(0x62), w(0x0e), w(0xaa), w(0x18), w(0xbe), w(0x1b),\ + w(0xfc), w(0x56), w(0x3e), w(0x4b), w(0xc6), w(0xd2), w(0x79), w(0x20),\ + w(0x9a), w(0xdb), w(0xc0), w(0xfe), w(0x78), w(0xcd), w(0x5a), w(0xf4),\ + w(0x1f), w(0xdd), w(0xa8), w(0x33), w(0x88), w(0x07), w(0xc7), w(0x31),\ + w(0xb1), w(0x12), w(0x10), w(0x59), w(0x27), w(0x80), w(0xec), w(0x5f),\ + w(0x60), w(0x51), w(0x7f), w(0xa9), w(0x19), w(0xb5), w(0x4a), w(0x0d),\ + w(0x2d), w(0xe5), w(0x7a), w(0x9f), w(0x93), w(0xc9), w(0x9c), w(0xef),\ + w(0xa0), w(0xe0), w(0x3b), w(0x4d), w(0xae), w(0x2a), w(0xf5), w(0xb0),\ + w(0xc8), w(0xeb), w(0xbb), w(0x3c), w(0x83), w(0x53), w(0x99), w(0x61),\ + w(0x17), w(0x2b), w(0x04), w(0x7e), w(0xba), w(0x77), w(0xd6), w(0x26),\ + w(0xe1), w(0x69), w(0x14), w(0x63), w(0x55), w(0x21), w(0x0c), w(0x7d) } + +#define mm_data(w) {\ + w(0x00), w(0x01), w(0x02), w(0x03), w(0x04), w(0x05), w(0x06), w(0x07),\ + w(0x08), w(0x09), w(0x0a), w(0x0b), w(0x0c), w(0x0d), w(0x0e), w(0x0f),\ + w(0x10), w(0x11), w(0x12), w(0x13), w(0x14), w(0x15), w(0x16), w(0x17),\ + w(0x18), w(0x19), w(0x1a), w(0x1b), w(0x1c), w(0x1d), w(0x1e), w(0x1f),\ + w(0x20), w(0x21), w(0x22), w(0x23), w(0x24), w(0x25), w(0x26), w(0x27),\ + w(0x28), w(0x29), w(0x2a), w(0x2b), w(0x2c), w(0x2d), w(0x2e), w(0x2f),\ + w(0x30), w(0x31), w(0x32), w(0x33), w(0x34), w(0x35), w(0x36), w(0x37),\ + w(0x38), w(0x39), w(0x3a), w(0x3b), w(0x3c), w(0x3d), w(0x3e), w(0x3f),\ + w(0x40), w(0x41), w(0x42), w(0x43), w(0x44), w(0x45), w(0x46), w(0x47),\ + w(0x48), w(0x49), w(0x4a), w(0x4b), w(0x4c), w(0x4d), w(0x4e), w(0x4f),\ + w(0x50), w(0x51), w(0x52), w(0x53), w(0x54), w(0x55), w(0x56), w(0x57),\ + w(0x58), w(0x59), w(0x5a), w(0x5b), w(0x5c), w(0x5d), w(0x5e), w(0x5f),\ + w(0x60), w(0x61), w(0x62), w(0x63), w(0x64), w(0x65), w(0x66), w(0x67),\ + w(0x68), w(0x69), w(0x6a), w(0x6b), w(0x6c), w(0x6d), w(0x6e), w(0x6f),\ + w(0x70), w(0x71), w(0x72), w(0x73), w(0x74), w(0x75), w(0x76), w(0x77),\ + w(0x78), w(0x79), w(0x7a), w(0x7b), w(0x7c), w(0x7d), w(0x7e), w(0x7f),\ + w(0x80), w(0x81), w(0x82), w(0x83), w(0x84), w(0x85), w(0x86), w(0x87),\ + w(0x88), w(0x89), w(0x8a), w(0x8b), w(0x8c), w(0x8d), w(0x8e), w(0x8f),\ + w(0x90), w(0x91), w(0x92), w(0x93), w(0x94), w(0x95), w(0x96), w(0x97),\ + w(0x98), w(0x99), w(0x9a), w(0x9b), w(0x9c), w(0x9d), w(0x9e), w(0x9f),\ + w(0xa0), w(0xa1), w(0xa2), w(0xa3), w(0xa4), w(0xa5), w(0xa6), w(0xa7),\ + w(0xa8), w(0xa9), w(0xaa), w(0xab), w(0xac), w(0xad), w(0xae), w(0xaf),\ + w(0xb0), w(0xb1), w(0xb2), w(0xb3), w(0xb4), w(0xb5), w(0xb6), w(0xb7),\ + w(0xb8), w(0xb9), w(0xba), w(0xbb), w(0xbc), w(0xbd), w(0xbe), w(0xbf),\ + w(0xc0), w(0xc1), w(0xc2), w(0xc3), w(0xc4), w(0xc5), w(0xc6), w(0xc7),\ + w(0xc8), w(0xc9), w(0xca), w(0xcb), w(0xcc), w(0xcd), w(0xce), w(0xcf),\ + w(0xd0), w(0xd1), w(0xd2), w(0xd3), w(0xd4), w(0xd5), w(0xd6), w(0xd7),\ + w(0xd8), w(0xd9), w(0xda), w(0xdb), w(0xdc), w(0xdd), w(0xde), w(0xdf),\ + w(0xe0), w(0xe1), w(0xe2), w(0xe3), w(0xe4), w(0xe5), w(0xe6), w(0xe7),\ + w(0xe8), w(0xe9), w(0xea), w(0xeb), w(0xec), w(0xed), w(0xee), w(0xef),\ + w(0xf0), w(0xf1), w(0xf2), w(0xf3), w(0xf4), w(0xf5), w(0xf6), w(0xf7),\ + w(0xf8), w(0xf9), w(0xfa), w(0xfb), w(0xfc), w(0xfd), w(0xfe), w(0xff) } + +#define rc_data(w) {\ + w(0x01), w(0x02), w(0x04), w(0x08), w(0x10),w(0x20), w(0x40), w(0x80),\ + w(0x1b), w(0x36) } + +#define h0(x) (x) + +#define w0(p) bytes2word(p, 0, 0, 0) +#define w1(p) bytes2word(0, p, 0, 0) +#define w2(p) bytes2word(0, 0, p, 0) +#define w3(p) bytes2word(0, 0, 0, p) + +#define u0(p) bytes2word(f2(p), p, p, f3(p)) +#define u1(p) bytes2word(f3(p), f2(p), p, p) +#define u2(p) bytes2word(p, f3(p), f2(p), p) +#define u3(p) bytes2word(p, p, f3(p), f2(p)) + +#define v0(p) bytes2word(fe(p), f9(p), fd(p), fb(p)) +#define v1(p) bytes2word(fb(p), fe(p), f9(p), fd(p)) +#define v2(p) bytes2word(fd(p), fb(p), fe(p), f9(p)) +#define v3(p) bytes2word(f9(p), fd(p), fb(p), fe(p)) + +#endif + +#if defined(FIXED_TABLES) || !defined(FF_TABLES) + +#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY)) +#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY)) +#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \ + ^ (((x>>5) & 4) * WPOLY)) +#define f3(x) (f2(x) ^ x) +#define f9(x) (f8(x) ^ x) +#define fb(x) (f8(x) ^ f2(x) ^ x) +#define fd(x) (f8(x) ^ f4(x) ^ x) +#define fe(x) (f8(x) ^ f4(x) ^ f2(x)) + +#else + +#define f2(x) ((x) ? pow[log[x] + 0x19] : 0) +#define f3(x) ((x) ? pow[log[x] + 0x01] : 0) +#define f9(x) ((x) ? pow[log[x] + 0xc7] : 0) +#define fb(x) ((x) ? pow[log[x] + 0x68] : 0) +#define fd(x) ((x) ? pow[log[x] + 0xee] : 0) +#define fe(x) ((x) ? pow[log[x] + 0xdf] : 0) + +#endif + +#include ""aestab.h"" + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +#if defined(FIXED_TABLES) + +/* implemented in case of wrong call for fixed tables */ + +AES_RETURN aes_init(void) +{ + return EXIT_SUCCESS; +} + +#else /* Generate the tables for the dynamic table option */ + +#if defined(FF_TABLES) + +#define gf_inv(x) ((x) ? pow[ 255 - log[x]] : 0) + +#else + +/* It will generally be sensible to use tables to compute finite + field multiplies and inverses but where memory is scarse this + code might sometimes be better. But it only has effect during + initialisation so its pretty unimportant in overall terms. +*/ + +/* return 2 ^ (n - 1) where n is the bit number of the highest bit + set in x with x in the range 1 < x < 0x00000200. This form is + used so that locals within fi can be bytes rather than words +*/ + +static uint_8t hibit(const uint_32t x) +{ uint_8t r = (uint_8t)((x >> 1) | (x >> 2)); + + r |= (r >> 2); + r |= (r >> 4); + return (r + 1) >> 1; +} + +/* return the inverse of the finite field element x */ + +static uint_8t gf_inv(const uint_8t x) +{ uint_8t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0; + + if(x < 2) + return x; + + for( ; ; ) + { + if(n1) + while(n2 >= n1) /* divide polynomial p2 by p1 */ + { + n2 /= n1; /* shift smaller polynomial left */ + p2 ^= (p1 * n2) & 0xff; /* and remove from larger one */ + v2 ^= v1 * n2; /* shift accumulated value and */ + n2 = hibit(p2); /* add into result */ + } + else + return v1; + + if(n2) /* repeat with values swapped */ + while(n1 >= n2) + { + n1 /= n2; + p1 ^= p2 * n1; + v1 ^= v2 * n1; + n1 = hibit(p1); + } + else + return v2; + } +} + +#endif + +/* The forward and inverse affine transformations used in the S-box */ +uint_8t fwd_affine(const uint_8t x) +{ uint_32t w = x; + w ^= (w << 1) ^ (w << 2) ^ (w << 3) ^ (w << 4); + return 0x63 ^ ((w ^ (w >> 8)) & 0xff); +} + +uint_8t inv_affine(const uint_8t x) +{ uint_32t w = x; + w = (w << 1) ^ (w << 3) ^ (w << 6); + return 0x05 ^ ((w ^ (w >> 8)) & 0xff); +} + +static int init = 0; + +AES_RETURN aes_init(void) +{ uint_32t i, w; + +#if defined(FF_TABLES) + + uint_8t pow[512], log[256]; + + if(init) + return EXIT_SUCCESS; + /* log and power tables for GF(2^8) finite field with + WPOLY as modular polynomial - the simplest primitive + root is 0x03, used here to generate the tables + */ + + i = 0; w = 1; + do + { + pow[i] = (uint_8t)w; + pow[i + 255] = (uint_8t)w; + log[w] = (uint_8t)i++; + w ^= (w << 1) ^ (w & 0x80 ? WPOLY : 0); + } + while (w != 1); + +#else + if(init) + return EXIT_SUCCESS; +#endif + + for(i = 0, w = 1; i < RC_LENGTH; ++i) + { + t_set(r,c)[i] = bytes2word(w, 0, 0, 0); + w = f2(w); + } + + for(i = 0; i < 256; ++i) + { uint_8t b; + + b = fwd_affine(gf_inv((uint_8t)i)); + w = bytes2word(f2(b), b, b, f3(b)); + +#if defined( SBX_SET ) + t_set(s,box)[i] = b; +#endif + +#if defined( FT1_SET ) /* tables for a normal encryption round */ + t_set(f,n)[i] = w; +#endif +#if defined( FT4_SET ) + t_set(f,n)[0][i] = w; + t_set(f,n)[1][i] = upr(w,1); + t_set(f,n)[2][i] = upr(w,2); + t_set(f,n)[3][i] = upr(w,3); +#endif + w = bytes2word(b, 0, 0, 0); + +#if defined( FL1_SET ) /* tables for last encryption round (may also */ + t_set(f,l)[i] = w; /* be used in the key schedule) */ +#endif +#if defined( FL4_SET ) + t_set(f,l)[0][i] = w; + t_set(f,l)[1][i] = upr(w,1); + t_set(f,l)[2][i] = upr(w,2); + t_set(f,l)[3][i] = upr(w,3); +#endif + +#if defined( LS1_SET ) /* table for key schedule if t_set(f,l) above is*/ + t_set(l,s)[i] = w; /* not of the required form */ +#endif +#if defined( LS4_SET ) + t_set(l,s)[0][i] = w; + t_set(l,s)[1][i] = upr(w,1); + t_set(l,s)[2][i] = upr(w,2); + t_set(l,s)[3][i] = upr(w,3); +#endif + + b = gf_inv(inv_affine((uint_8t)i)); + w = bytes2word(fe(b), f9(b), fd(b), fb(b)); + +#if defined( IM1_SET ) /* tables for the inverse mix column operation */ + t_set(i,m)[b] = w; +#endif +#if defined( IM4_SET ) + t_set(i,m)[0][b] = w; + t_set(i,m)[1][b] = upr(w,1); + t_set(i,m)[2][b] = upr(w,2); + t_set(i,m)[3][b] = upr(w,3); +#endif + +#if defined( ISB_SET ) + t_set(i,box)[i] = b; +#endif +#if defined( IT1_SET ) /* tables for a normal decryption round */ + t_set(i,n)[i] = w; +#endif +#if defined( IT4_SET ) + t_set(i,n)[0][i] = w; + t_set(i,n)[1][i] = upr(w,1); + t_set(i,n)[2][i] = upr(w,2); + t_set(i,n)[3][i] = upr(w,3); +#endif + w = bytes2word(b, 0, 0, 0); +#if defined( IL1_SET ) /* tables for last decryption round */ + t_set(i,l)[i] = w; +#endif +#if defined( IL4_SET ) + t_set(i,l)[0][i] = w; + t_set(i,l)[1][i] = upr(w,1); + t_set(i,l)[2][i] = upr(w,2); + t_set(i,l)[3][i] = upr(w,3); +#endif + } + init = 1; + return EXIT_SUCCESS; +} + +#endif + +#if defined(__cplusplus) +} +#endif + +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/hmac.h",".h","2940","104","/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 26/08/2003 + + This is an implementation of HMAC, the FIPS standard keyed hash function +*/ + +#ifndef _HMAC_H +#define _HMAC_H + +#include + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +#define USE_SHA1 + +#if !defined(USE_SHA1) && !defined(USE_SHA256) +#error define USE_SHA1 or USE_SHA256 to set the HMAC hash algorithm +#endif + +#ifdef USE_SHA1 + +#include ""sha1.h"" + +#define HASH_INPUT_SIZE SHA1_BLOCK_SIZE +#define HASH_OUTPUT_SIZE SHA1_DIGEST_SIZE +#define sha_ctx sha1_ctx +#define sha_begin sha1_begin +#define sha_hash sha1_hash +#define sha_end sha1_end + +#endif + +#ifdef USE_SHA256 + +#include ""sha2.h"" + +#define HASH_INPUT_SIZE SHA256_BLOCK_SIZE +#define HASH_OUTPUT_SIZE SHA256_DIGEST_SIZE +#define sha_ctx sha256_ctx +#define sha_begin sha256_begin +#define sha_hash sha256_hash +#define sha_end sha256_end + +#endif + +#define HMAC_OK 0 +#define HMAC_BAD_MODE -1 +#define HMAC_IN_DATA 0xffffffff + +typedef struct +{ unsigned char key[HASH_INPUT_SIZE]; + sha_ctx ctx[1]; + unsigned long klen; +} hmac_ctx; + +void hmac_sha_begin(hmac_ctx cx[1]); + +int hmac_sha_key(const unsigned char key[], unsigned long key_len, hmac_ctx cx[1]); + +void hmac_sha_data(const unsigned char data[], unsigned long data_len, hmac_ctx cx[1]); + +void hmac_sha_end(unsigned char mac[], unsigned long mac_len, hmac_ctx cx[1]); + +void hmac_sha(const unsigned char key[], unsigned long key_len, + const unsigned char data[], unsigned long data_len, + unsigned char mac[], unsigned long mac_len); + +#if defined(__cplusplus) +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/brg_endian.h",".h","5164","127","/* +--------------------------------------------------------------------------- +Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved. + +The redistribution and use of this software (with or without changes) +is allowed without the payment of fees or royalties provided that: + + source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation. + +This software is provided 'as is' with no explicit or implied warranties +in respect of its operation, including, but not limited to, correctness +and fitness for purpose. +--------------------------------------------------------------------------- +Issue Date: 20/12/2007 +*/ + +#ifndef _BRG_ENDIAN_H +#define _BRG_ENDIAN_H + +#define IS_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */ +#define IS_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */ + +/* Include files where endian defines and byteswap functions may reside */ +#if defined( __sun ) +# include +#elif defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ ) +# include +#elif defined( BSD ) && ( BSD >= 199103 ) || defined( __APPLE__ ) || \ + defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ ) +# include +#elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ ) +# if !defined( __MINGW32__ ) && !defined( _AIX ) +# include +# if !defined( __BEOS__ ) +# include +# endif +# endif +#endif + +/* Now attempt to set the define for platform byte order using any */ +/* of the four forms SYMBOL, _SYMBOL, __SYMBOL & __SYMBOL__, which */ +/* seem to encompass most endian symbol definitions */ + +#if defined( BIG_ENDIAN ) && defined( LITTLE_ENDIAN ) +# if defined( BYTE_ORDER ) && BYTE_ORDER == BIG_ENDIAN +# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN +# elif defined( BYTE_ORDER ) && BYTE_ORDER == LITTLE_ENDIAN +# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN +# endif +#elif defined( BIG_ENDIAN ) +# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN +#elif defined( LITTLE_ENDIAN ) +# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN +#endif + +#if defined( _BIG_ENDIAN ) && defined( _LITTLE_ENDIAN ) +# if defined( _BYTE_ORDER ) && _BYTE_ORDER == _BIG_ENDIAN +# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN +# elif defined( _BYTE_ORDER ) && _BYTE_ORDER == _LITTLE_ENDIAN +# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN +# endif +#elif defined( _BIG_ENDIAN ) +# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN +#elif defined( _LITTLE_ENDIAN ) +# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN +#endif + +#if defined( __BIG_ENDIAN ) && defined( __LITTLE_ENDIAN ) +# if defined( __BYTE_ORDER ) && __BYTE_ORDER == __BIG_ENDIAN +# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN +# elif defined( __BYTE_ORDER ) && __BYTE_ORDER == __LITTLE_ENDIAN +# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN +# endif +#elif defined( __BIG_ENDIAN ) +# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN +#elif defined( __LITTLE_ENDIAN ) +# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN +#endif + +#if defined( __BIG_ENDIAN__ ) && defined( __LITTLE_ENDIAN__ ) +# if defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __BIG_ENDIAN__ +# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN +# elif defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __LITTLE_ENDIAN__ +# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN +# endif +#elif defined( __BIG_ENDIAN__ ) +# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN +#elif defined( __LITTLE_ENDIAN__ ) +# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN +#endif + +/* if the platform byte order could not be determined, then try to */ +/* set this define using common machine defines */ +#if !defined(PLATFORM_BYTE_ORDER) + +#if defined( __alpha__ ) || defined( __alpha ) || defined( i386 ) || \ + defined( __i386__ ) || defined( _M_I86 ) || defined( _M_IX86 ) || \ + defined( __OS2__ ) || defined( sun386 ) || defined( __TURBOC__ ) || \ + defined( vax ) || defined( vms ) || defined( VMS ) || \ + defined( __VMS ) || defined( _M_X64 ) +# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN + +#elif defined( AMIGA ) || defined( applec ) || defined( __AS400__ ) || \ + defined( _CRAY ) || defined( __hppa ) || defined( __hp9000 ) || \ + defined( ibm370 ) || defined( mc68000 ) || defined( m68k ) || \ + defined( __MRC__ ) || defined( __MVS__ ) || defined( __MWERKS__ ) || \ + defined( sparc ) || defined( __sparc) || defined( SYMANTEC_C ) || \ + defined( __VOS__ ) || defined( __TIGCC__ ) || defined( __TANDEM ) || \ + defined( THINK_C ) || defined( __VMCMS__ ) || defined( _AIX ) +# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN + +#elif 0 /* **** EDIT HERE IF NECESSARY **** */ +# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN +#elif 0 /* **** EDIT HERE IF NECESSARY **** */ +# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN +#else +# error Please edit lines 126 or 128 in brg_endian.h to set the platform byte order +#endif + +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/hmac.c",".c","5102","146","/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 26/08/2003 + + This is an implementation of HMAC, the FIPS standard keyed hash function +*/ + +#include ""hmac.h"" +#include ""brg_types.h"" + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +/* initialise the HMAC context to zero */ +void hmac_sha_begin(hmac_ctx cx[1]) +{ + memset(cx, 0, sizeof(hmac_ctx)); +} + +/* input the HMAC key (can be called multiple times) */ +int hmac_sha_key(const unsigned char key[], unsigned long key_len, hmac_ctx cx[1]) +{ + if(cx->klen == HMAC_IN_DATA) /* error if further key input */ + return HMAC_BAD_MODE; /* is attempted in data mode */ + + if(cx->klen + key_len > HASH_INPUT_SIZE) /* if the key has to be hashed */ + { + if(cx->klen <= HASH_INPUT_SIZE) /* if the hash has not yet been */ + { /* started, initialise it and */ + sha_begin(cx->ctx); /* hash stored key characters */ + sha_hash(cx->key, cx->klen, cx->ctx); + } + + sha_hash(key, key_len, cx->ctx); /* hash long key data into hash */ + } + else /* otherwise store key data */ + memcpy(cx->key + cx->klen, key, key_len); + + cx->klen += key_len; /* update the key length count */ + return HMAC_OK; +} + +/* input the HMAC data (can be called multiple times) - */ +/* note that this call terminates the key input phase */ +void hmac_sha_data(const unsigned char data[], unsigned long data_len, hmac_ctx cx[1]) +{ unsigned int i; + + if(cx->klen != HMAC_IN_DATA) /* if not yet in data phase */ + { + if(cx->klen > HASH_INPUT_SIZE) /* if key is being hashed */ + { /* complete the hash and */ + sha_end(cx->key, cx->ctx); /* store the result as the */ + cx->klen = HASH_OUTPUT_SIZE; /* key and set new length */ + } + + /* pad the key if necessary */ + memset(cx->key + cx->klen, 0, HASH_INPUT_SIZE - cx->klen); + + /* xor ipad into key value */ + for(i = 0; i < (HASH_INPUT_SIZE >> 2); ++i) + ((uint_32t*)cx->key)[i] ^= 0x36363636; + + /* and start hash operation */ + sha_begin(cx->ctx); + sha_hash(cx->key, HASH_INPUT_SIZE, cx->ctx); + + /* mark as now in data mode */ + cx->klen = HMAC_IN_DATA; + } + + /* hash the data (if any) */ + if(data_len) + sha_hash(data, data_len, cx->ctx); +} + +/* compute and output the MAC value */ +void hmac_sha_end(unsigned char mac[], unsigned long mac_len, hmac_ctx cx[1]) +{ unsigned char dig[HASH_OUTPUT_SIZE]; + unsigned int i; + + /* if no data has been entered perform a null data phase */ + if(cx->klen != HMAC_IN_DATA) + hmac_sha_data((const unsigned char*)0, 0, cx); + + sha_end(dig, cx->ctx); /* complete the inner hash */ + + /* set outer key value using opad and removing ipad */ + for(i = 0; i < (HASH_INPUT_SIZE >> 2); ++i) + ((uint_32t*)cx->key)[i] ^= 0x36363636 ^ 0x5c5c5c5c; + + /* perform the outer hash operation */ + sha_begin(cx->ctx); + sha_hash(cx->key, HASH_INPUT_SIZE, cx->ctx); + sha_hash(dig, HASH_OUTPUT_SIZE, cx->ctx); + sha_end(dig, cx->ctx); + + /* output the hash value */ + for(i = 0; i < mac_len; ++i) + mac[i] = dig[i]; +} + +/* 'do it all in one go' subroutine */ +void hmac_sha(const unsigned char key[], unsigned long key_len, + const unsigned char data[], unsigned long data_len, + unsigned char mac[], unsigned long mac_len) +{ hmac_ctx cx[1]; + + hmac_sha_begin(cx); + hmac_sha_key(key, key_len, cx); + hmac_sha_data(data, data_len, cx); + hmac_sha_end(mac, mac_len, cx); +} + +#if defined(__cplusplus) +} +#endif +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/fileenc.c",".c","4762","144","/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK. + All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + ------------------------------------------------------------------------- + Issue Date: 24/01/2003 + + This file implements password based file encryption and authentication + using AES in CTR mode, HMAC-SHA1 authentication and RFC2898 password + based key derivation. + +*/ + +#include + +#include ""fileenc.h"" + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +/* subroutine for data encryption/decryption */ +/* this could be speeded up a lot by aligning */ +/* buffers and using 32 bit operations */ + +static void encr_data(unsigned char data[], unsigned long d_len, fcrypt_ctx cx[1]) +{ unsigned long i = 0, pos = cx->encr_pos; + + while(i < d_len) + { + if(pos == AES_BLOCK_SIZE) + { unsigned int j = 0; + /* increment encryption nonce */ + while(j < 8 && !++cx->nonce[j]) + ++j; + /* encrypt the nonce to form next xor buffer */ + aes_encrypt(cx->nonce, cx->encr_bfr, cx->encr_ctx); + pos = 0; + } + + data[i++] ^= cx->encr_bfr[pos++]; + } + + cx->encr_pos = pos; +} + +int fcrypt_init( + int mode, /* the mode to be used (input) */ + const unsigned char pwd[], /* the user specified password (input) */ + unsigned int pwd_len, /* the length of the password (input) */ + const unsigned char salt[], /* the salt (input) */ +#ifdef PASSWORD_VERIFIER + unsigned char pwd_ver[PWD_VER_LENGTH], /* 2 byte password verifier (output) */ +#endif + fcrypt_ctx cx[1]) /* the file encryption context (output) */ +{ unsigned char kbuf[2 * MAX_KEY_LENGTH + PWD_VER_LENGTH]; + + if(pwd_len > MAX_PWD_LENGTH) + return PASSWORD_TOO_LONG; + + if(mode < 1 || mode > 3) + return BAD_MODE; + + cx->mode = mode; + cx->pwd_len = pwd_len; + + /* derive the encryption and authentication keys and the password verifier */ + derive_key(pwd, pwd_len, salt, SALT_LENGTH(mode), KEYING_ITERATIONS, + kbuf, 2 * KEY_LENGTH(mode) + PWD_VER_LENGTH); + + /* initialise the encryption nonce and buffer pos */ + cx->encr_pos = AES_BLOCK_SIZE; + /* if we need a random component in the encryption */ + /* nonce, this is where it would have to be set */ + memset(cx->nonce, 0, AES_BLOCK_SIZE * sizeof(unsigned char)); + + /* initialise for encryption using key 1 */ + aes_encrypt_key(kbuf, KEY_LENGTH(mode), cx->encr_ctx); + + /* initialise for authentication using key 2 */ + hmac_sha_begin(cx->auth_ctx); + hmac_sha_key(kbuf + KEY_LENGTH(mode), KEY_LENGTH(mode), cx->auth_ctx); + +#ifdef PASSWORD_VERIFIER + memcpy(pwd_ver, kbuf + 2 * KEY_LENGTH(mode), PWD_VER_LENGTH); +#endif + + return GOOD_RETURN; +} + +/* perform 'in place' encryption and authentication */ + +void fcrypt_encrypt(unsigned char data[], unsigned int data_len, fcrypt_ctx cx[1]) +{ + encr_data(data, data_len, cx); + hmac_sha_data(data, data_len, cx->auth_ctx); +} + +/* perform 'in place' authentication and decryption */ + +void fcrypt_decrypt(unsigned char data[], unsigned int data_len, fcrypt_ctx cx[1]) +{ + hmac_sha_data(data, data_len, cx->auth_ctx); + encr_data(data, data_len, cx); +} + +/* close encryption/decryption and return the MAC value */ + +int fcrypt_end(unsigned char mac[], fcrypt_ctx cx[1]) +{ + hmac_sha_end(mac, MAC_LENGTH(cx->mode), cx->auth_ctx); + return MAC_LENGTH(cx->mode); /* return MAC length in bytes */ +} + +#if defined(__cplusplus) +} +#endif +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/aeskey.c",".c","15836","549","/* +--------------------------------------------------------------------------- +Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved. + +The redistribution and use of this software (with or without changes) +is allowed without the payment of fees or royalties provided that: + + source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation. + +This software is provided 'as is' with no explicit or implied warranties +in respect of its operation, including, but not limited to, correctness +and fitness for purpose. +--------------------------------------------------------------------------- +Issue Date: 20/12/2007 +*/ + +#include ""aesopt.h"" +#include ""aestab.h"" + +#ifdef USE_VIA_ACE_IF_PRESENT +# include ""aes_via_ace.h"" +#endif + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +/* Initialise the key schedule from the user supplied key. The key + length can be specified in bytes, with legal values of 16, 24 + and 32, or in bits, with legal values of 128, 192 and 256. These + values correspond with Nk values of 4, 6 and 8 respectively. + + The following macros implement a single cycle in the key + schedule generation process. The number of cycles needed + for each cx->n_col and nk value is: + + nk = 4 5 6 7 8 + ------------------------------ + cx->n_col = 4 10 9 8 7 7 + cx->n_col = 5 14 11 10 9 9 + cx->n_col = 6 19 15 12 11 11 + cx->n_col = 7 21 19 16 13 14 + cx->n_col = 8 29 23 19 17 14 +*/ + +#if defined( REDUCE_CODE_SIZE ) +# define ls_box ls_sub + uint_32t ls_sub(const uint_32t t, const uint_32t n); +# define inv_mcol im_sub + uint_32t im_sub(const uint_32t x); +# ifdef ENC_KS_UNROLL +# undef ENC_KS_UNROLL +# endif +# ifdef DEC_KS_UNROLL +# undef DEC_KS_UNROLL +# endif +#endif + +#if (FUNCS_IN_C & ENC_KEYING_IN_C) + +#if defined(AES_128) || defined( AES_VAR ) + +#define ke4(k,i) \ +{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; \ + k[4*(i)+5] = ss[1] ^= ss[0]; \ + k[4*(i)+6] = ss[2] ^= ss[1]; \ + k[4*(i)+7] = ss[3] ^= ss[2]; \ +} + +AES_RETURN aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]) +{ uint_32t ss[4]; + + cx->ks[0] = ss[0] = word_in(key, 0); + cx->ks[1] = ss[1] = word_in(key, 1); + cx->ks[2] = ss[2] = word_in(key, 2); + cx->ks[3] = ss[3] = word_in(key, 3); + +#ifdef ENC_KS_UNROLL + ke4(cx->ks, 0); ke4(cx->ks, 1); + ke4(cx->ks, 2); ke4(cx->ks, 3); + ke4(cx->ks, 4); ke4(cx->ks, 5); + ke4(cx->ks, 6); ke4(cx->ks, 7); + ke4(cx->ks, 8); +#else + { uint_32t i; + for(i = 0; i < 9; ++i) + ke4(cx->ks, i); + } +#endif + ke4(cx->ks, 9); + cx->inf.l = 0; + cx->inf.b[0] = 10 * 16; + +#ifdef USE_VIA_ACE_IF_PRESENT + if(VIA_ACE_AVAILABLE) + cx->inf.b[1] = 0xff; +#endif + return EXIT_SUCCESS; +} + +#endif + +#if defined(AES_192) || defined( AES_VAR ) + +#define kef6(k,i) \ +{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; \ + k[6*(i)+ 7] = ss[1] ^= ss[0]; \ + k[6*(i)+ 8] = ss[2] ^= ss[1]; \ + k[6*(i)+ 9] = ss[3] ^= ss[2]; \ +} + +#define ke6(k,i) \ +{ kef6(k,i); \ + k[6*(i)+10] = ss[4] ^= ss[3]; \ + k[6*(i)+11] = ss[5] ^= ss[4]; \ +} + +AES_RETURN aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]) +{ uint_32t ss[6]; + + cx->ks[0] = ss[0] = word_in(key, 0); + cx->ks[1] = ss[1] = word_in(key, 1); + cx->ks[2] = ss[2] = word_in(key, 2); + cx->ks[3] = ss[3] = word_in(key, 3); + cx->ks[4] = ss[4] = word_in(key, 4); + cx->ks[5] = ss[5] = word_in(key, 5); + +#ifdef ENC_KS_UNROLL + ke6(cx->ks, 0); ke6(cx->ks, 1); + ke6(cx->ks, 2); ke6(cx->ks, 3); + ke6(cx->ks, 4); ke6(cx->ks, 5); + ke6(cx->ks, 6); +#else + { uint_32t i; + for(i = 0; i < 7; ++i) + ke6(cx->ks, i); + } +#endif + kef6(cx->ks, 7); + cx->inf.l = 0; + cx->inf.b[0] = 12 * 16; + +#ifdef USE_VIA_ACE_IF_PRESENT + if(VIA_ACE_AVAILABLE) + cx->inf.b[1] = 0xff; +#endif + return EXIT_SUCCESS; +} + +#endif + +#if defined(AES_256) || defined( AES_VAR ) + +#define kef8(k,i) \ +{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; \ + k[8*(i)+ 9] = ss[1] ^= ss[0]; \ + k[8*(i)+10] = ss[2] ^= ss[1]; \ + k[8*(i)+11] = ss[3] ^= ss[2]; \ +} + +#define ke8(k,i) \ +{ kef8(k,i); \ + k[8*(i)+12] = ss[4] ^= ls_box(ss[3],0); \ + k[8*(i)+13] = ss[5] ^= ss[4]; \ + k[8*(i)+14] = ss[6] ^= ss[5]; \ + k[8*(i)+15] = ss[7] ^= ss[6]; \ +} + +AES_RETURN aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]) +{ uint_32t ss[8]; + + cx->ks[0] = ss[0] = word_in(key, 0); + cx->ks[1] = ss[1] = word_in(key, 1); + cx->ks[2] = ss[2] = word_in(key, 2); + cx->ks[3] = ss[3] = word_in(key, 3); + cx->ks[4] = ss[4] = word_in(key, 4); + cx->ks[5] = ss[5] = word_in(key, 5); + cx->ks[6] = ss[6] = word_in(key, 6); + cx->ks[7] = ss[7] = word_in(key, 7); + +#ifdef ENC_KS_UNROLL + ke8(cx->ks, 0); ke8(cx->ks, 1); + ke8(cx->ks, 2); ke8(cx->ks, 3); + ke8(cx->ks, 4); ke8(cx->ks, 5); +#else + { uint_32t i; + for(i = 0; i < 6; ++i) + ke8(cx->ks, i); + } +#endif + kef8(cx->ks, 6); + cx->inf.l = 0; + cx->inf.b[0] = 14 * 16; + +#ifdef USE_VIA_ACE_IF_PRESENT + if(VIA_ACE_AVAILABLE) + cx->inf.b[1] = 0xff; +#endif + return EXIT_SUCCESS; +} + +#endif + +#if defined( AES_VAR ) + +AES_RETURN aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]) +{ + switch(key_len) + { + case 16: case 128: return aes_encrypt_key128(key, cx); + case 24: case 192: return aes_encrypt_key192(key, cx); + case 32: case 256: return aes_encrypt_key256(key, cx); + default: return EXIT_FAILURE; + } +} + +#endif + +#endif + +#if (FUNCS_IN_C & DEC_KEYING_IN_C) + +/* this is used to store the decryption round keys */ +/* in forward or reverse order */ + +#ifdef AES_REV_DKS +#define v(n,i) ((n) - (i) + 2 * ((i) & 3)) +#else +#define v(n,i) (i) +#endif + +#if DEC_ROUND == NO_TABLES +#define ff(x) (x) +#else +#define ff(x) inv_mcol(x) +#if defined( dec_imvars ) +#define d_vars dec_imvars +#endif +#endif + +#if defined(AES_128) || defined( AES_VAR ) + +#define k4e(k,i) \ +{ k[v(40,(4*(i))+4)] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; \ + k[v(40,(4*(i))+5)] = ss[1] ^= ss[0]; \ + k[v(40,(4*(i))+6)] = ss[2] ^= ss[1]; \ + k[v(40,(4*(i))+7)] = ss[3] ^= ss[2]; \ +} + +#if 1 + +#define kdf4(k,i) \ +{ ss[0] = ss[0] ^ ss[2] ^ ss[1] ^ ss[3]; \ + ss[1] = ss[1] ^ ss[3]; \ + ss[2] = ss[2] ^ ss[3]; \ + ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; \ + ss[i % 4] ^= ss[4]; \ + ss[4] ^= k[v(40,(4*(i)))]; k[v(40,(4*(i))+4)] = ff(ss[4]); \ + ss[4] ^= k[v(40,(4*(i))+1)]; k[v(40,(4*(i))+5)] = ff(ss[4]); \ + ss[4] ^= k[v(40,(4*(i))+2)]; k[v(40,(4*(i))+6)] = ff(ss[4]); \ + ss[4] ^= k[v(40,(4*(i))+3)]; k[v(40,(4*(i))+7)] = ff(ss[4]); \ +} + +#define kd4(k,i) \ +{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; \ + ss[i % 4] ^= ss[4]; ss[4] = ff(ss[4]); \ + k[v(40,(4*(i))+4)] = ss[4] ^= k[v(40,(4*(i)))]; \ + k[v(40,(4*(i))+5)] = ss[4] ^= k[v(40,(4*(i))+1)]; \ + k[v(40,(4*(i))+6)] = ss[4] ^= k[v(40,(4*(i))+2)]; \ + k[v(40,(4*(i))+7)] = ss[4] ^= k[v(40,(4*(i))+3)]; \ +} + +#define kdl4(k,i) \ +{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; \ + k[v(40,(4*(i))+4)] = (ss[0] ^= ss[1]) ^ ss[2] ^ ss[3]; \ + k[v(40,(4*(i))+5)] = ss[1] ^ ss[3]; \ + k[v(40,(4*(i))+6)] = ss[0]; \ + k[v(40,(4*(i))+7)] = ss[1]; \ +} + +#else + +#define kdf4(k,i) \ +{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[v(40,(4*(i))+ 4)] = ff(ss[0]); \ + ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ff(ss[1]); \ + ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ff(ss[2]); \ + ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ff(ss[3]); \ +} + +#define kd4(k,i) \ +{ ss[4] = ls_box(ss[3],3) ^ t_use(r,c)[i]; \ + ss[0] ^= ss[4]; ss[4] = ff(ss[4]); k[v(40,(4*(i))+ 4)] = ss[4] ^= k[v(40,(4*(i)))]; \ + ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ss[4] ^= k[v(40,(4*(i))+ 1)]; \ + ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ss[4] ^= k[v(40,(4*(i))+ 2)]; \ + ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ss[4] ^= k[v(40,(4*(i))+ 3)]; \ +} + +#define kdl4(k,i) \ +{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[v(40,(4*(i))+ 4)] = ss[0]; \ + ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ss[1]; \ + ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ss[2]; \ + ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ss[3]; \ +} + +#endif + +AES_RETURN aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]) +{ uint_32t ss[5]; +#if defined( d_vars ) + d_vars; +#endif + cx->ks[v(40,(0))] = ss[0] = word_in(key, 0); + cx->ks[v(40,(1))] = ss[1] = word_in(key, 1); + cx->ks[v(40,(2))] = ss[2] = word_in(key, 2); + cx->ks[v(40,(3))] = ss[3] = word_in(key, 3); + +#ifdef DEC_KS_UNROLL + kdf4(cx->ks, 0); kd4(cx->ks, 1); + kd4(cx->ks, 2); kd4(cx->ks, 3); + kd4(cx->ks, 4); kd4(cx->ks, 5); + kd4(cx->ks, 6); kd4(cx->ks, 7); + kd4(cx->ks, 8); kdl4(cx->ks, 9); +#else + { uint_32t i; + for(i = 0; i < 10; ++i) + k4e(cx->ks, i); +#if !(DEC_ROUND == NO_TABLES) + for(i = N_COLS; i < 10 * N_COLS; ++i) + cx->ks[i] = inv_mcol(cx->ks[i]); +#endif + } +#endif + cx->inf.l = 0; + cx->inf.b[0] = 10 * 16; + +#ifdef USE_VIA_ACE_IF_PRESENT + if(VIA_ACE_AVAILABLE) + cx->inf.b[1] = 0xff; +#endif + return EXIT_SUCCESS; +} + +#endif + +#if defined(AES_192) || defined( AES_VAR ) + +#define k6ef(k,i) \ +{ k[v(48,(6*(i))+ 6)] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; \ + k[v(48,(6*(i))+ 7)] = ss[1] ^= ss[0]; \ + k[v(48,(6*(i))+ 8)] = ss[2] ^= ss[1]; \ + k[v(48,(6*(i))+ 9)] = ss[3] ^= ss[2]; \ +} + +#define k6e(k,i) \ +{ k6ef(k,i); \ + k[v(48,(6*(i))+10)] = ss[4] ^= ss[3]; \ + k[v(48,(6*(i))+11)] = ss[5] ^= ss[4]; \ +} + +#define kdf6(k,i) \ +{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[v(48,(6*(i))+ 6)] = ff(ss[0]); \ + ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ff(ss[1]); \ + ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ff(ss[2]); \ + ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ff(ss[3]); \ + ss[4] ^= ss[3]; k[v(48,(6*(i))+10)] = ff(ss[4]); \ + ss[5] ^= ss[4]; k[v(48,(6*(i))+11)] = ff(ss[5]); \ +} + +#define kd6(k,i) \ +{ ss[6] = ls_box(ss[5],3) ^ t_use(r,c)[i]; \ + ss[0] ^= ss[6]; ss[6] = ff(ss[6]); k[v(48,(6*(i))+ 6)] = ss[6] ^= k[v(48,(6*(i)))]; \ + ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ss[6] ^= k[v(48,(6*(i))+ 1)]; \ + ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ss[6] ^= k[v(48,(6*(i))+ 2)]; \ + ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ss[6] ^= k[v(48,(6*(i))+ 3)]; \ + ss[4] ^= ss[3]; k[v(48,(6*(i))+10)] = ss[6] ^= k[v(48,(6*(i))+ 4)]; \ + ss[5] ^= ss[4]; k[v(48,(6*(i))+11)] = ss[6] ^= k[v(48,(6*(i))+ 5)]; \ +} + +#define kdl6(k,i) \ +{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[v(48,(6*(i))+ 6)] = ss[0]; \ + ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ss[1]; \ + ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ss[2]; \ + ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ss[3]; \ +} + +AES_RETURN aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]) +{ uint_32t ss[7]; +#if defined( d_vars ) + d_vars; +#endif + cx->ks[v(48,(0))] = ss[0] = word_in(key, 0); + cx->ks[v(48,(1))] = ss[1] = word_in(key, 1); + cx->ks[v(48,(2))] = ss[2] = word_in(key, 2); + cx->ks[v(48,(3))] = ss[3] = word_in(key, 3); + +#ifdef DEC_KS_UNROLL + cx->ks[v(48,(4))] = ff(ss[4] = word_in(key, 4)); + cx->ks[v(48,(5))] = ff(ss[5] = word_in(key, 5)); + kdf6(cx->ks, 0); kd6(cx->ks, 1); + kd6(cx->ks, 2); kd6(cx->ks, 3); + kd6(cx->ks, 4); kd6(cx->ks, 5); + kd6(cx->ks, 6); kdl6(cx->ks, 7); +#else + cx->ks[v(48,(4))] = ss[4] = word_in(key, 4); + cx->ks[v(48,(5))] = ss[5] = word_in(key, 5); + { uint_32t i; + + for(i = 0; i < 7; ++i) + k6e(cx->ks, i); + k6ef(cx->ks, 7); +#if !(DEC_ROUND == NO_TABLES) + for(i = N_COLS; i < 12 * N_COLS; ++i) + cx->ks[i] = inv_mcol(cx->ks[i]); +#endif + } +#endif + cx->inf.l = 0; + cx->inf.b[0] = 12 * 16; + +#ifdef USE_VIA_ACE_IF_PRESENT + if(VIA_ACE_AVAILABLE) + cx->inf.b[1] = 0xff; +#endif + return EXIT_SUCCESS; +} + +#endif + +#if defined(AES_256) || defined( AES_VAR ) + +#define k8ef(k,i) \ +{ k[v(56,(8*(i))+ 8)] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; \ + k[v(56,(8*(i))+ 9)] = ss[1] ^= ss[0]; \ + k[v(56,(8*(i))+10)] = ss[2] ^= ss[1]; \ + k[v(56,(8*(i))+11)] = ss[3] ^= ss[2]; \ +} + +#define k8e(k,i) \ +{ k8ef(k,i); \ + k[v(56,(8*(i))+12)] = ss[4] ^= ls_box(ss[3],0); \ + k[v(56,(8*(i))+13)] = ss[5] ^= ss[4]; \ + k[v(56,(8*(i))+14)] = ss[6] ^= ss[5]; \ + k[v(56,(8*(i))+15)] = ss[7] ^= ss[6]; \ +} + +#define kdf8(k,i) \ +{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[v(56,(8*(i))+ 8)] = ff(ss[0]); \ + ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ff(ss[1]); \ + ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ff(ss[2]); \ + ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ff(ss[3]); \ + ss[4] ^= ls_box(ss[3],0); k[v(56,(8*(i))+12)] = ff(ss[4]); \ + ss[5] ^= ss[4]; k[v(56,(8*(i))+13)] = ff(ss[5]); \ + ss[6] ^= ss[5]; k[v(56,(8*(i))+14)] = ff(ss[6]); \ + ss[7] ^= ss[6]; k[v(56,(8*(i))+15)] = ff(ss[7]); \ +} + +#define kd8(k,i) \ +{ ss[8] = ls_box(ss[7],3) ^ t_use(r,c)[i]; \ + ss[0] ^= ss[8]; ss[8] = ff(ss[8]); k[v(56,(8*(i))+ 8)] = ss[8] ^= k[v(56,(8*(i)))]; \ + ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ss[8] ^= k[v(56,(8*(i))+ 1)]; \ + ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ss[8] ^= k[v(56,(8*(i))+ 2)]; \ + ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ss[8] ^= k[v(56,(8*(i))+ 3)]; \ + ss[8] = ls_box(ss[3],0); \ + ss[4] ^= ss[8]; ss[8] = ff(ss[8]); k[v(56,(8*(i))+12)] = ss[8] ^= k[v(56,(8*(i))+ 4)]; \ + ss[5] ^= ss[4]; k[v(56,(8*(i))+13)] = ss[8] ^= k[v(56,(8*(i))+ 5)]; \ + ss[6] ^= ss[5]; k[v(56,(8*(i))+14)] = ss[8] ^= k[v(56,(8*(i))+ 6)]; \ + ss[7] ^= ss[6]; k[v(56,(8*(i))+15)] = ss[8] ^= k[v(56,(8*(i))+ 7)]; \ +} + +#define kdl8(k,i) \ +{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[v(56,(8*(i))+ 8)] = ss[0]; \ + ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ss[1]; \ + ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ss[2]; \ + ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ss[3]; \ +} + +AES_RETURN aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]) +{ uint_32t ss[9]; +#if defined( d_vars ) + d_vars; +#endif + cx->ks[v(56,(0))] = ss[0] = word_in(key, 0); + cx->ks[v(56,(1))] = ss[1] = word_in(key, 1); + cx->ks[v(56,(2))] = ss[2] = word_in(key, 2); + cx->ks[v(56,(3))] = ss[3] = word_in(key, 3); + +#ifdef DEC_KS_UNROLL + cx->ks[v(56,(4))] = ff(ss[4] = word_in(key, 4)); + cx->ks[v(56,(5))] = ff(ss[5] = word_in(key, 5)); + cx->ks[v(56,(6))] = ff(ss[6] = word_in(key, 6)); + cx->ks[v(56,(7))] = ff(ss[7] = word_in(key, 7)); + kdf8(cx->ks, 0); kd8(cx->ks, 1); + kd8(cx->ks, 2); kd8(cx->ks, 3); + kd8(cx->ks, 4); kd8(cx->ks, 5); + kdl8(cx->ks, 6); +#else + cx->ks[v(56,(4))] = ss[4] = word_in(key, 4); + cx->ks[v(56,(5))] = ss[5] = word_in(key, 5); + cx->ks[v(56,(6))] = ss[6] = word_in(key, 6); + cx->ks[v(56,(7))] = ss[7] = word_in(key, 7); + { uint_32t i; + + for(i = 0; i < 6; ++i) + k8e(cx->ks, i); + k8ef(cx->ks, 6); +#if !(DEC_ROUND == NO_TABLES) + for(i = N_COLS; i < 14 * N_COLS; ++i) + cx->ks[i] = inv_mcol(cx->ks[i]); +#endif + } +#endif + cx->inf.l = 0; + cx->inf.b[0] = 14 * 16; + +#ifdef USE_VIA_ACE_IF_PRESENT + if(VIA_ACE_AVAILABLE) + cx->inf.b[1] = 0xff; +#endif + return EXIT_SUCCESS; +} + +#endif + +#if defined( AES_VAR ) + +AES_RETURN aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]) +{ + switch(key_len) + { + case 16: case 128: return aes_decrypt_key128(key, cx); + case 24: case 192: return aes_decrypt_key192(key, cx); + case 32: case 256: return aes_decrypt_key256(key, cx); + default: return EXIT_FAILURE; + } +} + +#endif + +#endif + +#if defined(__cplusplus) +} +#endif +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/aescrypt.c",".c","9845","295","/* +--------------------------------------------------------------------------- +Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved. + +The redistribution and use of this software (with or without changes) +is allowed without the payment of fees or royalties provided that: + + source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation. + +This software is provided 'as is' with no explicit or implied warranties +in respect of its operation, including, but not limited to, correctness +and fitness for purpose. +--------------------------------------------------------------------------- +Issue Date: 20/12/2007 +*/ + +#include ""aesopt.h"" +#include ""aestab.h"" + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +#define si(y,x,k,c) (s(y,c) = word_in(x, c) ^ (k)[c]) +#define so(y,x,c) word_out(y, c, s(x,c)) + +#if defined(ARRAYS) +#define locals(y,x) x[4],y[4] +#else +#define locals(y,x) x##0,x##1,x##2,x##3,y##0,y##1,y##2,y##3 +#endif + +#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \ + s(y,2) = s(x,2); s(y,3) = s(x,3); +#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3) +#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3) +#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3) + +#if ( FUNCS_IN_C & ENCRYPTION_IN_C ) + +/* Visual C++ .Net v7.1 provides the fastest encryption code when using + Pentium optimiation with small code but this is poor for decryption + so we need to control this with the following VC++ pragmas +*/ + +#if defined( _MSC_VER ) && !defined( _WIN64 ) +#pragma optimize( ""s"", on ) +#endif + +/* Given the column (c) of the output state variable, the following + macros give the input state variables which are needed in its + computation for each row (r) of the state. All the alternative + macros give the same end values but expand into different ways + of calculating these values. In particular the complex macro + used for dynamically variable block sizes is designed to expand + to a compile time constant whenever possible but will expand to + conditional clauses on some branches (I am grateful to Frank + Yellin for this construction) +*/ + +#define fwd_var(x,r,c)\ + ( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\ + : r == 1 ? ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))\ + : r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\ + : ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))) + +#if defined(FT4_SET) +#undef dec_fmvars +#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,n),fwd_var,rf1,c)) +#elif defined(FT1_SET) +#undef dec_fmvars +#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(f,n),fwd_var,rf1,c)) +#else +#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ fwd_mcol(no_table(x,t_use(s,box),fwd_var,rf1,c))) +#endif + +#if defined(FL4_SET) +#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,l),fwd_var,rf1,c)) +#elif defined(FL1_SET) +#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(f,l),fwd_var,rf1,c)) +#else +#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(s,box),fwd_var,rf1,c)) +#endif + +AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, const aes_encrypt_ctx cx[1]) +{ uint_32t locals(b0, b1); + const uint_32t *kp; +#if defined( dec_fmvars ) + dec_fmvars; /* declare variables for fwd_mcol() if needed */ +#endif + + if( cx->inf.b[0] != 10 * 16 && cx->inf.b[0] != 12 * 16 && cx->inf.b[0] != 14 * 16 ) + return EXIT_FAILURE; + + kp = cx->ks; + state_in(b0, in, kp); + +#if (ENC_UNROLL == FULL) + + switch(cx->inf.b[0]) + { + case 14 * 16: + round(fwd_rnd, b1, b0, kp + 1 * N_COLS); + round(fwd_rnd, b0, b1, kp + 2 * N_COLS); + kp += 2 * N_COLS; + case 12 * 16: + round(fwd_rnd, b1, b0, kp + 1 * N_COLS); + round(fwd_rnd, b0, b1, kp + 2 * N_COLS); + kp += 2 * N_COLS; + case 10 * 16: + round(fwd_rnd, b1, b0, kp + 1 * N_COLS); + round(fwd_rnd, b0, b1, kp + 2 * N_COLS); + round(fwd_rnd, b1, b0, kp + 3 * N_COLS); + round(fwd_rnd, b0, b1, kp + 4 * N_COLS); + round(fwd_rnd, b1, b0, kp + 5 * N_COLS); + round(fwd_rnd, b0, b1, kp + 6 * N_COLS); + round(fwd_rnd, b1, b0, kp + 7 * N_COLS); + round(fwd_rnd, b0, b1, kp + 8 * N_COLS); + round(fwd_rnd, b1, b0, kp + 9 * N_COLS); + round(fwd_lrnd, b0, b1, kp +10 * N_COLS); + } + +#else + +#if (ENC_UNROLL == PARTIAL) + { uint_32t rnd; + for(rnd = 0; rnd < (cx->inf.b[0] >> 5) - 1; ++rnd) + { + kp += N_COLS; + round(fwd_rnd, b1, b0, kp); + kp += N_COLS; + round(fwd_rnd, b0, b1, kp); + } + kp += N_COLS; + round(fwd_rnd, b1, b0, kp); +#else + { uint_32t rnd; + for(rnd = 0; rnd < (cx->inf.b[0] >> 4) - 1; ++rnd) + { + kp += N_COLS; + round(fwd_rnd, b1, b0, kp); + l_copy(b0, b1); + } +#endif + kp += N_COLS; + round(fwd_lrnd, b0, b1, kp); + } +#endif + + state_out(out, b0); + return EXIT_SUCCESS; +} + +#endif + +#if ( FUNCS_IN_C & DECRYPTION_IN_C) + +/* Visual C++ .Net v7.1 provides the fastest encryption code when using + Pentium optimiation with small code but this is poor for decryption + so we need to control this with the following VC++ pragmas +*/ + +#if defined( _MSC_VER ) && !defined( _WIN64 ) +#pragma optimize( ""t"", on ) +#endif + +/* Given the column (c) of the output state variable, the following + macros give the input state variables which are needed in its + computation for each row (r) of the state. All the alternative + macros give the same end values but expand into different ways + of calculating these values. In particular the complex macro + used for dynamically variable block sizes is designed to expand + to a compile time constant whenever possible but will expand to + conditional clauses on some branches (I am grateful to Frank + Yellin for this construction) +*/ + +#define inv_var(x,r,c)\ + ( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\ + : r == 1 ? ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))\ + : r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\ + : ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))) + +#if defined(IT4_SET) +#undef dec_imvars +#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,n),inv_var,rf1,c)) +#elif defined(IT1_SET) +#undef dec_imvars +#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(i,n),inv_var,rf1,c)) +#else +#define inv_rnd(y,x,k,c) (s(y,c) = inv_mcol((k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c))) +#endif + +#if defined(IL4_SET) +#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,l),inv_var,rf1,c)) +#elif defined(IL1_SET) +#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(i,l),inv_var,rf1,c)) +#else +#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c)) +#endif + +/* This code can work with the decryption key schedule in the */ +/* order that is used for encrytpion (where the 1st decryption */ +/* round key is at the high end ot the schedule) or with a key */ +/* schedule that has been reversed to put the 1st decryption */ +/* round key at the low end of the schedule in memory (when */ +/* AES_REV_DKS is defined) */ + +#ifdef AES_REV_DKS +#define key_ofs 0 +#define rnd_key(n) (kp + n * N_COLS) +#else +#define key_ofs 1 +#define rnd_key(n) (kp - n * N_COLS) +#endif + +AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, const aes_decrypt_ctx cx[1]) +{ uint_32t locals(b0, b1); +#if defined( dec_imvars ) + dec_imvars; /* declare variables for inv_mcol() if needed */ +#endif + const uint_32t *kp; + + if( cx->inf.b[0] != 10 * 16 && cx->inf.b[0] != 12 * 16 && cx->inf.b[0] != 14 * 16 ) + return EXIT_FAILURE; + + kp = cx->ks + (key_ofs ? (cx->inf.b[0] >> 2) : 0); + state_in(b0, in, kp); + +#if (DEC_UNROLL == FULL) + + kp = cx->ks + (key_ofs ? 0 : (cx->inf.b[0] >> 2)); + switch(cx->inf.b[0]) + { + case 14 * 16: + round(inv_rnd, b1, b0, rnd_key(-13)); + round(inv_rnd, b0, b1, rnd_key(-12)); + case 12 * 16: + round(inv_rnd, b1, b0, rnd_key(-11)); + round(inv_rnd, b0, b1, rnd_key(-10)); + case 10 * 16: + round(inv_rnd, b1, b0, rnd_key(-9)); + round(inv_rnd, b0, b1, rnd_key(-8)); + round(inv_rnd, b1, b0, rnd_key(-7)); + round(inv_rnd, b0, b1, rnd_key(-6)); + round(inv_rnd, b1, b0, rnd_key(-5)); + round(inv_rnd, b0, b1, rnd_key(-4)); + round(inv_rnd, b1, b0, rnd_key(-3)); + round(inv_rnd, b0, b1, rnd_key(-2)); + round(inv_rnd, b1, b0, rnd_key(-1)); + round(inv_lrnd, b0, b1, rnd_key( 0)); + } + +#else + +#if (DEC_UNROLL == PARTIAL) + { uint_32t rnd; + for(rnd = 0; rnd < (cx->inf.b[0] >> 5) - 1; ++rnd) + { + kp = rnd_key(1); + round(inv_rnd, b1, b0, kp); + kp = rnd_key(1); + round(inv_rnd, b0, b1, kp); + } + kp = rnd_key(1); + round(inv_rnd, b1, b0, kp); +#else + { uint_32t rnd; + for(rnd = 0; rnd < (cx->inf.b[0] >> 4) - 1; ++rnd) + { + kp = rnd_key(1); + round(inv_rnd, b1, b0, kp); + l_copy(b0, b1); + } +#endif + kp = rnd_key(1); + round(inv_lrnd, b0, b1, kp); + } +#endif + + state_out(out, b0); + return EXIT_SUCCESS; +} + +#endif + +#if defined(__cplusplus) +} +#endif +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/entropy.h",".h","193","17"," +#ifndef _ENTROPY_FUN_H +#define _ENTROPY_FUN_H + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +int entropy_fun(unsigned char buf[], unsigned int len); + +#if defined(__cplusplus) +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/brg_types.h",".h","7975","220","/* +--------------------------------------------------------------------------- +Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved. + +The redistribution and use of this software (with or without changes) +is allowed without the payment of fees or royalties provided that: + + source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation. + +This software is provided 'as is' with no explicit or implied warranties +in respect of its operation, including, but not limited to, correctness +and fitness for purpose. +--------------------------------------------------------------------------- +Issue Date: 20/12/2007 + + The unsigned integer types defined here are of the form uint_t where + is the length of the type; for example, the unsigned 32-bit type is + 'uint_32t'. These are NOT the same as the 'C99 integer types' that are + defined in the inttypes.h and stdint.h headers since attempts to use these + types have shown that support for them is still highly variable. However, + since the latter are of the form uint_t, a regular expression search + and replace (in VC++ search on 'uint_{:z}t' and replace with 'uint\1_t') + can be used to convert the types used here to the C99 standard types. +*/ + +#ifndef _BRG_TYPES_H +#define _BRG_TYPES_H + +#if defined(__cplusplus) +extern ""C"" { +#endif + +#include + +#if defined( _MSC_VER ) && ( _MSC_VER >= 1300 ) +# include +# define ptrint_t intptr_t +#elif defined( __ECOS__ ) +# define intptr_t unsigned int +# define ptrint_t intptr_t +#elif defined( __GNUC__ ) && ( __GNUC__ >= 3 ) +# include +# define ptrint_t intptr_t +#else +# define ptrint_t int +#endif + +#ifndef BRG_UI8 +# define BRG_UI8 +# if UCHAR_MAX == 255u + typedef unsigned char uint_8t; +# else +# error Please define uint_8t as an 8-bit unsigned integer type in brg_types.h +# endif +#endif + +#ifndef BRG_UI16 +# define BRG_UI16 +# if USHRT_MAX == 65535u + typedef unsigned short uint_16t; +# else +# error Please define uint_16t as a 16-bit unsigned short type in brg_types.h +# endif +#endif + +#ifndef BRG_UI32 +# define BRG_UI32 +# if UINT_MAX == 4294967295u +# define li_32(h) 0x##h##u + typedef unsigned int uint_32t; +# elif ULONG_MAX == 4294967295u +# define li_32(h) 0x##h##ul + typedef unsigned long uint_32t; +# elif defined( _CRAY ) +# error This code needs 32-bit data types, which Cray machines do not provide +# else +# error Please define uint_32t as a 32-bit unsigned integer type in brg_types.h +# endif +#endif + +#ifndef BRG_UI64 +# if defined( __BORLANDC__ ) && !defined( __MSDOS__ ) +# define BRG_UI64 +# define li_64(h) 0x##h##ui64 + typedef unsigned __int64 uint_64t; +# elif defined( _MSC_VER ) && ( _MSC_VER < 1300 ) /* 1300 == VC++ 7.0 */ +# define BRG_UI64 +# define li_64(h) 0x##h##ui64 + typedef unsigned __int64 uint_64t; +# elif defined( __sun ) && defined( ULONG_MAX ) && ULONG_MAX == 0xfffffffful +# define BRG_UI64 +# define li_64(h) 0x##h##ull + typedef unsigned long long uint_64t; +# elif defined( __MVS__ ) +# define BRG_UI64 +# define li_64(h) 0x##h##ull + typedef unsigned int long long uint_64t; +# elif defined( UINT_MAX ) && UINT_MAX > 4294967295u +# if UINT_MAX == 18446744073709551615u +# define BRG_UI64 +# define li_64(h) 0x##h##u + typedef unsigned int uint_64t; +# endif +# elif defined( ULONG_MAX ) && ULONG_MAX > 4294967295u +# if ULONG_MAX == 18446744073709551615ul +# define BRG_UI64 +# define li_64(h) 0x##h##ul + typedef unsigned long uint_64t; +# endif +# elif defined( ULLONG_MAX ) && ULLONG_MAX > 4294967295u +# if ULLONG_MAX == 18446744073709551615ull +# define BRG_UI64 +# define li_64(h) 0x##h##ull + typedef unsigned long long uint_64t; +# endif +# elif defined( ULONG_LONG_MAX ) && ULONG_LONG_MAX > 4294967295u +# if ULONG_LONG_MAX == 18446744073709551615ull +# define BRG_UI64 +# define li_64(h) 0x##h##ull + typedef unsigned long long uint_64t; +# endif +# endif +#endif + +#if !defined( BRG_UI64 ) +# if defined( NEED_UINT_64T ) +# error Please define uint_64t as an unsigned 64 bit type in brg_types.h +# endif +#endif + +#ifndef RETURN_VALUES +# define RETURN_VALUES +# if defined( DLL_EXPORT ) +# if defined( _MSC_VER ) || defined ( __INTEL_COMPILER ) +# define VOID_RETURN __declspec( dllexport ) void __stdcall +# define INT_RETURN __declspec( dllexport ) int __stdcall +# elif defined( __GNUC__ ) +# define VOID_RETURN __declspec( __dllexport__ ) void +# define INT_RETURN __declspec( __dllexport__ ) int +# else +# error Use of the DLL is only available on the Microsoft, Intel and GCC compilers +# endif +# elif defined( DLL_IMPORT ) +# if defined( _MSC_VER ) || defined ( __INTEL_COMPILER ) +# define VOID_RETURN __declspec( dllimport ) void __stdcall +# define INT_RETURN __declspec( dllimport ) int __stdcall +# elif defined( __GNUC__ ) +# define VOID_RETURN __declspec( __dllimport__ ) void +# define INT_RETURN __declspec( __dllimport__ ) int +# else +# error Use of the DLL is only available on the Microsoft, Intel and GCC compilers +# endif +# elif defined( __WATCOMC__ ) +# define VOID_RETURN void __cdecl +# define INT_RETURN int __cdecl +# else +# define VOID_RETURN void +# define INT_RETURN int +# endif +#endif + +/* These defines are used to detect and set the memory alignment of pointers. + Note that offsets are in bytes. + + ALIGN_OFFSET(x,n) return the positive or zero offset of + the memory addressed by the pointer 'x' + from an address that is aligned on an + 'n' byte boundary ('n' is a power of 2) + + ALIGN_FLOOR(x,n) return a pointer that points to memory + that is aligned on an 'n' byte boundary + and is not higher than the memory address + pointed to by 'x' ('n' is a power of 2) + + ALIGN_CEIL(x,n) return a pointer that points to memory + that is aligned on an 'n' byte boundary + and is not lower than the memory address + pointed to by 'x' ('n' is a power of 2) +*/ + +#define ALIGN_OFFSET(x,n) (((ptrint_t)(x)) & ((n) - 1)) +#define ALIGN_FLOOR(x,n) ((uint_8t*)(x) - ( ((ptrint_t)(x)) & ((n) - 1))) +#define ALIGN_CEIL(x,n) ((uint_8t*)(x) + (-((ptrint_t)(x)) & ((n) - 1))) + +/* These defines are used to declare buffers in a way that allows + faster operations on longer variables to be used. In all these + defines 'size' must be a power of 2 and >= 8. NOTE that the + buffer size is in bytes but the type length is in bits + + UNIT_TYPEDEF(x,size) declares a variable 'x' of length + 'size' bits + + BUFR_TYPEDEF(x,size,bsize) declares a buffer 'x' of length 'bsize' + bytes defined as an array of variables + each of 'size' bits (bsize must be a + multiple of size / 8) + + UNIT_CAST(x,size) casts a variable to a type of + length 'size' bits + + UPTR_CAST(x,size) casts a pointer to a pointer to a + varaiable of length 'size' bits +*/ + +#define UI_TYPE(size) uint_##size##t +#define UNIT_TYPEDEF(x,size) typedef UI_TYPE(size) x +#define BUFR_TYPEDEF(x,size,bsize) typedef UI_TYPE(size) x[bsize / (size >> 3)] +#define UNIT_CAST(x,size) ((UI_TYPE(size) )(x)) +#define UPTR_CAST(x,size) ((UI_TYPE(size)*)(x)) + +#if defined(__cplusplus) +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/aes_via_ace.h",".h","16868","542","/* +Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved. + +The redistribution and use of this software (with or without changes) +is allowed without the payment of fees or royalties provided that: + + source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation. + +This software is provided 'as is' with no explicit or implied warranties +in respect of its operation, including, but not limited to, correctness +and fitness for purpose. +--------------------------------------------------------------------------- +Issue Date: 20/12/2007 +*/ + +#ifndef AES_VIA_ACE_H +#define AES_VIA_ACE_H + +#if defined( _MSC_VER ) +# define INLINE __inline +#elif defined( __GNUC__ ) +# define INLINE static inline +#else +# error VIA ACE requires Microsoft or GNU C +#endif + +#define NEH_GENERATE 1 +#define NEH_LOAD 2 +#define NEH_HYBRID 3 + +#define MAX_READ_ATTEMPTS 1000 + +/* VIA Nehemiah RNG and ACE Feature Mask Values */ + +#define NEH_CPU_IS_VIA 0x00000001 +#define NEH_CPU_READ 0x00000010 +#define NEH_CPU_MASK 0x00000011 + +#define NEH_RNG_PRESENT 0x00000004 +#define NEH_RNG_ENABLED 0x00000008 +#define NEH_ACE_PRESENT 0x00000040 +#define NEH_ACE_ENABLED 0x00000080 +#define NEH_RNG_FLAGS (NEH_RNG_PRESENT | NEH_RNG_ENABLED) +#define NEH_ACE_FLAGS (NEH_ACE_PRESENT | NEH_ACE_ENABLED) +#define NEH_FLAGS_MASK (NEH_RNG_FLAGS | NEH_ACE_FLAGS) + +/* VIA Nehemiah Advanced Cryptography Engine (ACE) Control Word Values */ + +#define NEH_GEN_KEY 0x00000000 /* generate key schedule */ +#define NEH_LOAD_KEY 0x00000080 /* load schedule from memory */ +#define NEH_ENCRYPT 0x00000000 /* encryption */ +#define NEH_DECRYPT 0x00000200 /* decryption */ +#define NEH_KEY128 0x00000000+0x0a /* 128 bit key */ +#define NEH_KEY192 0x00000400+0x0c /* 192 bit key */ +#define NEH_KEY256 0x00000800+0x0e /* 256 bit key */ + +#define NEH_ENC_GEN (NEH_ENCRYPT | NEH_GEN_KEY) +#define NEH_DEC_GEN (NEH_DECRYPT | NEH_GEN_KEY) +#define NEH_ENC_LOAD (NEH_ENCRYPT | NEH_LOAD_KEY) +#define NEH_DEC_LOAD (NEH_DECRYPT | NEH_LOAD_KEY) + +#define NEH_ENC_GEN_DATA {\ + NEH_ENC_GEN | NEH_KEY128, 0, 0, 0,\ + NEH_ENC_GEN | NEH_KEY192, 0, 0, 0,\ + NEH_ENC_GEN | NEH_KEY256, 0, 0, 0 } + +#define NEH_ENC_LOAD_DATA {\ + NEH_ENC_LOAD | NEH_KEY128, 0, 0, 0,\ + NEH_ENC_LOAD | NEH_KEY192, 0, 0, 0,\ + NEH_ENC_LOAD | NEH_KEY256, 0, 0, 0 } + +#define NEH_ENC_HYBRID_DATA {\ + NEH_ENC_GEN | NEH_KEY128, 0, 0, 0,\ + NEH_ENC_LOAD | NEH_KEY192, 0, 0, 0,\ + NEH_ENC_LOAD | NEH_KEY256, 0, 0, 0 } + +#define NEH_DEC_GEN_DATA {\ + NEH_DEC_GEN | NEH_KEY128, 0, 0, 0,\ + NEH_DEC_GEN | NEH_KEY192, 0, 0, 0,\ + NEH_DEC_GEN | NEH_KEY256, 0, 0, 0 } + +#define NEH_DEC_LOAD_DATA {\ + NEH_DEC_LOAD | NEH_KEY128, 0, 0, 0,\ + NEH_DEC_LOAD | NEH_KEY192, 0, 0, 0,\ + NEH_DEC_LOAD | NEH_KEY256, 0, 0, 0 } + +#define NEH_DEC_HYBRID_DATA {\ + NEH_DEC_GEN | NEH_KEY128, 0, 0, 0,\ + NEH_DEC_LOAD | NEH_KEY192, 0, 0, 0,\ + NEH_DEC_LOAD | NEH_KEY256, 0, 0, 0 } + +#define neh_enc_gen_key(x) ((x) == 128 ? (NEH_ENC_GEN | NEH_KEY128) : \ + (x) == 192 ? (NEH_ENC_GEN | NEH_KEY192) : (NEH_ENC_GEN | NEH_KEY256)) + +#define neh_enc_load_key(x) ((x) == 128 ? (NEH_ENC_LOAD | NEH_KEY128) : \ + (x) == 192 ? (NEH_ENC_LOAD | NEH_KEY192) : (NEH_ENC_LOAD | NEH_KEY256)) + +#define neh_enc_hybrid_key(x) ((x) == 128 ? (NEH_ENC_GEN | NEH_KEY128) : \ + (x) == 192 ? (NEH_ENC_LOAD | NEH_KEY192) : (NEH_ENC_LOAD | NEH_KEY256)) + +#define neh_dec_gen_key(x) ((x) == 128 ? (NEH_DEC_GEN | NEH_KEY128) : \ + (x) == 192 ? (NEH_DEC_GEN | NEH_KEY192) : (NEH_DEC_GEN | NEH_KEY256)) + +#define neh_dec_load_key(x) ((x) == 128 ? (NEH_DEC_LOAD | NEH_KEY128) : \ + (x) == 192 ? (NEH_DEC_LOAD | NEH_KEY192) : (NEH_DEC_LOAD | NEH_KEY256)) + +#define neh_dec_hybrid_key(x) ((x) == 128 ? (NEH_DEC_GEN | NEH_KEY128) : \ + (x) == 192 ? (NEH_DEC_LOAD | NEH_KEY192) : (NEH_DEC_LOAD | NEH_KEY256)) + +#if defined( _MSC_VER ) && ( _MSC_VER > 1200 ) +#define aligned_auto(type, name, no, stride) __declspec(align(stride)) type name[no] +#else +#define aligned_auto(type, name, no, stride) \ + unsigned char _##name[no * sizeof(type) + stride]; \ + type *name = (type*)(16 * ((((unsigned long)(_##name)) + stride - 1) / stride)) +#endif + +#if defined( _MSC_VER ) && ( _MSC_VER > 1200 ) +#define aligned_array(type, name, no, stride) __declspec(align(stride)) type name[no] +#elif defined( __GNUC__ ) +#define aligned_array(type, name, no, stride) type name[no] __attribute__ ((aligned(stride))) +#else +#define aligned_array(type, name, no, stride) type name[no] +#endif + +/* VIA ACE codeword */ + +static unsigned char via_flags = 0; + +#if defined ( _MSC_VER ) && ( _MSC_VER > 800 ) + +#define NEH_REKEY __asm pushfd __asm popfd +#define NEH_AES __asm _emit 0xf3 __asm _emit 0x0f __asm _emit 0xa7 +#define NEH_ECB NEH_AES __asm _emit 0xc8 +#define NEH_CBC NEH_AES __asm _emit 0xd0 +#define NEH_CFB NEH_AES __asm _emit 0xe0 +#define NEH_OFB NEH_AES __asm _emit 0xe8 +#define NEH_RNG __asm _emit 0x0f __asm _emit 0xa7 __asm _emit 0xc0 + +INLINE int has_cpuid(void) +{ char ret_value; + __asm + { pushfd /* save EFLAGS register */ + mov eax,[esp] /* copy it to eax */ + mov edx,0x00200000 /* CPUID bit position */ + xor eax,edx /* toggle the CPUID bit */ + push eax /* attempt to set EFLAGS to */ + popfd /* the new value */ + pushfd /* get the new EFLAGS value */ + pop eax /* into eax */ + xor eax,[esp] /* xor with original value */ + and eax,edx /* has CPUID bit changed? */ + setne al /* set to 1 if we have been */ + mov ret_value,al /* able to change it */ + popfd /* restore original EFLAGS */ + } + return (int)ret_value; +} + +INLINE int is_via_cpu(void) +{ char ret_value; + __asm + { push ebx + xor eax,eax /* use CPUID to get vendor */ + cpuid /* identity string */ + xor eax,eax /* is it ""CentaurHauls"" ? */ + sub ebx,0x746e6543 /* 'Cent' */ + or eax,ebx + sub edx,0x48727561 /* 'aurH' */ + or eax,edx + sub ecx,0x736c7561 /* 'auls' */ + or eax,ecx + sete al /* set to 1 if it is VIA ID */ + mov dl,NEH_CPU_READ /* mark CPU type as read */ + or dl,al /* & store result in flags */ + mov [via_flags],dl /* set VIA detected flag */ + mov ret_value,al /* able to change it */ + pop ebx + } + return (int)ret_value; +} + +INLINE int read_via_flags(void) +{ char ret_value = 0; + __asm + { mov eax,0xC0000000 /* Centaur extended CPUID */ + cpuid + mov edx,0xc0000001 /* >= 0xc0000001 if support */ + cmp eax,edx /* for VIA extended feature */ + jnae no_rng /* flags is available */ + mov eax,edx /* read Centaur extended */ + cpuid /* feature flags */ + mov eax,NEH_FLAGS_MASK /* mask out and save */ + and eax,edx /* the RNG and ACE flags */ + or [via_flags],al /* present & enabled flags */ + mov ret_value,al /* able to change it */ +no_rng: + } + return (int)ret_value; +} + +INLINE unsigned int via_rng_in(void *buf) +{ char ret_value = 0x1f; + __asm + { push edi + mov edi,buf /* input buffer address */ + xor edx,edx /* try to fetch 8 bytes */ + NEH_RNG /* do RNG read operation */ + and ret_value,al /* count of bytes returned */ + pop edi + } + return (int)ret_value; +} + +INLINE void via_ecb_op5( + const void *k, const void *c, const void *s, void *d, int l) +{ __asm + { push ebx + NEH_REKEY + mov ebx, (k) + mov edx, (c) + mov esi, (s) + mov edi, (d) + mov ecx, (l) + NEH_ECB + pop ebx + } +} + +INLINE void via_cbc_op6( + const void *k, const void *c, const void *s, void *d, int l, void *v) +{ __asm + { push ebx + NEH_REKEY + mov ebx, (k) + mov edx, (c) + mov esi, (s) + mov edi, (d) + mov ecx, (l) + mov eax, (v) + NEH_CBC + pop ebx + } +} + +INLINE void via_cbc_op7( + const void *k, const void *c, const void *s, void *d, int l, void *v, void *w) +{ __asm + { push ebx + NEH_REKEY + mov ebx, (k) + mov edx, (c) + mov esi, (s) + mov edi, (d) + mov ecx, (l) + mov eax, (v) + NEH_CBC + mov esi, eax + mov edi, (w) + movsd + movsd + movsd + movsd + pop ebx + } +} + +INLINE void via_cfb_op6( + const void *k, const void *c, const void *s, void *d, int l, void *v) +{ __asm + { push ebx + NEH_REKEY + mov ebx, (k) + mov edx, (c) + mov esi, (s) + mov edi, (d) + mov ecx, (l) + mov eax, (v) + NEH_CFB + pop ebx + } +} + +INLINE void via_cfb_op7( + const void *k, const void *c, const void *s, void *d, int l, void *v, void *w) +{ __asm + { push ebx + NEH_REKEY + mov ebx, (k) + mov edx, (c) + mov esi, (s) + mov edi, (d) + mov ecx, (l) + mov eax, (v) + NEH_CFB + mov esi, eax + mov edi, (w) + movsd + movsd + movsd + movsd + pop ebx + } +} + +INLINE void via_ofb_op6( + const void *k, const void *c, const void *s, void *d, int l, void *v) +{ __asm + { push ebx + NEH_REKEY + mov ebx, (k) + mov edx, (c) + mov esi, (s) + mov edi, (d) + mov ecx, (l) + mov eax, (v) + NEH_OFB + pop ebx + } +} + +#elif defined( __GNUC__ ) + +#define NEH_REKEY asm(""pushfl\n popfl\n\t"") +#define NEH_ECB asm("".byte 0xf3, 0x0f, 0xa7, 0xc8\n\t"") +#define NEH_CBC asm("".byte 0xf3, 0x0f, 0xa7, 0xd0\n\t"") +#define NEH_CFB asm("".byte 0xf3, 0x0f, 0xa7, 0xe0\n\t"") +#define NEH_OFB asm("".byte 0xf3, 0x0f, 0xa7, 0xe8\n\t"") +#define NEH_RNG asm("".byte 0x0f, 0xa7, 0xc0\n\t""); + +INLINE int has_cpuid(void) +{ int val; + asm(""pushfl\n\t""); + asm(""movl 0(%esp),%eax\n\t""); + asm(""xor $0x00200000,%eax\n\t""); + asm(""pushl %eax\n\t""); + asm(""popfl\n\t""); + asm(""pushfl\n\t""); + asm(""popl %eax\n\t""); + asm(""xorl 0(%esp),%edx\n\t""); + asm(""andl $0x00200000,%eax\n\t""); + asm(""movl %%eax,%0\n\t"" : ""=m"" (val)); + asm(""popfl\n\t""); + return val ? 1 : 0; +} + +INLINE int is_via_cpu(void) +{ int val; + asm(""pushl %ebx\n\t""); + asm(""xorl %eax,%eax\n\t""); + asm(""cpuid\n\t""); + asm(""xorl %eax,%eax\n\t""); + asm(""subl $0x746e6543,%ebx\n\t""); + asm(""orl %ebx,%eax\n\t""); + asm(""subl $0x48727561,%edx\n\t""); + asm(""orl %edx,%eax\n\t""); + asm(""subl $0x736c7561,%ecx\n\t""); + asm(""orl %ecx,%eax\n\t""); + asm(""movl %%eax,%0\n\t"" : ""=m"" (val)); + asm(""popl %ebx\n\t""); + val = (val ? 0 : 1); + via_flags = (val | NEH_CPU_READ); + return val; +} + +INLINE int read_via_flags(void) +{ unsigned char val; + asm(""movl $0xc0000000,%eax\n\t""); + asm(""cpuid\n\t""); + asm(""movl $0xc0000001,%edx\n\t""); + asm(""cmpl %edx,%eax\n\t""); + asm(""setae %al\n\t""); + asm(""movb %%al,%0\n\t"" : ""=m"" (val)); + if(!val) return 0; + asm(""movl $0xc0000001,%eax\n\t""); + asm(""cpuid\n\t""); + asm(""movb %%dl,%0\n\t"" : ""=m"" (val)); + val &= NEH_FLAGS_MASK; + via_flags |= val; + return (int) val; +} + +INLINE int via_rng_in(void *buf) +{ int val; + asm(""pushl %edi\n\t""); + asm(""movl %0,%%edi\n\t"" : : ""m"" (buf)); + asm(""xorl %edx,%edx\n\t""); + NEH_RNG + asm(""andl $0x0000001f,%eax\n\t""); + asm(""movl %%eax,%0\n\t"" : ""=m"" (val)); + asm(""popl %edi\n\t""); + return val; +} + +INLINE volatile void via_ecb_op5( + const void *k, const void *c, const void *s, void *d, int l) +{ + asm(""pushl %ebx\n\t""); + NEH_REKEY; + asm(""movl %0, %%ebx\n\t"" : : ""m"" (k)); + asm(""movl %0, %%edx\n\t"" : : ""m"" (c)); + asm(""movl %0, %%esi\n\t"" : : ""m"" (s)); + asm(""movl %0, %%edi\n\t"" : : ""m"" (d)); + asm(""movl %0, %%ecx\n\t"" : : ""m"" (l)); + NEH_ECB; + asm(""popl %ebx\n\t""); +} + +INLINE volatile void via_cbc_op6( + const void *k, const void *c, const void *s, void *d, int l, void *v) +{ + asm(""pushl %ebx\n\t""); + NEH_REKEY; + asm(""movl %0, %%ebx\n\t"" : : ""m"" (k)); + asm(""movl %0, %%edx\n\t"" : : ""m"" (c)); + asm(""movl %0, %%esi\n\t"" : : ""m"" (s)); + asm(""movl %0, %%edi\n\t"" : : ""m"" (d)); + asm(""movl %0, %%ecx\n\t"" : : ""m"" (l)); + asm(""movl %0, %%eax\n\t"" : : ""m"" (v)); + NEH_CBC; + asm(""popl %ebx\n\t""); +} + +INLINE volatile void via_cbc_op7( + const void *k, const void *c, const void *s, void *d, int l, void *v, void *w) +{ + asm(""pushl %ebx\n\t""); + NEH_REKEY; + asm(""movl %0, %%ebx\n\t"" : : ""m"" (k)); + asm(""movl %0, %%edx\n\t"" : : ""m"" (c)); + asm(""movl %0, %%esi\n\t"" : : ""m"" (s)); + asm(""movl %0, %%edi\n\t"" : : ""m"" (d)); + asm(""movl %0, %%ecx\n\t"" : : ""m"" (l)); + asm(""movl %0, %%eax\n\t"" : : ""m"" (v)); + NEH_CBC; + asm(""movl %eax,%esi\n\t""); + asm(""movl %0, %%edi\n\t"" : : ""m"" (w)); + asm(""movsl; movsl; movsl; movsl\n\t""); + asm(""popl %ebx\n\t""); +} + +INLINE volatile void via_cfb_op6( + const void *k, const void *c, const void *s, void *d, int l, void *v) +{ + asm(""pushl %ebx\n\t""); + NEH_REKEY; + asm(""movl %0, %%ebx\n\t"" : : ""m"" (k)); + asm(""movl %0, %%edx\n\t"" : : ""m"" (c)); + asm(""movl %0, %%esi\n\t"" : : ""m"" (s)); + asm(""movl %0, %%edi\n\t"" : : ""m"" (d)); + asm(""movl %0, %%ecx\n\t"" : : ""m"" (l)); + asm(""movl %0, %%eax\n\t"" : : ""m"" (v)); + NEH_CFB; + asm(""popl %ebx\n\t""); +} + +INLINE volatile void via_cfb_op7( + const void *k, const void *c, const void *s, void *d, int l, void *v, void *w) +{ + asm(""pushl %ebx\n\t""); + NEH_REKEY; + asm(""movl %0, %%ebx\n\t"" : : ""m"" (k)); + asm(""movl %0, %%edx\n\t"" : : ""m"" (c)); + asm(""movl %0, %%esi\n\t"" : : ""m"" (s)); + asm(""movl %0, %%edi\n\t"" : : ""m"" (d)); + asm(""movl %0, %%ecx\n\t"" : : ""m"" (l)); + asm(""movl %0, %%eax\n\t"" : : ""m"" (v)); + NEH_CFB; + asm(""movl %eax,%esi\n\t""); + asm(""movl %0, %%edi\n\t"" : : ""m"" (w)); + asm(""movsl; movsl; movsl; movsl\n\t""); + asm(""popl %ebx\n\t""); +} + +INLINE volatile void via_ofb_op6( + const void *k, const void *c, const void *s, void *d, int l, void *v) +{ + asm(""pushl %ebx\n\t""); + NEH_REKEY; + asm(""movl %0, %%ebx\n\t"" : : ""m"" (k)); + asm(""movl %0, %%edx\n\t"" : : ""m"" (c)); + asm(""movl %0, %%esi\n\t"" : : ""m"" (s)); + asm(""movl %0, %%edi\n\t"" : : ""m"" (d)); + asm(""movl %0, %%ecx\n\t"" : : ""m"" (l)); + asm(""movl %0, %%eax\n\t"" : : ""m"" (v)); + NEH_OFB; + asm(""popl %ebx\n\t""); +} + +#else +#error VIA ACE is not available with this compiler +#endif + +INLINE int via_ace_test(void) +{ + return has_cpuid() && is_via_cpu() && ((read_via_flags() & NEH_ACE_FLAGS) == NEH_ACE_FLAGS); +} + +#define VIA_ACE_AVAILABLE (((via_flags & NEH_ACE_FLAGS) == NEH_ACE_FLAGS) \ + || (via_flags & NEH_CPU_READ) && (via_flags & NEH_CPU_IS_VIA) || via_ace_test()) + +INLINE int via_rng_test(void) +{ + return has_cpuid() && is_via_cpu() && ((read_via_flags() & NEH_RNG_FLAGS) == NEH_RNG_FLAGS); +} + +#define VIA_RNG_AVAILABLE (((via_flags & NEH_RNG_FLAGS) == NEH_RNG_FLAGS) \ + || (via_flags & NEH_CPU_READ) && (via_flags & NEH_CPU_IS_VIA) || via_rng_test()) + +INLINE int read_via_rng(void *buf, int count) +{ int nbr, max_reads, lcnt = count; + unsigned char *p, *q; + aligned_auto(unsigned char, bp, 64, 16); + + if(!VIA_RNG_AVAILABLE) + return 0; + + do + { + max_reads = MAX_READ_ATTEMPTS; + do + nbr = via_rng_in(bp); + while + (nbr == 0 && --max_reads); + + lcnt -= nbr; + p = (unsigned char*)buf; q = bp; + while(nbr--) + *p++ = *q++; + } + while + (lcnt && max_reads); + + return count - lcnt; +} + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/fileenc.h",".h","4236","122","/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK. + All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 24/01/2003 + + This file contains the header file for fileenc.c, which implements password + based file encryption and authentication using AES in CTR mode, HMAC-SHA1 + authentication and RFC2898 password based key derivation. +*/ + +#ifndef _FENC_H +#define _FENC_H + +#include ""aes.h"" +#include ""hmac.h"" +#include ""pwd2key.h"" + +#define PASSWORD_VERIFIER + +#define MAX_KEY_LENGTH 32 +#define MAX_PWD_LENGTH 128 +#define MAX_SALT_LENGTH 16 +#define KEYING_ITERATIONS 1000 + +#ifdef PASSWORD_VERIFIER +#define PWD_VER_LENGTH 2 +#else +#define PWD_VER_LENGTH 0 +#endif + +#define GOOD_RETURN 0 +#define PASSWORD_TOO_LONG -100 +#define BAD_MODE -101 + +/* + Field lengths (in bytes) versus File Encryption Mode (0 < mode < 4) + + Mode Key Salt MAC Overhead + 1 16 8 10 18 + 2 24 12 10 22 + 3 32 16 10 26 + + The following macros assume that the mode value is correct. +*/ + +#define KEY_LENGTH(mode) (8 * (mode & 3) + 8) +#define SALT_LENGTH(mode) (4 * (mode & 3) + 4) +#define MAC_LENGTH(mode) (10) + +/* the context for file encryption */ + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +typedef struct +{ unsigned char nonce[AES_BLOCK_SIZE]; /* the CTR nonce */ + unsigned char encr_bfr[AES_BLOCK_SIZE]; /* encrypt buffer */ + aes_encrypt_ctx encr_ctx[1]; /* encryption context */ + hmac_ctx auth_ctx[1]; /* authentication context */ + unsigned int encr_pos; /* block position (enc) */ + unsigned int pwd_len; /* password length */ + unsigned int mode; /* File encryption mode */ +} fcrypt_ctx; + +/* initialise file encryption or decryption */ + +int fcrypt_init( + int mode, /* the mode to be used (input) */ + const unsigned char pwd[], /* the user specified password (input) */ + unsigned int pwd_len, /* the length of the password (input) */ + const unsigned char salt[], /* the salt (input) */ +#ifdef PASSWORD_VERIFIER + unsigned char pwd_ver[PWD_VER_LENGTH], /* 2 byte password verifier (output) */ +#endif + fcrypt_ctx cx[1]); /* the file encryption context (output) */ + +/* perform 'in place' encryption or decryption and authentication */ + +void fcrypt_encrypt(unsigned char data[], unsigned int data_len, fcrypt_ctx cx[1]); +void fcrypt_decrypt(unsigned char data[], unsigned int data_len, fcrypt_ctx cx[1]); + +/* close encryption/decryption and return the MAC value */ +/* the return value is the length of the MAC */ + +int fcrypt_end(unsigned char mac[], /* the MAC value (output) */ + fcrypt_ctx cx[1]); /* the context (input) */ + +#if defined(__cplusplus) +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/pwd2key.h",".h","1996","58","/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 26/08/2003 + + This is an implementation of RFC2898, which specifies key derivation from + a password and a salt value. +*/ + +#ifndef PWD2KEY_H +#define PWD2KEY_H + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +void derive_key( + const unsigned char pwd[], /* the PASSWORD, and */ + unsigned int pwd_len, /* its length */ + const unsigned char salt[], /* the SALT and its */ + unsigned int salt_len, /* length */ + unsigned int iter, /* the number of iterations */ + unsigned char key[], /* space for the output key */ + unsigned int key_len); /* and its required length */ + +#if defined(__cplusplus) +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/aestab.h",".h","5159","174","/* +--------------------------------------------------------------------------- +Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved. + +The redistribution and use of this software (with or without changes) +is allowed without the payment of fees or royalties provided that: + + source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation. + +This software is provided 'as is' with no explicit or implied warranties +in respect of its operation, including, but not limited to, correctness +and fitness for purpose. +--------------------------------------------------------------------------- +Issue Date: 20/12/2007 + + This file contains the code for declaring the tables needed to implement + AES. The file aesopt.h is assumed to be included before this header file. + If there are no global variables, the definitions here can be used to put + the AES tables in a structure so that a pointer can then be added to the + AES context to pass them to the AES routines that need them. If this + facility is used, the calling program has to ensure that this pointer is + managed appropriately. In particular, the value of the t_dec(in,it) item + in the table structure must be set to zero in order to ensure that the + tables are initialised. In practice the three code sequences in aeskey.c + that control the calls to aes_init() and the aes_init() routine itself will + have to be changed for a specific implementation. If global variables are + available it will generally be preferable to use them with the precomputed + FIXED_TABLES option that uses static global tables. + + The following defines can be used to control the way the tables + are defined, initialised and used in embedded environments that + require special features for these purposes + + the 't_dec' construction is used to declare fixed table arrays + the 't_set' construction is used to set fixed table values + the 't_use' construction is used to access fixed table values + + 256 byte tables: + + t_xxx(s,box) => forward S box + t_xxx(i,box) => inverse S box + + 256 32-bit word OR 4 x 256 32-bit word tables: + + t_xxx(f,n) => forward normal round + t_xxx(f,l) => forward last round + t_xxx(i,n) => inverse normal round + t_xxx(i,l) => inverse last round + t_xxx(l,s) => key schedule table + t_xxx(i,m) => key schedule table + + Other variables and tables: + + t_xxx(r,c) => the rcon table +*/ + +#if !defined( _AESTAB_H ) +#define _AESTAB_H + +#if defined(__cplusplus) +extern ""C"" { +#endif + +#define t_dec(m,n) t_##m##n +#define t_set(m,n) t_##m##n +#define t_use(m,n) t_##m##n + +#if defined(FIXED_TABLES) +# if !defined( __GNUC__ ) && (defined( __MSDOS__ ) || defined( __WIN16__ )) +/* make tables far data to avoid using too much DGROUP space (PG) */ +# define CONST const far +# else +# define CONST const +# endif +#else +# define CONST +#endif + +#if defined(DO_TABLES) +# define EXTERN +#else +# define EXTERN extern +#endif + +#if defined(_MSC_VER) && defined(TABLE_ALIGN) +#define ALIGN __declspec(align(TABLE_ALIGN)) +#else +#define ALIGN +#endif + +#if defined( __WATCOMC__ ) && ( __WATCOMC__ >= 1100 ) +# define XP_DIR __cdecl +#else +# define XP_DIR +#endif + +#if defined(DO_TABLES) && defined(FIXED_TABLES) +#define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256] = b(e) +#define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256] = { b(e), b(f), b(g), b(h) } +EXTERN ALIGN CONST uint_32t t_dec(r,c)[RC_LENGTH] = rc_data(w0); +#else +#define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256] +#define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256] +EXTERN ALIGN CONST uint_32t t_dec(r,c)[RC_LENGTH]; +#endif + +#if defined( SBX_SET ) + d_1(uint_8t, t_dec(s,box), sb_data, h0); +#endif +#if defined( ISB_SET ) + d_1(uint_8t, t_dec(i,box), isb_data, h0); +#endif + +#if defined( FT1_SET ) + d_1(uint_32t, t_dec(f,n), sb_data, u0); +#endif +#if defined( FT4_SET ) + d_4(uint_32t, t_dec(f,n), sb_data, u0, u1, u2, u3); +#endif + +#if defined( FL1_SET ) + d_1(uint_32t, t_dec(f,l), sb_data, w0); +#endif +#if defined( FL4_SET ) + d_4(uint_32t, t_dec(f,l), sb_data, w0, w1, w2, w3); +#endif + +#if defined( IT1_SET ) + d_1(uint_32t, t_dec(i,n), isb_data, v0); +#endif +#if defined( IT4_SET ) + d_4(uint_32t, t_dec(i,n), isb_data, v0, v1, v2, v3); +#endif + +#if defined( IL1_SET ) + d_1(uint_32t, t_dec(i,l), isb_data, w0); +#endif +#if defined( IL4_SET ) + d_4(uint_32t, t_dec(i,l), isb_data, w0, w1, w2, w3); +#endif + +#if defined( LS1_SET ) +#if defined( FL1_SET ) +#undef LS1_SET +#else + d_1(uint_32t, t_dec(l,s), sb_data, w0); +#endif +#endif + +#if defined( LS4_SET ) +#if defined( FL4_SET ) +#undef LS4_SET +#else + d_4(uint_32t, t_dec(l,s), sb_data, w0, w1, w2, w3); +#endif +#endif + +#if defined( IM1_SET ) + d_1(uint_32t, t_dec(i,m), mm_data, v0); +#endif +#if defined( IM4_SET ) + d_4(uint_32t, t_dec(i,m), mm_data, v0, v1, v2, v3); +#endif + +#if defined(__cplusplus) +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/prng.h",".h","3016","83","/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK. + All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 24/01/2003 + + This is the header file for an implementation of a random data pool based on + the use of an external entropy function (inspired by Peter Gutmann's work). +*/ + +#ifndef _PRNG_H +#define _PRNG_H + +#include ""sha1.h"" + +#define PRNG_POOL_LEN 256 /* minimum random pool size */ +#define PRNG_MIN_MIX 20 /* min initial pool mixing iterations */ + +/* ensure that pool length is a multiple of the SHA1 digest size */ + +#define PRNG_POOL_SIZE (SHA1_DIGEST_SIZE * (1 + (PRNG_POOL_LEN - 1) / SHA1_DIGEST_SIZE)) + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +/* A function for providing entropy is a parameter in the prng_init() */ +/* call. This function has the following form and returns a maximum */ +/* of 'len' bytes of pseudo random data in the buffer 'buf'. It can */ +/* return less than 'len' bytes but will be repeatedly called for more */ +/* data in this case. */ + +typedef int (*prng_entropy_fn)(unsigned char buf[], unsigned int len); + +typedef struct +{ unsigned char rbuf[PRNG_POOL_SIZE]; /* the random pool */ + unsigned char obuf[PRNG_POOL_SIZE]; /* pool output buffer */ + unsigned int pos; /* output buffer position */ + prng_entropy_fn entropy; /* entropy function pointer */ +} prng_ctx; + +/* initialise the random stream generator */ +void prng_init(prng_entropy_fn fun, prng_ctx ctx[1]); + +/* obtain random bytes from the generator */ +void prng_rand(unsigned char data[], unsigned int data_len, prng_ctx ctx[1]); + +/* close the random stream generator */ +void prng_end(prng_ctx ctx[1]); + +#if defined(__cplusplus) +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/prng.c",".c","5185","156","/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK. + All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 24/01/2003 + + This file implements a random data pool based on the use of an external + entropy function. It is based on the ideas advocated by Peter Gutmann in + his work on pseudo random sequence generators. It is not a 'paranoid' + random sequence generator and no attempt is made to protect the pool + from prying eyes either by memory locking or by techniques to obscure + its location in memory. +*/ + +#include +#include ""prng.h"" + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +/* mix a random data pool using the SHA1 compression function (as */ +/* suggested by Peter Gutmann in his paper on random pools) */ + +static void prng_mix(unsigned char buf[]) +{ unsigned int i, len; + sha1_ctx ctx[1]; + + /*lint -e{663} unusual array to pointer conversion */ + for(i = 0; i < PRNG_POOL_SIZE; i += SHA1_DIGEST_SIZE) + { + /* copy digest size pool block into SHA1 hash block */ + memcpy(ctx->hash, buf + (i ? i : PRNG_POOL_SIZE) + - SHA1_DIGEST_SIZE, SHA1_DIGEST_SIZE); + + /* copy data from pool into the SHA1 data buffer */ + len = PRNG_POOL_SIZE - i; + memcpy(ctx->wbuf, buf + i, (len > SHA1_BLOCK_SIZE ? SHA1_BLOCK_SIZE : len)); + + if(len < SHA1_BLOCK_SIZE) + memcpy(((char*)ctx->wbuf) + len, buf, SHA1_BLOCK_SIZE - len); + + /* compress using the SHA1 compression function */ + sha1_compile(ctx); + + /* put digest size block back into the random pool */ + memcpy(buf + i, ctx->hash, SHA1_DIGEST_SIZE); + } +} + +/* refresh the output buffer and update the random pool by adding */ +/* entropy and remixing */ + +static void update_pool(prng_ctx ctx[1]) +{ unsigned int i = 0; + + /* transfer random pool data to the output buffer */ + memcpy(ctx->obuf, ctx->rbuf, PRNG_POOL_SIZE); + + /* enter entropy data into the pool */ + while(i < PRNG_POOL_SIZE) + i += ctx->entropy(ctx->rbuf + i, PRNG_POOL_SIZE - i); + + /* invert and xor the original pool data into the pool */ + for(i = 0; i < PRNG_POOL_SIZE; ++i) + ctx->rbuf[i] ^= ~ctx->obuf[i]; + + /* mix the pool and the output buffer */ + prng_mix(ctx->rbuf); + prng_mix(ctx->obuf); +} + +void prng_init(prng_entropy_fn fun, prng_ctx ctx[1]) +{ int i; + + /* clear the buffers and the counter in the context */ + memset(ctx, 0, sizeof(prng_ctx)); + + /* set the pointer to the entropy collection function */ + ctx->entropy = fun; + + /* initialise the random data pool */ + update_pool(ctx); + + /* mix the pool a minimum number of times */ + for(i = 0; i < PRNG_MIN_MIX; ++i) + prng_mix(ctx->rbuf); + + /* update the pool to prime the pool output buffer */ + update_pool(ctx); +} + +/* provide random bytes from the random data pool */ + +void prng_rand(unsigned char data[], unsigned int data_len, prng_ctx ctx[1]) +{ unsigned char *rp = data; + unsigned int len, pos = ctx->pos; + + while(data_len) + { + /* transfer 'data_len' bytes (or the number of bytes remaining */ + /* the pool output buffer if less) into the output */ + len = (data_len < PRNG_POOL_SIZE - pos ? data_len : PRNG_POOL_SIZE - pos); + memcpy(rp, ctx->obuf + pos, len); + rp += len; /* update ouput buffer position pointer */ + pos += len; /* update pool output buffer pointer */ + data_len -= len; /* update the remaining data count */ + + /* refresh the random pool if necessary */ + if(pos == PRNG_POOL_SIZE) + { + update_pool(ctx); pos = 0; + } + } + + ctx->pos = pos; +} + +void prng_end(prng_ctx ctx[1]) +{ + /* ensure the data in the context is destroyed */ + memset(ctx, 0, sizeof(prng_ctx)); +} + +#if defined(__cplusplus) +} +#endif + +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/pwd2key.c",".c","6018","194","/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 26/08/2003 + + This is an implementation of RFC2898, which specifies key derivation from + a password and a salt value. +*/ + +#include +#include ""hmac.h"" + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +void derive_key(const unsigned char pwd[], /* the PASSWORD */ + unsigned int pwd_len, /* and its length */ + const unsigned char salt[], /* the SALT and its */ + unsigned int salt_len, /* length */ + unsigned int iter, /* the number of iterations */ + unsigned char key[], /* space for the output key */ + unsigned int key_len)/* and its required length */ +{ + unsigned int i, j, k, n_blk; + unsigned char uu[HASH_OUTPUT_SIZE], ux[HASH_OUTPUT_SIZE]; + hmac_ctx c1[1], c2[1], c3[1]; + + /* set HMAC context (c1) for password */ + hmac_sha_begin(c1); + hmac_sha_key(pwd, pwd_len, c1); + + /* set HMAC context (c2) for password and salt */ + memcpy(c2, c1, sizeof(hmac_ctx)); + hmac_sha_data(salt, salt_len, c2); + + /* find the number of SHA blocks in the key */ + n_blk = 1 + (key_len - 1) / HASH_OUTPUT_SIZE; + + for(i = 0; i < n_blk; ++i) /* for each block in key */ + { + /* ux[] holds the running xor value */ + memset(ux, 0, HASH_OUTPUT_SIZE); + + /* set HMAC context (c3) for password and salt */ + memcpy(c3, c2, sizeof(hmac_ctx)); + + /* enter additional data for 1st block into uu */ + uu[0] = (unsigned char)((i + 1) >> 24); + uu[1] = (unsigned char)((i + 1) >> 16); + uu[2] = (unsigned char)((i + 1) >> 8); + uu[3] = (unsigned char)(i + 1); + + /* this is the key mixing iteration */ + for(j = 0, k = 4; j < iter; ++j) + { + /* add previous round data to HMAC */ + hmac_sha_data(uu, k, c3); + + /* obtain HMAC for uu[] */ + hmac_sha_end(uu, HASH_OUTPUT_SIZE, c3); + + /* xor into the running xor block */ + for(k = 0; k < HASH_OUTPUT_SIZE; ++k) + ux[k] ^= uu[k]; + + /* set HMAC context (c3) for password */ + memcpy(c3, c1, sizeof(hmac_ctx)); + } + + /* compile key blocks into the key output */ + j = 0; k = i * HASH_OUTPUT_SIZE; + while(j < HASH_OUTPUT_SIZE && k < key_len) + key[k++] = ux[j++]; + } +} + +#ifdef TEST + +#include + +struct +{ unsigned int pwd_len; + unsigned int salt_len; + unsigned int it_count; + unsigned char *pwd; + unsigned char salt[32]; + unsigned char key[32]; +} tests[] = +{ + { 8, 4, 5, (unsigned char*)""password"", + { + 0x12, 0x34, 0x56, 0x78 + }, + { + 0x5c, 0x75, 0xce, 0xf0, 0x1a, 0x96, 0x0d, 0xf7, + 0x4c, 0xb6, 0xb4, 0x9b, 0x9e, 0x38, 0xe6, 0xb5 + } + }, + { 8, 8, 5, (unsigned char*)""password"", + { + 0x12, 0x34, 0x56, 0x78, 0x78, 0x56, 0x34, 0x12 + }, + { + 0xd1, 0xda, 0xa7, 0x86, 0x15, 0xf2, 0x87, 0xe6, + 0xa1, 0xc8, 0xb1, 0x20, 0xd7, 0x06, 0x2a, 0x49 + } + }, + { 8, 21, 1, (unsigned char*)""password"", + { + ""ATHENA.MIT.EDUraeburn"" + }, + { + 0xcd, 0xed, 0xb5, 0x28, 0x1b, 0xb2, 0xf8, 0x01, + 0x56, 0x5a, 0x11, 0x22, 0xb2, 0x56, 0x35, 0x15 + } + }, + { 8, 21, 2, (unsigned char*)""password"", + { + ""ATHENA.MIT.EDUraeburn"" + }, + { + 0x01, 0xdb, 0xee, 0x7f, 0x4a, 0x9e, 0x24, 0x3e, + 0x98, 0x8b, 0x62, 0xc7, 0x3c, 0xda, 0x93, 0x5d + } + }, + { 8, 21, 1200, (unsigned char*)""password"", + { + ""ATHENA.MIT.EDUraeburn"" + }, + { + 0x5c, 0x08, 0xeb, 0x61, 0xfd, 0xf7, 0x1e, 0x4e, + 0x4e, 0xc3, 0xcf, 0x6b, 0xa1, 0xf5, 0x51, 0x2b + } + } +}; + +int main() +{ unsigned int i, j, key_len = 256; + unsigned char key[256]; + + printf(""\nTest of RFC2898 Password Based Key Derivation""); + for(i = 0; i < 5; ++i) + { + derive_key(tests[i].pwd, tests[i].pwd_len, tests[i].salt, + tests[i].salt_len, tests[i].it_count, key, key_len); + + printf(""\ntest %i: "", i + 1); + printf(""key %s"", memcmp(tests[i].key, key, 16) ? ""is bad"" : ""is good""); + for(j = 0; j < key_len && j < 64; j += 4) + { + if(j % 16 == 0) + printf(""\n""); + printf(""0x%02x%02x%02x%02x "", key[j], key[j + 1], key[j + 2], key[j + 3]); + } + printf(j < key_len ? "" ... \n"" : ""\n""); + } + printf(""\n""); + return 0; +} + +#if defined(__cplusplus) +} +#endif + +#endif +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/aes.h",".h","7069","199","/* +--------------------------------------------------------------------------- +Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved. + +The redistribution and use of this software (with or without changes) +is allowed without the payment of fees or royalties provided that: + + source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation. + +This software is provided 'as is' with no explicit or implied warranties +in respect of its operation, including, but not limited to, correctness +and fitness for purpose. +--------------------------------------------------------------------------- +Issue Date: 20/12/2007 + + This file contains the definitions required to use AES in C. See aesopt.h + for optimisation details. +*/ + +#ifndef _AES_H +#define _AES_H + +#include + +/* This include is used to find 8 & 32 bit unsigned integer types */ +#include ""brg_types.h"" + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +#define AES_128 /* if a fast 128 bit key scheduler is needed */ +#define AES_192 /* if a fast 192 bit key scheduler is needed */ +#define AES_256 /* if a fast 256 bit key scheduler is needed */ +#define AES_VAR /* if variable key size scheduler is needed */ +#define AES_MODES /* if support is needed for modes */ + +/* The following must also be set in assembler files if being used */ + +#define AES_ENCRYPT /* if support for encryption is needed */ +#define AES_DECRYPT /* if support for decryption is needed */ +#define AES_REV_DKS /* define to reverse decryption key schedule */ + +#define AES_BLOCK_SIZE 16 /* the AES block size in bytes */ +#define N_COLS 4 /* the number of columns in the state */ + +/* The key schedule length is 11, 13 or 15 16-byte blocks for 128, */ +/* 192 or 256-bit keys respectively. That is 176, 208 or 240 bytes */ +/* or 44, 52 or 60 32-bit words. */ + +#if defined( AES_VAR ) || defined( AES_256 ) +#define KS_LENGTH 60 +#elif defined( AES_192 ) +#define KS_LENGTH 52 +#else +#define KS_LENGTH 44 +#endif + +#define AES_RETURN INT_RETURN + +/* the character array 'inf' in the following structures is used */ +/* to hold AES context information. This AES code uses cx->inf.b[0] */ +/* to hold the number of rounds multiplied by 16. The other three */ +/* elements can be used by code that implements additional modes */ + +typedef union +{ uint_32t l; + uint_8t b[4]; +} aes_inf; + +typedef struct +{ uint_32t ks[KS_LENGTH]; + aes_inf inf; +} aes_encrypt_ctx; + +typedef struct +{ uint_32t ks[KS_LENGTH]; + aes_inf inf; +} aes_decrypt_ctx; + +/* This routine must be called before first use if non-static */ +/* tables are being used */ + +AES_RETURN aes_init(void); + +/* Key lengths in the range 16 <= key_len <= 32 are given in bytes, */ +/* those in the range 128 <= key_len <= 256 are given in bits */ + +#if defined( AES_ENCRYPT ) + +#if defined( AES_128 ) || defined( AES_VAR) +AES_RETURN aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]); +#endif + +#if defined( AES_192 ) || defined( AES_VAR) +AES_RETURN aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]); +#endif + +#if defined( AES_256 ) || defined( AES_VAR) +AES_RETURN aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]); +#endif + +#if defined( AES_VAR ) +AES_RETURN aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]); +#endif + +AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, const aes_encrypt_ctx cx[1]); + +#endif + +#if defined( AES_DECRYPT ) + +#if defined( AES_128 ) || defined( AES_VAR) +AES_RETURN aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]); +#endif + +#if defined( AES_192 ) || defined( AES_VAR) +AES_RETURN aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]); +#endif + +#if defined( AES_256 ) || defined( AES_VAR) +AES_RETURN aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]); +#endif + +#if defined( AES_VAR ) +AES_RETURN aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]); +#endif + +AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, const aes_decrypt_ctx cx[1]); + +#endif + +#if defined( AES_MODES ) + +/* Multiple calls to the following subroutines for multiple block */ +/* ECB, CBC, CFB, OFB and CTR mode encryption can be used to handle */ +/* long messages incremantally provided that the context AND the iv */ +/* are preserved between all such calls. For the ECB and CBC modes */ +/* each individual call within a series of incremental calls must */ +/* process only full blocks (i.e. len must be a multiple of 16) but */ +/* the CFB, OFB and CTR mode calls can handle multiple incremental */ +/* calls of any length. Each mode is reset when a new AES key is */ +/* set but ECB and CBC operations can be reset without setting a */ +/* new key by setting a new IV value. To reset CFB, OFB and CTR */ +/* without setting the key, aes_mode_reset() must be called and the */ +/* IV must be set. NOTE: All these calls update the IV on exit so */ +/* this has to be reset if a new operation with the same IV as the */ +/* previous one is required (or decryption follows encryption with */ +/* the same IV array). */ + +AES_RETURN aes_test_alignment_detection(unsigned int n); + +AES_RETURN aes_ecb_encrypt(const unsigned char *ibuf, unsigned char *obuf, + int len, const aes_encrypt_ctx cx[1]); + +AES_RETURN aes_ecb_decrypt(const unsigned char *ibuf, unsigned char *obuf, + int len, const aes_decrypt_ctx cx[1]); + +AES_RETURN aes_cbc_encrypt(const unsigned char *ibuf, unsigned char *obuf, + int len, unsigned char *iv, const aes_encrypt_ctx cx[1]); + +AES_RETURN aes_cbc_decrypt(const unsigned char *ibuf, unsigned char *obuf, + int len, unsigned char *iv, const aes_decrypt_ctx cx[1]); + +AES_RETURN aes_mode_reset(aes_encrypt_ctx cx[1]); + +AES_RETURN aes_cfb_encrypt(const unsigned char *ibuf, unsigned char *obuf, + int len, unsigned char *iv, aes_encrypt_ctx cx[1]); + +AES_RETURN aes_cfb_decrypt(const unsigned char *ibuf, unsigned char *obuf, + int len, unsigned char *iv, aes_encrypt_ctx cx[1]); + +#define aes_ofb_encrypt aes_ofb_crypt +#define aes_ofb_decrypt aes_ofb_crypt + +AES_RETURN aes_ofb_crypt(const unsigned char *ibuf, unsigned char *obuf, + int len, unsigned char *iv, aes_encrypt_ctx cx[1]); + +typedef void cbuf_inc(unsigned char *cbuf); + +#define aes_ctr_encrypt aes_ctr_crypt +#define aes_ctr_decrypt aes_ctr_crypt + +AES_RETURN aes_ctr_crypt(const unsigned char *ibuf, unsigned char *obuf, + int len, unsigned char *cbuf, cbuf_inc ctr_inc, aes_encrypt_ctx cx[1]); + +#endif + +#if defined(__cplusplus) +} +#endif + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/sha1.c",".c","8453","259","/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 01/08/2005 + + This is a byte oriented version of SHA1 that operates on arrays of bytes + stored in memory. +*/ + +#include /* for memcpy() etc. */ + +#include ""sha1.h"" +#include ""brg_endian.h"" + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +#if defined( _MSC_VER ) && ( _MSC_VER > 800 ) +#pragma intrinsic(memcpy) +#endif + +#if 0 && defined(_MSC_VER) +#define rotl32 _lrotl +#define rotr32 _lrotr +#else +#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) +#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) +#endif + +#if !defined(bswap_32) +#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00)) +#endif + +#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) +#define SWAP_BYTES +#else +#undef SWAP_BYTES +#endif + +#if defined(SWAP_BYTES) +#define bsw_32(p,n) \ + { int _i = (n); while(_i--) ((uint_32t*)p)[_i] = bswap_32(((uint_32t*)p)[_i]); } +#else +#define bsw_32(p,n) +#endif + +#define SHA1_MASK (SHA1_BLOCK_SIZE - 1) + +#if 0 + +#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z))) +#define parity(x,y,z) ((x) ^ (y) ^ (z)) +#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + +#else /* Discovered by Rich Schroeppel and Colin Plumb */ + +#define ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) +#define parity(x,y,z) ((x) ^ (y) ^ (z)) +#define maj(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y)))) + +#endif + +/* Compile 64 bytes of hash data into SHA1 context. Note */ +/* that this routine assumes that the byte order in the */ +/* ctx->wbuf[] at this point is in such an order that low */ +/* address bytes in the ORIGINAL byte stream will go in */ +/* this buffer to the high end of 32-bit words on BOTH big */ +/* and little endian systems */ + +#ifdef ARRAY +#define q(v,n) v[n] +#else +#define q(v,n) v##n +#endif + +#define one_cycle(v,a,b,c,d,e,f,k,h) \ + q(v,e) += rotr32(q(v,a),27) + \ + f(q(v,b),q(v,c),q(v,d)) + k + h; \ + q(v,b) = rotr32(q(v,b), 2) + +#define five_cycle(v,f,k,i) \ + one_cycle(v, 0,1,2,3,4, f,k,hf(i )); \ + one_cycle(v, 4,0,1,2,3, f,k,hf(i+1)); \ + one_cycle(v, 3,4,0,1,2, f,k,hf(i+2)); \ + one_cycle(v, 2,3,4,0,1, f,k,hf(i+3)); \ + one_cycle(v, 1,2,3,4,0, f,k,hf(i+4)) + +VOID_RETURN sha1_compile(sha1_ctx ctx[1]) +{ uint_32t *w = ctx->wbuf; + +#ifdef ARRAY + uint_32t v[5]; + memcpy(v, ctx->hash, 5 * sizeof(uint_32t)); +#else + uint_32t v0, v1, v2, v3, v4; + v0 = ctx->hash[0]; v1 = ctx->hash[1]; + v2 = ctx->hash[2]; v3 = ctx->hash[3]; + v4 = ctx->hash[4]; +#endif + +#define hf(i) w[i] + + five_cycle(v, ch, 0x5a827999, 0); + five_cycle(v, ch, 0x5a827999, 5); + five_cycle(v, ch, 0x5a827999, 10); + one_cycle(v,0,1,2,3,4, ch, 0x5a827999, hf(15)); \ + +#undef hf +#define hf(i) (w[(i) & 15] = rotl32( \ + w[((i) + 13) & 15] ^ w[((i) + 8) & 15] \ + ^ w[((i) + 2) & 15] ^ w[(i) & 15], 1)) + + one_cycle(v,4,0,1,2,3, ch, 0x5a827999, hf(16)); + one_cycle(v,3,4,0,1,2, ch, 0x5a827999, hf(17)); + one_cycle(v,2,3,4,0,1, ch, 0x5a827999, hf(18)); + one_cycle(v,1,2,3,4,0, ch, 0x5a827999, hf(19)); + + five_cycle(v, parity, 0x6ed9eba1, 20); + five_cycle(v, parity, 0x6ed9eba1, 25); + five_cycle(v, parity, 0x6ed9eba1, 30); + five_cycle(v, parity, 0x6ed9eba1, 35); + + five_cycle(v, maj, 0x8f1bbcdc, 40); + five_cycle(v, maj, 0x8f1bbcdc, 45); + five_cycle(v, maj, 0x8f1bbcdc, 50); + five_cycle(v, maj, 0x8f1bbcdc, 55); + + five_cycle(v, parity, 0xca62c1d6, 60); + five_cycle(v, parity, 0xca62c1d6, 65); + five_cycle(v, parity, 0xca62c1d6, 70); + five_cycle(v, parity, 0xca62c1d6, 75); + +#ifdef ARRAY + ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; + ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; + ctx->hash[4] += v[4]; +#else + ctx->hash[0] += v0; ctx->hash[1] += v1; + ctx->hash[2] += v2; ctx->hash[3] += v3; + ctx->hash[4] += v4; +#endif +} + +VOID_RETURN sha1_begin(sha1_ctx ctx[1]) +{ + ctx->count[0] = ctx->count[1] = 0; + ctx->hash[0] = 0x67452301; + ctx->hash[1] = 0xefcdab89; + ctx->hash[2] = 0x98badcfe; + ctx->hash[3] = 0x10325476; + ctx->hash[4] = 0xc3d2e1f0; +} + +/* SHA1 hash data in an array of bytes into hash buffer and */ +/* call the hash_compile function as required. */ + +VOID_RETURN sha1_hash(const unsigned char data[], unsigned long len, sha1_ctx ctx[1]) +{ uint_32t pos = (uint_32t)(ctx->count[0] & SHA1_MASK), + space = SHA1_BLOCK_SIZE - pos; + const unsigned char *sp = data; + + if((ctx->count[0] += len) < len) + ++(ctx->count[1]); + + while(len >= space) /* tranfer whole blocks if possible */ + { + memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); + sp += space; len -= space; space = SHA1_BLOCK_SIZE; pos = 0; + bsw_32(ctx->wbuf, SHA1_BLOCK_SIZE >> 2); + sha1_compile(ctx); + } + + memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); +} + +/* SHA1 final padding and digest calculation */ + +VOID_RETURN sha1_end(unsigned char hval[], sha1_ctx ctx[1]) +{ uint_32t i = (uint_32t)(ctx->count[0] & SHA1_MASK); + + /* put bytes in the buffer in an order in which references to */ + /* 32-bit words will put bytes with lower addresses into the */ + /* top of 32 bit words on BOTH big and little endian machines */ + bsw_32(ctx->wbuf, (i + 3) >> 2); + + /* we now need to mask valid bytes and add the padding which is */ + /* a single 1 bit and as many zero bits as necessary. Note that */ + /* we can always add the first padding byte here because the */ + /* buffer always has at least one empty slot */ + ctx->wbuf[i >> 2] &= 0xffffff80 << 8 * (~i & 3); + ctx->wbuf[i >> 2] |= 0x00000080 << 8 * (~i & 3); + + /* we need 9 or more empty positions, one for the padding byte */ + /* (above) and eight for the length count. If there is not */ + /* enough space, pad and empty the buffer */ + if(i > SHA1_BLOCK_SIZE - 9) + { + if(i < 60) ctx->wbuf[15] = 0; + sha1_compile(ctx); + i = 0; + } + else /* compute a word index for the empty buffer positions */ + i = (i >> 2) + 1; + + while(i < 14) /* and zero pad all but last two positions */ + ctx->wbuf[i++] = 0; + + /* the following 32-bit length fields are assembled in the */ + /* wrong byte order on little endian machines but this is */ + /* corrected later since they are only ever used as 32-bit */ + /* word values. */ + ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 29); + ctx->wbuf[15] = ctx->count[0] << 3; + sha1_compile(ctx); + + /* extract the hash value as bytes in case the hash buffer is */ + /* misaligned for 32-bit words */ + for(i = 0; i < SHA1_DIGEST_SIZE; ++i) + hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3))); +} + +VOID_RETURN sha1(unsigned char hval[], const unsigned char data[], unsigned long len) +{ sha1_ctx cx[1]; + + sha1_begin(cx); sha1_hash(data, len, cx); sha1_end(hval, cx); +} + +#if defined(__cplusplus) +} +#endif +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/minizip/aes/entropy.c",".c","1034","55","#ifdef _WIN32 +#include +#else +#include +#include +#include +#endif + +#if defined(__cplusplus) +extern ""C"" +{ +#endif + +#ifdef _WIN32 +int entropy_fun(unsigned char buf[], unsigned int len) +{ + HCRYPTPROV provider; + unsigned __int64 pentium_tsc[1]; + unsigned int i; + int result = 0; + + + if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) + { + result = CryptGenRandom(provider, len, buf); + CryptReleaseContext(provider, 0); + if (result) + return len; + } + + QueryPerformanceCounter((LARGE_INTEGER *)pentium_tsc); + + for(i = 0; i < 8 && i < len; ++i) + buf[i] = ((unsigned char*)pentium_tsc)[i]; + + return i; +} +#else +int entropy_fun(unsigned char buf[], unsigned int len) +{ + int frand = open(""/dev/random"", O_RDONLY); + int rlen = 0; + if (frand != -1) + { + rlen = read(frand, buf, len); + close(frand); + } + return rlen; +} +#endif + +#if defined(__cplusplus) +} +#endif +","C" +"RNN","MinLiAmoy/rnn-fpga","cpp/accel/AccelTest.h",".h","3773","98","#ifndef ACCEL_ACCEL_TEST_H +#define ACCEL_ACCEL_TEST_H + +#include +#include ""Typedefs.h"" +#include ""Accel.h"" +//#include ""AccelPrint.h"" +#include + +// ML: num of layer of RNN +const unsigned N_LAYERS = 3; +// ML: num of weight arrays of every gate in rnn layer +const unsigned N_W_LAYERS = 4; + + +const unsigned M_tab[] = { 64, 128, 128}; // input num +const unsigned N_tab[] = {128, 128, 64}; // output num +const unsigned T_tab[] = { 0, 1, 2}; // type of +const unsigned widx_tab[] = { 0, 1, 3, 4, 6, 7, 9, 10, 14, 15, 17, 18, 20, 21, 23, 24, 28}; // idx of each weight array in zip arc +const unsigned bidx_tab[] = { 2, 5, 8, 11, 16, 19, 22, 25, 29}; // idx of each bias array in zip arc + +// num of elements in vocab +const char vocab[] = {'\n', ' ', '!', '$', '&', '\'', ',', '-', '.', ':', ';', '?', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', + 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', + 'v', 'w', 'x', 'y', 'z'}; + +// layer_idx goes from 1 to 9 +bool layer_is_rnn(unsigned layer_idx); +bool layer_is_last(unsigned layer_idx); + +// Simple log function, only works for powers of 2 +unsigned log2(unsigned x); + +//------------------------------------------------------------------------ +// Set an array of ap_int's using some data, used to binarize test +// inputs and outputs +//------------------------------------------------------------------------ +template +void set_bit_array(T1 array[], const T2* data, unsigned size) { + for (unsigned i = 0; i < size; ++i) { + set_bit(array, i, (data[i]>=0) ? Bit(0) : Bit(-1)); + } +} + +//------------------------------------------------------------------------ +// Functions used to preprocess params and inputs +//------------------------------------------------------------------------ + +void set_rnn_weight_array(Word* w, const float* wts_in, const float* wts_hid, unsigned layer_idx, unsigned weight_idx); +void set_rnn_bias_array(Word* b, const float* bias, unsigned layer_idx, unsigned weight_idx); +void set_dense_weight_array(Word* w, const float* wts, unsigned layer_idx); +void set_dense_bias_array(Word* b, const float* bias, unsigned layer_idx); +void set_char_to_word(Word* data, char in); + +/* +void set_bnorm_array(Word* kh, const float* k, const float* h, unsigned layer_idx); +void set_bnorm_array1(Word* kh, const float* k, const float* h, unsigned layer_idx, unsigned N); +void set_bnorm_array2(Word* kh, const float* k, const float* h, unsigned N); + +void binarize_input_images(Word* dmem_i, const float* inputs, unsigned S); + +//------------------------------------------------------------------------ +// Padded convolution (used for golden reference) +//------------------------------------------------------------------------ +void padded_conv(Word in[], Word w[], Word out[], unsigned M, unsigned S); + +//------------------------------------------------------------------------ +// Helper test function for the accelerator +// This function calls the accelerator, then runs a check of the results +// against conv_ref (if not NULL) and bin_ref. +//------------------------------------------------------------------------ +void test_conv_layer( + Word* weights, + Word* kh, + Word* data_i, + Word* data_o, + Word* conv_ref, + Word* bin_ref, + const unsigned M, + const unsigned N, + const unsigned S, + const ap_uint<1> conv_mode=1, + const ap_uint<1> max_pool=0 +); + +void test_dense_layer( + Word* weights, + Word* kh, + Word* data_i, + Word* data_o, + Word* bin_ref, + const unsigned M, // pixels + const unsigned N // pixels +);*/ + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/accel/AccelSchedule.cpp",".cpp","2590","93","#include ""AccelSchedule.h"" +#include ""AccelTest.h"" +#include ""Timer.h"" + +static Timer timers[N_LAYERS] = { + ""xl-FC"", + ""xl-RNN2"", + ""xl-RNN1"", +}; + +// ----------------------------------------------------------------------- +// Each layer may need multiple invocations of the accelerator due to +// limited on-chip storage of weights. +// +// This function computes the number of invocations needed and splits +// the weights for each invocation. +// +// We make the following assumptions now: +// 1. Only 1 output image per invocation +// 2. wt_mem is large enough to hold the weights for at least 1 image +// ----------------------------------------------------------------------- +void compute_accel_schedule( + Word* wt, + Word* b, + unsigned n_inputs, + unsigned n_outputs, + const ap_uint<2> layer_type, // 0=rnn1, 1=rnn2, 2=dense + AccelSchedule &schedule, + unsigned layer_idx +) { + assert (wt != NULL); + assert (b != NULL); + + ap_uint<3> layer_mode = 0; + layer_mode(2,1) = layer_type(1,0); + + unsigned idx = 0; + + schedule.resize(1); + + layer_mode[0] = 1; + + // add a new invocation to the schedule + schedule[idx].n_inputs = n_inputs; // ML: n_input has been modified + schedule[idx].n_outputs = n_outputs; + schedule[idx].layer_mode = layer_mode; + + + unsigned o = 0; // ML: we assume there is no image batch + + Word* wt_i = schedule[idx].wt; + if (layer_type < 2) { + load_weights(wt, wt_i, o, n_inputs+n_outputs, 4*n_outputs); // ML: the weights are loaded on the wt_i + } + else { + load_weights(wt, wt_i, o, n_inputs, n_outputs); + } + + Word* b_i = schedule[idx].b; + if (layer_type < 2) { + load_bias(b, b_i, o, 4*n_outputs); + } else { + load_bias(b, b_i, o, n_outputs); + } +} + + + +// ----------------------------------------------------------------------- +// load n_in*n_out single bit weights into accelerator +// o is which output bit we are starting from +// ----------------------------------------------------------------------- +void load_weights(Word* wt, Word* wt_o, + unsigned o, unsigned n_in, unsigned n_out +) { + assert(n_in % WORD_SIZE == 0); + // load in Word-sized chunks + for (unsigned i = 0; i < n_in*n_out/WORD_SIZE; ++i) { + wt_o[i] = wt[o*n_in/WORD_SIZE + i]; + } +} + +// ----------------------------------------------------------------------- +// load n_out sets of kh params into accelerator +// ----------------------------------------------------------------------- +void load_bias(Word* b, Word b_i[], unsigned o, unsigned n_out) { + for (unsigned i = 0; i < n_out / WORD_SIZE; ++i) { + b_i[i] = b[o + i]; + } +} + + +","C++" +"RNN","MinLiAmoy/rnn-fpga","cpp/accel/Dense.h",".h","1291","49","#ifndef ACCEL_DENSE_H +#define ACCEL_DENSE_H + +#include +#include +#include ""Debug.h"" +#include ""Typedefs.h"" +#include ""Accel.h"" +#include ""AccelSchedule.h"" + +/*void dense_layer_cpu( + const Word* w, + const float* k_data, + const float* h_data, + const Word* data_i, + Word* data_o, + const unsigned M, + const unsigned N +);*/ +#ifdef __SDSCC__ + #include ""sds_lib.h"" + #define MEM_ALLOC(size) sds_alloc(size) + #define MEM_FREE(ptr) sds_free(ptr) +#else + #define MEM_ALLOC(size) malloc(size) + #define MEM_FREE(ptr) free(ptr) +#endif + +#pragma SDS data copy(data_i[0:16], data_o[0:16]) +#pragma SDS data access_pattern(data_i:SEQUENTIAL, data_o:SEQUENTIAL) +#pragma SDS data mem_attribute(data_i:PHYSICAL_CONTIGUOUS, data_o:PHYSICAL_CONTIGUOUS) +#pragma SDS data data_mover(data_i:AXIDMA_SIMPLE, data_o:AXIDMA_SIMPLE) +#pragma SDS data access_pattern(wt:SEQUENTIAL, b:SEQUENTIAL) +#pragma SDS data mem_attribute(wt:PHYSICAL_CONTIGUOUS, b:PHYSICAL_CONTIGUOUS) +#pragma SDS data data_mover(wt:AXIDMA_SIMPLE, b:AXIDMA_SIMPLE) +void dense_layer( + Word data_i[DMEM_WORDS], + Word data_o[DMEM_O_WORDS], + unsigned layer_idx, + const bool inputs_words, + const Address n_inputs, + const Address n_outputs, + Word wt[WT_WORDS], + Word b[BIAS_WORDS] +); + + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/accel/AccelTest.cpp",".cpp","6567","246","#include ""AccelTest.h"" +#include ""AccelSchedule.h"" +#include +#include + +//------------------------------------------------------------------------ +// Helper functions +//------------------------------------------------------------------------ + +bool layer_is_rnn(unsigned layer_idx) { + assert(layer_idx != 0 && layer_idx <= N_LAYERS); + return T_tab[layer_idx-1] == LAYER_RNN1 || T_tab[layer_idx-1] == LAYER_RNN2; +} + +bool layer_is_last(unsigned layer_idx) { + assert(layer_idx != 0 && layer_idx <= N_LAYERS); + return T_tab[layer_idx-1] == LAYER_LAST; +} + +// Simple log function, only works for powers of 2 +unsigned log2(unsigned x) { + unsigned res = 0; + while (x != 1) { + x = x >> 1; + res += 1; + } + return res; +} + +//------------------------------------------------------------------------ +// Binarize weights and pack them into Words +//------------------------------------------------------------------------ + +void set_rnn_weight_array(Word* w, const float* wts_in, const float* wts_hid, unsigned layer_idx, unsigned weight_idx) { + const unsigned M = M_tab[layer_idx-1]; + const unsigned N = N_tab[layer_idx-1]; + unsigned w_idx = 0; + for (unsigned n = 0; n < N; ++n) { + for (unsigned m = 0; m < M + N; m+=WORD_SIZE) { + Word wrd = 0; + if (m < M) { + for (unsigned b = 0; b < WORD_SIZE; ++b) { + wrd[b] = ((wts_in[(m+b)*N+n] < 0) ? 0 : 1); + } + } else { + for (unsigned b = 0; b < WORD_SIZE; ++b) { + wrd[b] = ((wts_hid[(m-M+b)*N+n] < 0) ? 0 : 1); + } + } + w[weight_idx*(M+N)*N/WORD_SIZE + w_idx] = wrd; + ++w_idx; + } + } +} + +void set_rnn_bias_array(Word* b, const float* bias, unsigned layer_idx, unsigned weight_idx) { + const unsigned N = N_tab[layer_idx-1]; + unsigned b_idx = 0; + Word wrd = 0; + for (unsigned n = 0; n < N; n+=WORD_SIZE) { + for (unsigned b = 0; b < WORD_SIZE; ++b) { + wrd[b] = ((bias[n + b] < 0) ? 0 : 1); + } + b[weight_idx*N/WORD_SIZE + b_idx] = wrd; + ++b_idx; + } +} + + + +void set_dense_weight_array(Word* w, const float* wts, unsigned layer_idx) { + const unsigned M = M_tab[layer_idx-1]; + const unsigned N = N_tab[layer_idx-1]; + unsigned w_idx = 0; + for (unsigned n = 0; n < N; ++n) { + for (unsigned m = 0; m < M; m+=WORD_SIZE) { + Word wrd = 0; + for (unsigned b = 0; b < WORD_SIZE; ++b) { + wrd[b] = ((wts[(m+b)*N+n] < 0) ? 0 : 1); + } + w[w_idx] = wrd; + ++w_idx; + } + } +} + +void set_dense_bias_array(Word* b, const float* bias, unsigned layer_idx) { + const unsigned N = N_tab[layer_idx-1]; + unsigned b_idx = 0; + Word wrd = 0; + for (unsigned n = 0; n < N; n+= WORD_SIZE) { + for (unsigned b = 0; b < WORD_SIZE; ++b) { + wrd[b] = ((bias[n + b] < 0) ? 0 : 1); + } + b[b_idx] = wrd; + ++b_idx; + } +} + +// ML: char to index(Word type) +void set_char_to_word(Word* data, char in) { + for (unsigned i = 0; i < VOCAB_SIZE/DATA_PER_WORD; ++i) { + data[i] = 0; + } + for (unsigned i = 0; i <= VOCAB_SIZE; ++i) { + if (vocab[i] == in) { + DATA start_seed = 1; + data[i/DATA_PER_WORD]((i%DATA_PER_WORD+1)*16-1,(i%DATA_PER_WORD)*16) = start_seed(15,0); + break; + } + } +} + + +/* +//------------------------------------------------------------------------ +// Helper test function for the accelerator conv layers +//------------------------------------------------------------------------ +void test_conv_layer( + Word* weights, + Word* kh, + Word* data_i, + Word* data_o, + Word* conv_ref, + Word* bin_ref, + const unsigned M, + const unsigned N, + const unsigned Si, + const ap_uint<1> conv_mode, // 0=conv1, 1=conv + const ap_uint<1> max_pool +) { + printf (""#### Testing convolution with %u inputs, width %u ####\n"", M, Si); + unsigned So = max_pool ? Si/2 : Si; + unsigned input_words = conv_mode==0 ? Si*Si : M*Si*Si/WORD_SIZE; + unsigned output_words = N*So*So/WORD_SIZE; + if (output_words < 1) output_words = 1; + assert (input_words <= DMEM_WORDS); + //assert (output_words <= DMEM_O_WORDS); + + DB(3, + printf (""*data*:\n""); + print_bits3d(data_i, 0, 1, Si, 6,Si); + printf (""*params*:\n""); + print_params3d(weights, 0, 15); + ) + + AccelSchedule sched; + compute_accel_schedule( + weights, kh, + M, N, Si, + conv_mode.to_int(), + max_pool, + sched + ); + + run_accel_schedule( + data_i, data_o, + 0, // layer_idx + input_words, + output_words, + 0, // dmem_mode + sched + ); + + // print results + printf (""*bin out*:\n""); + print_bits3d(data_o, 0, 1, So, 8,So); + printf (""*bin ref*:\n""); + print_bits3d(bin_ref, 0, 1, So, 8,So); + + // Compare bin results + printf (""## Checking results ##\n""); + unsigned n_err = 0; + for (unsigned n = 0; n < N; ++n) { + for (unsigned r = 0; r < So; ++r) { + for (unsigned c = 0; c < So; ++c) { + if (get_bit(data_o, n*So*So+r*So+c) != get_bit(bin_ref, n*So*So+r*So+c)) { + n_err++; + //printf (""bin out != ref at n=%d, (%d,%d)\n"", n, r,c); + //if (n_err > 64) exit(-1); + } + } + } + } + float err_rate = float(n_err) / (N*So*So)*100; + printf (""Error rate: %7.4f%%\n"", err_rate); + assert(err_rate < 1.0); +} + +//------------------------------------------------------------------------ +// Helper test function for the accelerator dense layers +//------------------------------------------------------------------------ +void test_dense_layer( + Word* weights, + Word* kh, + Word* data_i, + Word* data_o, + Word* bin_ref, + const unsigned M, // pixels + const unsigned N // pixels +) { + printf (""#### Testing dense layer with %u inputs, %u outputs ####\n"", M, N); + DB(3, + printf (""*data*:\n""); + print_bits(data_i, 0, 16, 8, 16); + printf (""*params*:\n""); + print_bits(weights, 0, 16, 8, 16); + ) + + AccelSchedule sched; + compute_accel_schedule( + weights, kh, + M, N, 1, + 2, // layer_mode + 0, // norm_mode + sched + ); + + run_accel_schedule( + data_i, data_o, + 0, // layer_idx + M/WORD_SIZE, + N/WORD_SIZE, + 0, // dmem_mode + sched + ); + + // print results + printf (""*bin out*:\n""); + print_bits(data_o, 0, 16, 8, 16); + printf (""*bin ref*:\n""); + print_bits(bin_ref, 0, 16, 8, 16); + + // Compare bin results + printf (""## Checking results ##\n""); + unsigned n_err = 0; + for (unsigned n = 0; n < N; ++n) { + if (get_bit(data_o, n) != get_bit(bin_ref, n)) { + n_err++; + } + } + float err_rate = float(n_err)/N * 100; + printf (""Error rate: %7.4f%%\n"", err_rate); + assert(err_rate < 1.0); +}*/ +","C++" +"RNN","MinLiAmoy/rnn-fpga","cpp/accel/accel_test_layer.cpp",".cpp","3276","115","#include +#include + +#include ""Accel.h"" +#include ""AccelSchedule.h"" +#include ""AccelTest.h"" +#include ""Dense.h"" +#include ""ZipIO.h"" +#include ""ParamIO.h"" +#include ""DataIO.h"" + +int main(int argc, char** argv) { + #ifdef HLS_COMPILE + const unsigned l = 2; + #else + if (argc < 2) { + printf (""Requires layer number as the first argument\n""); + exit(-1); + } + const unsigned l = atoi(argv[1]); + #endif + + assert (l < N_LAYERS); + + const unsigned lconv = 6; // last conv + + const unsigned Si = S_tab[l-1]; + const unsigned So = S_tab[l]; + const unsigned M = M_tab[l-1]; + const unsigned N = N_tab[l-1]; + const unsigned wt_size = (layer_is_conv(l)) ? WTS_TO_WORDS(M*N) : M*N/WORD_SIZE; + const unsigned kh_size = N/KH_PER_WORD; + + Word* wt = new Word[wt_size]; + Word* kh = new Word[kh_size]; + Word* data_i = (Word*) MEM_ALLOC( DMEM_WORDS * sizeof(Word) ); + Word* data_o = (Word*) MEM_ALLOC( N*So*So/WORD_SIZE * sizeof(Word) ); + if (!wt || !kh || !data_i || !data_o) { + fprintf (stderr, ""**** ERROR: Alloc failed in %s\n"", __FILE__); + return (-2); + } + for (unsigned i = 0; i < wt_size; ++i) + wt[i] = 0; + for (unsigned i = 0; i < kh_size; ++i) + kh[i] = 0; + + printf (""## Testing Layer %u with %u outputs ##\n"", l, N); + + // Load reference output from zip and set data_i + printf (""## Loading test data ##\n""); + if (l == 1) { + Cifar10TestInputs X(1); + binarize_input_images(data_i, X.data, Si); + } else { + const float* input_maps = new float[M*Si*Si]; + std::string l_type = layer_is_conv(l) ? ""/data/cpp_conv"" : ""/data/cpp_dense""; + unsigned l_num = layer_is_conv(l) ? l-1 : l-L_CONV-1; + std::string input_file = get_root_dir() + l_type + std::to_string(l_num) + ""_maps.zip""; + unzip_to_array(input_file, input_maps); + set_bit_array(data_i, input_maps, M*Si*Si); + delete[] input_maps; + } + + // Binarize weights + printf (""## Loading parameters ##\n""); + Params params(get_root_dir() + ""/params/cifar10_parameters_nb.zip""); + const float* weights = params.float_data(widx_tab[l-1]); + set_weight_array(wt, weights, l); + + // Binarize batch-norm parameters + const float* k = params.float_data(kidx_tab[l-1]); + const float* h = params.float_data(hidx_tab[l-1]); + set_bnorm_array(kh, k, h, l); + + // Load binary ref + Word* bin_ref = new Word[N*So*So/WORD_SIZE]; + if (layer_is_last(l)) { + bin_ref[0] = 3; + } else { + const float* output_maps = new float[N*So*So]; + std::string l_type = layer_is_conv(l) ? ""/data/cpp_conv"" : ""/data/cpp_dense""; + unsigned l_num = layer_is_conv(l) ? l : l-L_CONV; + std::string output_file = get_root_dir() + l_type + std::to_string(l_num) + ""_maps.zip""; + unzip_to_array(output_file, output_maps); + set_bit_array(bin_ref, output_maps, N*So*So); + delete[] output_maps; + } + + // Perform test + if (layer_is_conv(l)) { + test_conv_layer( + wt, kh, data_i, data_o, + NULL, bin_ref, + M, N, Si, + (l==1) ? 0 : 1, // conv_mode + pool_tab[l-1] // max_pool + ); + } else { + test_dense_layer( + wt, kh, data_i, data_o, + bin_ref, + M, N + ); + } + + printf (""Tests passed!\n""); + + delete[] bin_ref; + MEM_FREE( data_o ); + MEM_FREE( data_i ); + delete[] kh; + delete[] wt; + return 0; +} +","C++" +"RNN","MinLiAmoy/rnn-fpga","cpp/accel/accel_test_bnn.cpp",".cpp","5831","206","#include +#include +#include + +#include ""Accel.h"" +#include ""AccelSchedule.h"" +#include ""AccelTest.h"" +#include ""Dense.h"" +#include ""ZipIO.h"" +#include ""ParamIO.h"" +#include ""DataIO.h"" +#include ""Timer.h"" + +int main(int argc, char** argv) { + if (argc < 2) { + printf (""Give number of character to produce as 1st arg\n""); + printf (""Give the initial srting as 2nd arg optional\n""); + return 0; + } + const unsigned n_char = std::stoi(argv[1]); + bool Init = false; + char* str_init = NULL; + + if (argc == 3) { + Init = true; + str_init = argv[2]; // *ML: cant loas text with ' ' + printf(""* Initial string is %s\n"", str_init); + } + // print some config numbers + printf (""* WT_WORDS = %u\n"", WT_WORDS); + printf (""* BIAS_WORDS = %u\n"", BIAS_WORDS); + + // Load input data + //printf (""## Loading input data ##\n""); + // ML: hidden state can be initialized by a given string + + // Load parameters + printf (""## Loading parameters ##\n""); + Params params(get_root_dir() + ""/params/rnn_parameters.zip""); + + // --------------------------------------------------------------------- + // allocate and binarize all weights + // --------------------------------------------------------------------- + Word* wt[N_LAYERS]; + Word* b[N_LAYERS]; + + for (unsigned l = 0; l < N_LAYERS; ++l) { + const unsigned M = M_tab[l]; + const unsigned N = N_tab[l]; + + if (layer_is_rnn(l+1)) { + wt[l] = new Word[(M+N)*4*N / WORD_SIZE]; + b[l] = new Word[4*N / WORD_SIZE]; + } + else { + wt[l] = new Word[M*N / WORD_SIZE]; // ML: RNN layers + b[l] = new Word[N / WORD_SIZE]; + } + if (layer_is_rnn(l+1)) { + for (unsigned w_l = 0; w_l < N_W_LAYERS; ++w_l) { + // ML: set in_to weight and hid_to weight + const float* weights_in = params.float_data(widx_tab[l*N_W_LAYERS*2 + 2*w_l]); + const float* weights_hid = params.float_data(widx_tab[l*N_W_LAYERS*2 + 2*w_l +1]); + set_rnn_weight_array(wt[l], weights_in, weights_hid, l+1, w_l); + // ML: set bias + const float* bias = params.float_data(bidx_tab[l*N_W_LAYERS + w_l]); + set_rnn_bias_array(b[l], bias, l+1, w_l); + } + } else { + + const float* weights = params.float_data(widx_tab[16]); + set_dense_weight_array(wt[l], weights, l+1); + const float* bias = params.float_data(bidx_tab[8]); + set_dense_bias_array(b[l], bias, l+1); + } + + + } + + // --------------------------------------------------------------------- + // // compute accelerator schedule (divides up weights) + // --------------------------------------------------------------------- + AccelSchedule layer_sched[N_LAYERS]; + for (unsigned l = 0; l < N_LAYERS; ++l) { + compute_accel_schedule( + wt[l], b[l], + M_tab[l], N_tab[l], T_tab[l], + layer_sched[l], l + ); + } + + // allocate memories for data i/o for the accelerator + Word* data_i = (Word*) MEM_ALLOC( DMEM_WORDS * sizeof(Word) ); // ML: need to be modified! + Word* data_o = (Word*) MEM_ALLOC( DMEM_O_WORDS * sizeof(Word) ); + if (!data_i || !data_o) { + fprintf (stderr, ""**** ERROR: Alloc failed in %s\n"", __FILE__); + return (-2); + } + + unsigned n_errors = 0; + + printf(""## Initialing the RNN\n""); + + if (Init) { + unsigned i = 0; + while (str_init[i] != '\0') { + set_char_to_word(data_i, str_init[i]); + + for (unsigned l = 1; l <= 3; ++l) { + const unsigned M = M_tab[l-1]; + const unsigned N = N_tab[l-1]; + + + dense_layer( + data_i, data_o, + l-1, + (l==1) ? 1 : 0, // input_words + layer_sched[l-1][0].n_inputs, + layer_sched[l-1][0].n_outputs, + layer_sched[l-1][0].wt, + layer_sched[l-1][0].b + ); + } + i++; + } + } + + printf (""## Running RNN for %d characters\n"", n_char); + + //-------------------------------------------------------------- + // Run RNN + //-------------------------------------------------------------- + + // ML: load an arbitrary input character [1, 0. 0, ..., 0] + for (unsigned i = 0; i < VOCAB_SIZE/DATA_PER_WORD; ++i) { + if (i == 0) { + data_i[i] = 0; + DATA start_seed = 1; + data_i[i](15,0) = start_seed(15,0); + } else { + data_i[i] = 0; + } + } + + for (unsigned n = 0; n < n_char; ++n) { + + //------------------------------------------------------------ + // Execute RNN layers + //------------------------------------------------------------ + for (unsigned l = 1; l <= 3; ++l) { + const unsigned M = M_tab[l-1]; + const unsigned N = N_tab[l-1]; + + dense_layer( + data_i, data_o, + l-1, + (n==0 && l==1 && (~Init)) ? 1 : 0, // input_words + layer_sched[l-1][0].n_inputs, + layer_sched[l-1][0].n_outputs, + layer_sched[l-1][0].wt, + layer_sched[l-1][0].b + ); + } + + //------------------------------------------------------------ + // Execute the prediciton + //------------------------------------------------------------ + int prediction = 0; + int max = -512; // ML: may shoulb be less + + + for (unsigned i = 0; i < VOCAB_SIZE; i++) { + DATA temp; + int add = i / DATA_PER_WORD; + int off = i % DATA_PER_WORD; + temp(15,0) = data_o[add]((off+1)*16-1,off*16); + if (temp.to_int() > max) { + max = temp; + prediction = i; + } + } + + + + assert(prediction >= 0 && prediction <= 63); + + std::cout< +#include +#include +#include // include this before sds_lib.h for size_t + +#include ""Typedefs.h"" +#include ""Debug.h"" +#include ""Common.h"" + +/*#ifdef __SDSCC__ + #include ""sds_lib.h"" + #define MEM_ALLOC(size) sds_alloc(size) + #define MEM_FREE(ptr) sds_free(ptr) +#else + #define MEM_ALLOC(size) malloc(size) + #define MEM_FREE(ptr) free(ptr) +#endif*/ + +//------------------------------------------------------------------- +// Constants +//------------------------------------------------------------------- + +// ML: define the param of Recurrent Neural Network +const unsigned HID_SIZE = 128; +const unsigned DATA_SIZE = 16; +const unsigned DATA_PER_WORD = 4; +const unsigned VOCAB_SIZE = 64; +// + +const unsigned WORD_SIZE = 64; + +const unsigned WT_L = (128 + 128)* 4 * 128; // parameter to control wt mem size +const unsigned BIAS_L = 128 * 4; // ML: parameter to control bias memsize + + +const unsigned WT_WORDS = WT_L / WORD_SIZE; // ML: beyond the mem on chip? +const unsigned BIAS_WORDS = BIAS_L / WORD_SIZE; + + +// ML: mem of input data and output data +const unsigned DMEM_WORDS = 64/DATA_PER_WORD; +const unsigned DMEM_O_WORDS = 64/DATA_PER_WORD; + + +//------------------------------------------------------------------- +// Typedefs +//------------------------------------------------------------------- +enum RLayerTyprEnum {LAYER_RNN1, LAYER_RNN2, LAYER_LAST}; +// +typedef ap_int Word; + +typedef ap_uint<16> Address; +/*typedef ap_int<12> ConvSum; +typedef ap_int<5> ConvOut; +typedef ap_uint<10> IdxType; +typedef ap_fixed<16,4> C1Comp; // ML: -h/k be quantized to be 16 bits fixed-point on the fpconv layer +typedef ap_int<16> NormComp; // ML: -h/k be quantized to be 16 bits int +typedef ap_int<16> DenseSum; +typedef ap_fixed<16,12> DenseNorm; + +typedef ap_fixed<20,2, AP_RND> C1InputType; // ML: input pixel are 20-bit fixed-point +typedef ap_fixed<24,6, AP_RND> C1ConvType;*/ + + +typedef ap_fixed<16,8> DATA; // ML: can do the exp operation + + +//------------------------------------------------------------------- +// Accelerator synthesizable top-level function +//------------------------------------------------------------------- +/*#pragma SDS data copy(dmem_i[0:input_words], dmem_o[0:output_words]) +#pragma SDS data access_pattern(dmem_i:SEQUENTIAL, dmem_o:SEQUENTIAL) +#pragma SDS data access_pattern(wt_i:SEQUENTIAL, kh_i:SEQUENTIAL) +#pragma SDS data mem_attribute(dmem_i:PHYSICAL_CONTIGUOUS, dmem_o:PHYSICAL_CONTIGUOUS) +#pragma SDS data mem_attribute(wt_i:PHYSICAL_CONTIGUOUS, kh_i:PHYSICAL_CONTIGUOUS) +#pragma SDS data data_mover(dmem_i:AXIDMA_SIMPLE, dmem_o:AXIDMA_SIMPLE) +#pragma SDS data data_mover(wt_i:AXIDMA_SIMPLE, kh_i:AXIDMA_SIMPLE) +void top( + Word wt_i[WT_WORDS], + Word kh_i[KH_WORDS], + Word dmem_i[DMEM_WORDS], + Word dmem_o[DMEM_O_WORDS], + const Address n_inputs, + const Address n_outputs, + const Address input_words, + const Address output_words, + const ap_uint<3> layer_mode, // [0]='new layer', [2:1]='conv1,conv,dense' + const ap_uint<1> dmem_mode, // 0 means dmem[0] is input + const ap_uint<2> width_mode, // 0=8'b, 1=16'b, 2=32'b + const ap_uint<2> norm_mode // 0='do nothing', 1='do norm', 2='do pool' +);*/ + +#endif +","Unknown" +"RNN","MinLiAmoy/rnn-fpga","cpp/accel/Dense.cpp",".cpp","6014","208","#include ""Dense.h"" +#include ""Timer.h"" + + +const static Word m1(""0x5555555555555555"", 16); +const static Word m2(""0x3333333333333333"", 16); +const static Word m4(""0x0f0f0f0f0f0f0f0f"", 16); +const static Word h01(""0x0101010101010101"", 16); +static Timer t_dense(""dense""); +static Timer t_last (""last""); + +// ----------------------------------------------------------------------- +// Performs dense dot product on M input bits, n*M is the weight offset +// ----------------------------------------------------------------------- +// ML: the size of in[] is like 1*M and the size of w is n*M where M%word_size = 0 +// ML: a call of dotproduct_m can compute a dotproduct using index of n +DATA sigmoid( + const DATA in + ) { + DATA out; + out = 1/(1+hls::exp((ap_fixed<16,8>) in)); + return out; +} + +DATA tanh( + const DATA in + ) { + DATA out; + out = (hls::exp((ap_fixed<16,8>) in) - hls::exp((ap_fixed<16,8>) -in)) / (hls::exp((ap_fixed<16,8>) in) + hls::exp((ap_fixed<16,8>) -in)); + return out; +} + + +DATA dotproduct_m( + const Word in[2*HID_SIZE], + const Word w[WT_WORDS], + const unsigned M, + const unsigned n +) { + assert (M % WORD_SIZE == 0); + DATA sum = 0; + static Word wt_wrd; + + // Loop across in the inputs in batches of WORD_SIZE + for (unsigned m = 0; m < M; m+=WORD_SIZE) { + + DATA in_wrd[WORD_SIZE]; + for (unsigned i = 0; i < WORD_SIZE; i+=DATA_PER_WORD) { + in_wrd[i](15,0) = in[(m + i)/4](15,0); + in_wrd[i+1](15,0) = in[(m + i)/4](31,16); + in_wrd[i+2](15,0) = in[(m + i)/4](47,32); + in_wrd[i+3](15,0) = in[(m + i)/4](63,48); + } + wt_wrd = w[(n*M+m)/WORD_SIZE]; + + for (unsigned i = 0; i < WORD_SIZE; ++i) { + if (wt_wrd[i] > 0) + sum += in_wrd[i]; + else + sum -= in_wrd[i]; + } + } + return sum; +} + +// ----------------------------------------------------------------------- +// Internal dense layer +// ----------------------------------------------------------------------- +// ML: k, h is the coefficient of BNN! +// ML: the size of in is M/DATA_PER_WORD = M/4 words; the size of out is N/DATA_PER_WORD! + + + +void dense_layer( + Word data_i[DMEM_WORDS], + Word data_o[DMEM_O_WORDS], + unsigned layer_idx, + const bool inputs_words, + const Address n_inputs, + const Address n_outputs, + Word wt[WT_WORDS], + Word b[BIAS_WORDS] +) { + //t_dense.start(); + static Word dmem[5][HID_SIZE/DATA_PER_WORD] = {0}; // ML: sequence: input/output, hid1, cell1, hid2, cell2 + + + + Address M = n_inputs; + Address N = n_outputs; + + //ap_uint<1> d_i_idx = dmem_mode; + //ap_uint<1> d_o_idx = ~dmem_mode; + + static Word in[2*HID_SIZE/DATA_PER_WORD]; + static DATA gate[4][HID_SIZE]; // ML: input, forget, cell(tanh), output + + if (layer_idx < 2) { + LOOP_DMEM_I: + for (unsigned i = 0; i < M+N; i+= DATA_PER_WORD) { + if ((i < M) && (layer_idx == 0) && (inputs_words != 0) ) { + in[i/DATA_PER_WORD] = data_i[i/DATA_PER_WORD]; + } + else if ((i < M) && (layer_idx == 0) && (inputs_words == 0)) { + in[i/DATA_PER_WORD] = dmem[0][i/DATA_PER_WORD]; + } + else if ((i < M) && (layer_idx == 1)) { + in[i/DATA_PER_WORD] = dmem[1][i/DATA_PER_WORD]; + } + else if ((i >= M) && (layer_idx == 0)) { + in[i/DATA_PER_WORD] = dmem[1][(i-M)/DATA_PER_WORD]; + } + else{ + in[i/DATA_PER_WORD] = dmem[3][(i-M)/DATA_PER_WORD]; + } + } + } else { + LOOP_DMEM_II: + for (unsigned i = 0; i < M; i+= DATA_PER_WORD) { + in[i/DATA_PER_WORD] = dmem[3][i/DATA_PER_WORD]; + } + } + + static Word wt_i[WT_WORDS] = {0}; + static Word b_i[BIAS_WORDS] = {0}; + + LOOP_WT_I: + for (unsigned j = 0; j < WT_WORDS; ++j) + wt_i[j] = wt[j]; + LOOP_B_I: + for (unsigned j = 0; j < BIAS_WORDS; ++j) + b_i[j] = b[j]; + + + if (layer_idx == LAYER_LAST){ + LOOP_DENSE_O: + for (unsigned n = 0; n < N; n+=WORD_SIZE) { + Word out_wrd[WORD_SIZE/DATA_PER_WORD] = {0}; + LOOP_DENSE_I: + for (unsigned nb = 0; nb < WORD_SIZE; ++nb) { + DATA sum = dotproduct_m(in, wt_i, M, n+nb); + out_wrd[nb/DATA_PER_WORD]((nb%DATA_PER_WORD+1)*16-1, (nb%DATA_PER_WORD)*16) = sum(15,0); + } + LOOP_DMEM_O: + for (unsigned i = 0; i < WORD_SIZE / DATA_PER_WORD; ++i){ + data_o[n/DATA_PER_WORD + i] = out_wrd[i]; + dmem[0][n/DATA_PER_WORD + i] = out_wrd[i]; // ML: dont need another data buffer? + } + + } + } else { + LOOP_RNN_O: + for (unsigned n = 0; n < 4*N; n+=WORD_SIZE) { + //Word out_wrd[WORD_SIZE/DATA_PER_WORD] = {0}; + LOOP_RNN_I: + for (unsigned nb = 0; nb < WORD_SIZE; ++nb) { + DATA sum = dotproduct_m(in, wt_i, M+N, n+nb); + //out_wrd[nb/DATA_PER_WORD]((nb%DATA_PER_WORD+1)*16-1, (nb%DATA_PER_WORD)*16-1) = sum(15,0); + unsigned gate_idx = (n + nb) / N; + unsigned gate_off = (n + nb) % N; + unsigned idx = (n+nb)/DATA_PER_WORD; + unsigned off = (n+nb)%DATA_PER_WORD; + DATA bias; + bias(15,0) = b_i[idx]((off+1)*16-1, (off*16)); + gate[gate_idx][gate_off](15,0) = sum(15,0) + bias; + } + + } + + LOOP_ACT: + for (unsigned n = 0; n < 4*N; n++) { + unsigned gate_idx = n / N; + unsigned gate_off = n % N; + DATA temp; + + if (gate_idx != 2) { + temp = sigmoid(gate[gate_idx][gate_off]); + gate[gate_idx][gate_off] = temp; + } + else { + temp = tanh(gate[gate_idx][gate_off]); + gate[gate_idx][gate_off] = temp; + } + } + + LOOP_DMEM: + for (unsigned n = 0; n < N; n++) { + DATA cell; + DATA cell_pre; + DATA hidden; + unsigned idx = n / DATA_PER_WORD; + unsigned offset = n % DATA_PER_WORD; + cell_pre(15,0) = dmem[(layer_idx+1)*2][idx]((offset+1)*16-1, (offset)*16); + // ML: new cell state + cell = gate[1][n] * cell_pre + gate[0][n]*gate[2][n]; + hidden = gate[3][n] * tanh(cell); + dmem[(layer_idx+1)*2][idx]((offset+1)*16-1, offset*16) = cell(15,0); + dmem[(layer_idx+1)*2 - 1][idx]((offset+1)*16-1, offset*16) = hidden(15,0); + } + + + } + + + //t_dense.stop(); +} + +","C++" +"RNN","MinLiAmoy/rnn-fpga","cpp/accel/accel_test_random.cpp",".cpp","2553","99","#include +#include + +#include ""Accel.h"" +#include ""AccelSchedule.h"" +#include ""AccelTest.h"" + +// used to generate test data +unsigned simple_hash(unsigned x) { + unsigned temp = (((x)*(x+3)*(x+11)) % 47); + return temp ^ (temp >> 2) ^ (temp >> 4) ^ (temp >> 6) & 1; +} + +//------------------------------------------------------------------------ +// Helper test function for the accelerator, random data +//------------------------------------------------------------------------ +void test_conv_layer_random( + const unsigned S, + Word* wt, + Word* kh +) { + const unsigned M = CONVOLVERS*PIX_PER_PHASE / (S*S); + + // Generate the input data + assert (M*S*S <= DMEM_WORDS*WORD_SIZE); + Word* data_i = (Word*) MEM_ALLOC( DMEM_WORDS * sizeof(Word) ); + for (unsigned m = 0; m < M; ++m) { + for (unsigned r = 0; r < S; ++r) { + for (unsigned c = 0; c < S; ++c) { + set_bit(data_i, m*S*S+r*S+c, simple_hash(m*S*S+r*S+c)); + } } } + + assert (S*S <= DMEM_O_WORDS*WORD_SIZE); + Word* data_o = (Word*) MEM_ALLOC( DMEM_O_WORDS * sizeof(Word) ); + + DB(2, + printf (""*data*:\n""); + print_bits3d(data_i, 0, 2, S, 8,S); + printf (""*params*:\n""); + print_bits3d(wt, 0, 2, K, K,K); + ); + + // Compute conv reference + Word conv_ref[S*S]; + padded_conv(data_i, wt, conv_ref, M, S); + // Compute bin reference + Word khword = kh[0]; + NormComp nc; nc(15,0) = khword(15,0); + Word bin_ref[S*S]; + for (unsigned i = 0; i < S*S; ++i) { + Bit b = (conv_ref[i] < nc) ? -1 : 0; + set_bit(bin_ref, i, b); + } + + test_conv_layer( + wt, kh, data_i, data_o, conv_ref, bin_ref, + M, 1, S + ); + + MEM_FREE( data_i ); + MEM_FREE( data_o ); +} + +//------------------------------------------------------------------------ +// Main +//------------------------------------------------------------------------ +int main() { + const unsigned N = 1; + + Word* wt = new Word[WT_WORDS]; + Word* kh = new Word[KH_WORDS]; + + // initialize the kernel weights + for (unsigned m = 0; m < WT_WORDS; ++m) { + for (unsigned i = 0; i < WORD_SIZE; ++i) + set_bit(wt, m*WORD_SIZE+i, simple_hash(m*WORD_SIZE+i)); + } + // initialize the batch-norm params + for (unsigned n = 0; n < N; ++n) { + NormComp nc = 10 + 10*n; + + int off = n % KH_PER_WORD; + + Word w = kh[n/KH_PER_WORD]; + w((off+1)*16-1, off*16) = nc(15,0); + kh[n/KH_PER_WORD] = w; + } + + test_conv_layer_random( 8, wt, kh); + test_conv_layer_random(16, wt, kh); + test_conv_layer_random(32, wt, kh); + + delete[] wt; + delete[] kh; + + printf (""Tests passed!\n""); + return 0; +} +","C++" +"RNN","MinLiAmoy/rnn-fpga","cpp/accel/parse_vivado.py",".py","8152","279","#!/usr/bin/env python + +import os, re, glob, sys +import xml.etree.ElementTree as ET + +#------------------------------------------------------------------------- +# Helper functions +#------------------------------------------------------------------------- +# get all the immediate directories +def get_immediate_subdirs(dir): + return filter(os.path.isdir, [os.path.join(dir,f) for f in os.listdir(dir)]) + +# Safely change directories. Uncommet prints for debugging +def changedir(dir): + #print >>sys.stderr, ""Entering"", dir + if not os.path.exists(dir): + #print >>sys.stderr, ""Path"", dir, ""does not exist"" + return 0 + os.chdir(dir) + return 1 + +# Find text on an xml node +def find_text(node, string): + newnode = node.find(string) + if not newnode is None: + return newnode.text + else: + #print >>sys.stderr, ""Could not find"", string + return ""-not found-"" + +#------------------------------------------------------------------------- +# Parse resource +#------------------------------------------------------------------------- +def parse_impl_xml(file): + tree = ET.parse(file) + root = tree.getroot() + + # area report + area_report = root.find(""AreaReport"") + resources = area_report.find(""Resources"") + slice = resources.find(""SLICE"").text + lut = resources.find(""LUT"").text + ff = resources.find(""FF"").text + srl = resources.find(""SRL"").text + bram = resources.find(""BRAM"").text + dsp = resources.find(""DSP"").text + + # timing report + timing_report = root.find(""TimingReport"") + target_cp = timing_report.find(""TargetClockPeriod"").text + actual_cp = timing_report.find(""AchievedClockPeriod"").text + + return dict([(""Slice"",slice), (""LUT"",lut), (""FF"",ff), \ + (""SRL"",srl), (""BRAM"",bram), (""DSP"",dsp), \ + (""Target-CP"",target_cp), (""Actual-CP"",actual_cp)]) + +def parse_impl(): + TopLevel = os.getcwd() + res_dir = ""impl/report/verilog/"" + if not changedir(res_dir): + print >>sys.stderr, ""**** Cannot find"", res_dir, ""in"", TopLevel + return 0 + + files = glob.glob(""*.xml"") + if len(files) != 1: + files.sort(key=len) + #print >>sys.stderr, ""Found"", len(files), ""xml files in"" + #print >>sys.stderr, ""\t"", TopLevel++""/""+res_dir + #print >>sys.stderr, ""expected 1"" + #return 0 + + print ""Parsing"", files[0] + results = parse_impl_xml(files[0]) + os.chdir(TopLevel) + return results + +#------------------------------------------------------------------------- +# Parse resource +#------------------------------------------------------------------------- +def parse_syn_xml(file): + tree = ET.parse(file) + root = tree.getroot() + + name = root.find(""UserAssignments"").find(""TopModelName"").text + ver = root.find(""ReportVersion"").find(""Version"").text + device = root.find(""UserAssignments"").find(""Part"").text + summary = root.find(""PerformanceEstimates"").find(""SummaryOfOverallLatency"") + # these may not exist if design is not pipelined + avg_lat = find_text(summary,""Average-caseLatency"") + worst_lat = find_text(summary,""Worst-caseLatency"") + actual_II = find_text(summary,""PipelineInitiationInterval"") + depth = find_text(summary,""PipelineDepth"") + + timing = root.find(""PerformanceEstimates"").find(""SummaryOfTimingAnalysis"") + period = timing.find(""EstimatedClockPeriod"").text + + res = root.find(""AreaEstimates"").find(""Resources"") + lut = res.find(""LUT"").text + ff = res.find(""FF"").text + bram = res.find(""BRAM_18K"").text + + return dict([(""Name"",name), (""Version"",ver), (""Device"",device), \ + (""Avg-Lat"",avg_lat), (""Worst-Lat"",worst_lat), (""Actual-II"",actual_II), (""Depth"",depth), \ + (""Est-CLK"",period), (""Est-LUT"",lut), (""Est-FF"",ff), (""Est-BRAM"",bram)]) + +def parse_syn(): + TopLevel = os.getcwd() + dir = ""syn/report/"" + if not changedir(dir): + print >>sys.stderr, ""**** Cannot find"", dir, ""in"", TopLevel + return 0 + + files = glob.glob(""*.xml"") + if len(files) != 1: + if re.match("".*\/rs"", TopLevel): + files = [""rs_decode_csynth.xml""] + else: + files.sort(key=len) + #print >>sys.stderr, ""Found"", len(files), ""xml files in"" + #print >>sys.stderr, ""\t"", TopLevel+""/""+dir + #print >>sys.stderr, ""expected 1"" + #return 0 + + print ""Parsing"", files[0] + results = parse_syn_xml(files[0]) + os.chdir(TopLevel) + return results + +#------------------------------------------------------------------------- +# Parse sim +#------------------------------------------------------------------------- +def parse_sim(soln_dir): + TopLevel = os.getcwd() + dir = ""sim/report/"" + if not changedir(soln_dir+""/""+dir): + print >>sys.stderr, ""**** Cannot find"", dir, ""in"", TopLevel+""/""+soln_dir + return 0 + + files = glob.glob(""*cosim.rpt"") + if len(files) != 1: + files.sort(key=len) + + print ""Parsing"", files[0] + f = open(files[0], 'r') + data = [] + + for line in f: + if re.match(""\|\W+Verilog\|\W+Pass\|"", line): + m = re.search(""\|\W+(\d+)\|\W+(\d+)\|\W+(\d+)\|"", line) + if m: + data = [m.group(1), m.group(2), m.group(3)] + + f.close() + + if len(data) == 0: + print ""Cannot find Verilog sim results"" + os.chdir(TopLevel) + return data + +#------------------------------------------------------------------------- +# Parse both the impl report and the syn report +#------------------------------------------------------------------------- +def parse_impl_and_syn(soln_dir): + SolnLevel = os.getcwd() + data = dict([]) + success = False + + if changedir(soln_dir): + # parse the syn xml file + syn = parse_syn() + if syn: + data = dict(data.items()+syn.items()) + success = True + + # parse the impl xml file + impl = parse_impl() + if impl: + data = dict(data.items()+impl.items()) + success = True + + cosim = parse_sim + + else: + print >>sys.stderr, ""Cannot find solution"", soln_dir + return 0 + + os.chdir(SolnLevel) + + if not success: + return 0 + return data; + +#------------------------------------------------------------------------- +# Function to process a single HLS project directory +#------------------------------------------------------------------------- +def process_project(prj_dir): + TopLevel = os.getcwd() + + # enter the project directory + if not changedir(prj_dir): + print >>sys.stderr, ""Cannot find project"", prj_dir + exit(-1) + + # search for solution subdirs + solutions = get_immediate_subdirs('.') + + # for each solution, parse the data + for sol in solutions: + data = parse_impl_and_syn(sol) + sdata = parse_sim(sol) + + if data: + print ""\nSolution: "", sol + print_data(data) + + if sdata: + print ""\n** Sim. Report **"" + print ""Min:"", sdata[0] + print ""Avg:"", sdata[1] + print ""Max:"", sdata[2] + + os.chdir(TopLevel) + +#------------------------------------------------------------------------- +# Print dictionary data +#------------------------------------------------------------------------- +def print_dict(d, key): + if key in d: + print ""%-12s: %-30s"" % (key, d[key]) + else: + print ""%-12s: %-30s"" % (key, ""-not found-"") + +def print_data(d): + print ""** Syn. Report **"" + print_dict(d, ""Name"") + print_dict(d, ""Version"") + print_dict(d, ""Device"") + print_dict(d, ""Avg-Lat"") + print_dict(d, ""Worst-Lat"") + print_dict(d, ""Actual-II"") + print_dict(d, ""Depth"") + print_dict(d, ""Est-CLK"") + print_dict(d, ""Est-LUT"") + print_dict(d, ""Est-FF"") + print_dict(d, ""Est-BRAM"") + print """" + print ""** Impl. Report **"" + print_dict(d, ""Target-CP"") + print_dict(d, ""Actual-CP"") + print_dict(d, ""Slice"") + print_dict(d, ""LUT"") + print_dict(d, ""FF"") + print_dict(d, ""SRL"") + print_dict(d, ""BRAM"") + print_dict(d, ""DSP"") + +#------------------------------------------------------------------------- +# Main function +#------------------------------------------------------------------------- +def main(): + if len(sys.argv) == 1: + print >>sys.stderr, ""Usage: parse_vivado.py "" + else: + dir = sys.argv[1] + process_project(dir) + print """" + +if __name__ == ""__main__"": + main() + +#print >>sys.stderr, ""Current directory: "", os.getcwd(), ""\n"" +#print ""name,"", ""version,"", ""device,"" +#print ""target_cp\t"", ""actual_cp\t"", ""latency\t"", \ +# ""slice\t"", ""lut\t"", ""ff\t"", ""srl\t"" \ +# ""binvars\t"", ""intvars\t"", ""constraints\t"", ""runtime(s)\t"" + +#Dirs = get_immediate_subdirs(""."") + +","Python" +"RNN","MinLiAmoy/rnn-fpga","cpp/accel/Accel.cpp",".cpp","31234","864","#include +#include +#include +#include ""Accel.h"" +//#include ""AccelPrint.h"" + +const static Word m1(""0x5555555555555555"", 16); +const static Word m2(""0x3333333333333333"", 16); +const static Word m4(""0x0f0f0f0f0f0f0f0f"", 16); +const static Word h01(""0x0101010101010101"", 16); + +// ----------------------------------------------------------------------- +// Hardware-specific print helpers +// ----------------------------------------------------------------------- +/*template +void print_ap_bits(const T& in, const unsigned W) { + printf ("" ""); + for (unsigned i = 0; i < W; ++i) + printf (""%3d"", in[i] ? -1 : 0); + printf (""\n""); +} + +template +void print_params(T params[CONVOLVERS][K][K]) { + for (unsigned m = 0; m < CONVOLVERS; ++m) { + for (unsigned wr = 0; wr < K; ++wr) { + for (unsigned wc = 0; wc < K; ++wc) { + printf (""%3d"", (params[m][wr][wc]==0) ? 0 : 1); + } + printf(""\n""); + } + printf(""--\n""); + } +} + +template +void print_line_buffer_m(T lbuf[CONV_BANKS]) { + for (unsigned wr = 0; wr < CONV_ROWS; ++wr) { + for (unsigned bank = 0; bank < CONV_BANKS; ++bank) { + for (unsigned wc = 0; wc < CONV_COLS; ++wc) { + printf (""%3d"", lbuf[bank][wr][wc].to_int()); + } + printf ("" |""); + } + printf (""\n""); + } +} + +TwoBit encode_bit(const Bit& b) { + return (b == 0) ? TwoBit(1) : TwoBit(-1); +} + +// ----------------------------------------------------------------------- +// Conv +// ----------------------------------------------------------------------- +ConvOut conv3x3b( + const TwoBit line_buffer_m[CONV_BANKS][CONV_ROWS][CONV_COLS], + const Bit conv_params_m[K][K], + const ap_uint<4> bank, + const IdxType cc +) { + ConvOut sum = 0; + for (ap_uint<2> kr = 0; kr < K; ++kr) { + for (ap_uint<2> kc = 0; kc < K; ++kc) { + TwoBit data = line_buffer_m[bank][kr][cc+kc]; // ML: the conv kernal is reversed! + const Bit& wt = conv_params_m[2-kr][2-kc]; + data[1] = (wt & data[0]) ^ data[1]; + sum += data; + } + } + return sum; +} + +// ----------------------------------------------------------------------- +// Produce 32 elements of conv results +// ----------------------------------------------------------------------- +// ML: remember the basic atom of processing is a word! +void conv_word( + const TwoBit line_buffer_m[CONV_BANKS][CONV_ROWS][CONV_COLS], + const Bit conv_params_m[K][K], + ConvOut conv_out_buffer_m[WORD_SIZE] // ML: typedef ap_int<5> ConvOut +) { + for (ap_uint<4> bank = 0; bank < CONV_BANKS; ++bank) { + for (ap_uint<4> cc = 0; cc < BANK_WIDTH; ++cc) { + conv_out_buffer_m[bank*BANK_WIDTH+cc] = conv3x3b( line_buffer_m, conv_params_m, bank, cc ); + } + } +} + +// ----------------------------------------------------------------------- +// Process each line in a word, we need to outline this loop to +// avoid false control dependencies in Vivado HLS +// ----------------------------------------------------------------------- +void process_word( + const TwoBit word_buffer_m[CONV_BANKS][CONV_COLS], + const TwoBit old_word_buffer_m[CONV_BANKS][CONV_COLS], + const bool lb[CONV_BANKS], + const bool rb[CONV_BANKS], + TwoBit line_buffer_m[CONV_BANKS][CONV_ROWS][CONV_COLS], + const Bit conv_params_m[K][K], + ConvOut conv_out_buffer_m[WORD_SIZE], + const ap_uint<3> log_width, + const ap_uint<6> words_per_image, + const IdxType wrd +) { + // slices_per_line = width / BANK_WIDTH + const ap_uint<5> slices_per_line = 1 << (log_width - LOG_BANK_WIDTH); + const bool first_wrd = (wrd == 0); + const bool last_wrd = (wrd == words_per_image); + DB_PRINT(4, ""process word %d, spl=%d\n"", wrd.to_int(), slices_per_line.to_int()); + + // Prologue + // Update bottom row, slices are shifted left. Some slices copied from previous word (middle row) + // ML: it's the bit sel mudule mentioned in the paper + for (ap_uint<4> bank = 0; bank < CONV_BANKS; ++bank) { // ML: in this case CONV_BANKS equals 8! + ap_int<6> s_idx = bank + slices_per_line - CONV_BANKS; + if (s_idx < 0) { + // set to zero or copy from old word (middle row) // ML: copy from the middle row! + for (ap_uint<4> cc = 1; cc < CONV_COLS-1; ++cc) { + line_buffer_m[bank][CONV_ROWS-1][cc] = old_word_buffer_m[CONV_BANKS+s_idx][cc]; + } + line_buffer_m[bank][CONV_ROWS-1][0 ] = lb[bank] ? TwoBit(0) : old_word_buffer_m[CONV_BANKS+s_idx][0]; + line_buffer_m[bank][CONV_ROWS-1][CONV_COLS-1] = rb[bank] ? TwoBit(0) : old_word_buffer_m[CONV_BANKS+s_idx][CONV_COLS-1]; + } else { + // fill from new word + for (ap_uint<4> cc = 1; cc < CONV_COLS-1; ++cc) { + line_buffer_m[bank][CONV_ROWS-1][cc] = (last_wrd) ? TwoBit(0) : word_buffer_m[s_idx][cc]; // ML: update the bottom row!! the last row of line_buffer_m[] + } + line_buffer_m[bank][CONV_ROWS-1][0 ] = (last_wrd || lb[bank]) ? TwoBit(0) : word_buffer_m[s_idx][0]; + line_buffer_m[bank][CONV_ROWS-1][CONV_COLS-1] = (last_wrd || rb[bank]) ? TwoBit(0) : word_buffer_m[s_idx][CONV_COLS-1]; + } + } + + DB(4, + printf(""Accel lbuf wrd%d before conv:\n"", wrd.to_int()); + print_line_buffer_m(line_buffer_m); + ); + + // Convolution + conv_word( line_buffer_m, conv_params_m, conv_out_buffer_m ); + + // Update + // Fill line buffer with lines from the new word + // ML: update stadegy, referring to the fig3. in the paper! + for (ap_uint<4> bank = 0; bank < CONV_BANKS; ++bank) { + // -------------------------------------------------------------- + // Top row, slices are shifted right by slices_per_line + ap_int<6> s_idx0 = bank - slices_per_line; + if (s_idx0 >= 0) { + // slice from input word + for (ap_uint<4> cc = 1; cc < CONV_COLS-1; ++cc) { + line_buffer_m[bank][0][cc] = word_buffer_m[s_idx0][cc]; + } + line_buffer_m[bank][0][0 ] = lb[bank] ? TwoBit(0) : word_buffer_m[s_idx0][0]; + line_buffer_m[bank][0][CONV_COLS-1] = rb[bank] ? TwoBit(0) : word_buffer_m[s_idx0][CONV_COLS-1]; + } else { + // set to zero or copy from old word (middle row) + for (ap_uint<4> cc = 1; cc < CONV_COLS-1; ++cc) { + line_buffer_m[bank][0][cc] = (first_wrd) ? TwoBit(0) : old_word_buffer_m[CONV_BANKS+s_idx0][cc]; + } + line_buffer_m[bank][0][0 ] = (first_wrd || lb[bank]) ? TwoBit(0) : old_word_buffer_m[CONV_BANKS+s_idx0][0]; + line_buffer_m[bank][0][CONV_COLS-1] = (first_wrd || rb[bank]) ? TwoBit(0) : old_word_buffer_m[CONV_BANKS+s_idx0][CONV_COLS-1]; + } + + // -------------------------------------------------------------- + // Middle row, simply copy the word into the line buffer + for (ap_uint<4> cc = 1; cc < CONV_COLS-1; ++cc) { + line_buffer_m[bank][1][cc] = word_buffer_m[bank][cc]; + } + // Fill end buffer bits + line_buffer_m[bank][1][0 ] = lb[bank] ? TwoBit(0) : word_buffer_m[bank][0]; + line_buffer_m[bank][1][CONV_COLS-1] = rb[bank] ? TwoBit(0) : word_buffer_m[bank][CONV_COLS-1]; + } + + DB(4, + printf(""Accel lbuf wrd%d after conv:\n"", wrd.to_int()); + print_line_buffer_m(line_buffer_m); + ); +} + +// ----------------------------------------------------------------------- +// A single PE reads from all inputs and weights to generate a single +// output feature map. +// * Make sure this function gets inlined by VHLS, or cosim may fail! +// ----------------------------------------------------------------------- +void bin_conv( + Word wt_mem[CONVOLVERS][C_WT_WORDS], + NormComp nc, + Word dmem[2][CONVOLVERS][C_DMEM_WORDS], // ML: one of dmem is the input, one of dmen is the output, depend on the d_i_idx and d_o_idx + ap_uint<1> d_i_idx, + ap_uint<1> d_o_idx, + const unsigned n_inputs, + const Address o_index, + const ap_uint<1> new_batch, + const ap_uint<2> width_mode, // 0=8'b, 1=16'b, 2=32'b + const ap_uint<2> norm_mode // 0='do nothing', 1='do norm', 2='do pool' +) { + const ap_uint<3> log_width = width_mode + LOG_BANK_WIDTH; + const ap_uint<5> words_per_image = 1 << (2*width_mode); + const unsigned n_phases = n_inputs / CONVOLVERS; + const unsigned images_per_phase = PIX_PER_PHASE >> (2*log_width); + const unsigned WORDS_PER_PHASE = PIX_PER_PHASE / WORD_SIZE; + + assert(n_phases % images_per_phase == 0); + assert(n_inputs % images_per_phase == 0); + assert(images_per_phase*words_per_image == WORDS_PER_PHASE); + + // --------------------------------------------------------------------- + // buffers + // --------------------------------------------------------------------- + TwoBit line_buffer[CONVOLVERS][CONV_BANKS][CONV_ROWS][CONV_COLS]; + Bit conv_params[CONVOLVERS][K][K]; + ConvSum fixed_buffer[WORDS_PER_PHASE][WORD_SIZE]; + ConvSum fixed_temp[WORD_SIZE]; + // per-convolver buffers + TwoBit word_buffer[CONVOLVERS][CONV_BANKS][CONV_COLS]; + TwoBit old_word_buffer[CONVOLVERS][CONV_BANKS][CONV_COLS]; + ConvOut conv_out_buffer[CONVOLVERS][WORD_SIZE]; + // edge padding flag bits + bool lb[CONV_BANKS]; + bool rb[CONV_BANKS]; + + static Address wt_addr = 0; // address of weight word + static ap_uint<3> wt_offset = 0; // offset 0..6 of param + if (new_batch != 0) { wt_addr = 0; wt_offset = 0; } + + // --------------------------------------------------------------------- + // Calculate edge padding flag bits + // ML: assume the width is 32, then the slice is 4, so the 1st, 5th bank shoud the flagged lb + // ML: the 4th, and 8th shoud be flagged rb + const ap_uint<4> log_slice = log_width - LOG_BANK_WIDTH; // ML: if width = 32, then log_slice = 4 + const ap_uint<4> w_div_8 = (1 << log_width) >> 3; + assert (w_div_8 > 0); // ML: make sure that width >= 8 + ap_uint<4> mask = ~ap_uint<4>(0); // set mask to all 1s + mask = mask >> (4-log_slice); + for (ap_uint<4> bank = 0; bank < CONV_BANKS; ++bank) { + #pragma HLS unroll + const ap_uint<4> x = bank & mask; + lb[bank] = (x == 0); // (bank % w_div_8) == 0 + rb[bank] = (x+1 == w_div_8); // (bank % w_div_8) == w_div_8-1 + } + + // --------------------------------------------------------------------- + // Reset conv buffer + for (IdxType i = 0; i < WORDS_PER_PHASE; ++i) { + for (IdxType j = 0; j < WORD_SIZE; ++j) { + #pragma HLS UNROLL + fixed_buffer[i][j] = 0; + } + } + + // --------------------------------------------------------------------- + // Compute in phases + // Each phase processes CONVOLVERS * WORDS_PER_PHASE input words + // --------------------------------------------------------------------- + LOOP_PHASES: + for (ap_uint<10> p = 0; p < n_phases; p += images_per_phase) { + DB(3, printf (""=== PHASE %d ===\n"", p.to_int()) ); + + // wrd = which word in the current image + // wrd_phase = which wrd in the current phase + ap_uint<8> wrd = 0; + ap_uint<8> wrd_phase = 0; + + // Load a word each iteration, and then process it + // We load WORDS_PER_PHASE words per phase, however we also need 1 extra ""empty"" + // iteration per image in the phase to do the loop epilogue, so the loop bound + // is WORDS_PER_PHASE + images_per_phase + LOOP_WORDS_IN_PHASE: + for (ap_uint<8> count = 0; count < WORDS_PER_PHASE+images_per_phase; ++count) { + // First word of an image + if (wrd == 0) { + Word wt_word_buffer[CONVOLVERS]; + + // ------------------------------------------------------------------- + // Load param word + // Each word contains CONV_W_PER_WORD weight filters, after we use + // them all we should load the next word + // ------------------------------------------------------------------- + LOOP_WT_WORDS: + for (IdxType m = 0; m < CONVOLVERS; ++m) { + /*if (wt_offset == 0) + wt_word_buffer[m] = wt_mem[m][wt_addr]; + else + wt_word_buffer[m] = wt_word_buffer[m] >> WT_SIZE; + + wt_word_buffer[m] = wt_mem[m][wt_addr] >> ap_uint<6>(WT_SIZE*wt_offset); + } + if (wt_offset == CONV_W_PER_WORD-1) { + ++wt_addr; + wt_offset = 0; + } else { + ++wt_offset; + } + // ML: load weight from wt_mem. everytime load 2 3*3weight to wt_word_buffer + //print_wt_word(wt_word_buffer[0]); + + // ------------------------------------------------------------------- + // Load params + // Each word contains CONV_W_PER_WORD weight filters packed into the first + // 63 bits, the last bit is unused. Wts are stored in output-major order. + // ------------------------------------------------------------------- + LOOP_LOAD_WTS: + for (IdxType m = 0; m < CONVOLVERS; ++m) { + for (ap_uint<2> kr = 0; kr < K; ++kr) { + for (ap_uint<2> kc = 0; kc < K; ++kc) + conv_params[m][kr][kc] = wt_word_buffer[m][kr*K+kc]; + } + } + + DB(3, print_params(conv_params) ); + } + + // ------------------------------------------------------------------- + // Every word in an image + // ------------------------------------------------------------------- + // Load word + // (wrd_phase-wrd) is which wrd in the current phase, aligned to img boundary + if (wrd != words_per_image) { + LOOP_CONVOLVER_LOAD: + for (IdxType m = 0; m < CONVOLVERS; ++m) { + Word word = dmem[d_i_idx][m][p*words_per_image + wrd_phase]; + for (IdxType bank = 0; bank < CONV_BANKS; ++bank) { + for (IdxType cc = 0; cc < CONV_COLS-2; ++cc) { + word_buffer[m][bank][cc+1] = encode_bit(word[ap_uint<6>(bank*BANK_WIDTH+cc)]); + } + word_buffer[m][bank][0 ] = (bank==0) ? + TwoBit(0) : encode_bit(word[ap_uint<6>(bank*BANK_WIDTH-1)]); + word_buffer[m][bank][CONV_COLS-1] = (bank==CONV_BANKS-1) ? + TwoBit(0) : encode_bit(word[ap_uint<6>(bank*BANK_WIDTH+BANK_WIDTH)]); + // ML: because the CONV_BANKS = bank_width+2, so have to add 2 bit. right now dont have to consider padding 0 + // ML: have been consider when construct the line buffer + } + } + } + + // Compute + LOOP_CONVOLVERS: + for (IdxType m = 0; m < CONVOLVERS; ++m) { + // Do the following for each word in an image + process_word( word_buffer[m], old_word_buffer[m], lb, rb, line_buffer[m], conv_params[m], + conv_out_buffer[m], log_width, words_per_image, wrd ); + } // CONVOLVERS + + for (IdxType m = 0; m < CONVOLVERS; ++m) { + for (IdxType bank = 0; bank < CONV_BANKS; ++bank) { + for (IdxType cc = 0; cc < CONV_COLS; ++cc) { + old_word_buffer[m][bank][cc] = word_buffer[m][bank][cc]; + } } + } // ML: copy the word_buffer to old_word_buffer. when word is the fist or the last word of image, the situation is special + + // ------------------------------------------------------------------- + // Sum results across convolvers + // ------------------------------------------------------------------- + for (IdxType i = 0; i < WORD_SIZE; ++i) { + // Ignore conv results after processing the first word + if (wrd > 0) { + ConvSum s = 0; // ML: s sets to 0 every cycle + for (IdxType m = 0; m < CONVOLVERS; ++m) + s += conv_out_buffer[m][i]; + fixed_buffer[wrd_phase-1][i] += s; // ML: add two conv out from different Convolvers to fixed_buffer! + } + } + + // ------------------------------------------------------------------- + // Increment counters + // ------------------------------------------------------------------- + if (wrd != words_per_image) { + wrd++; + wrd_phase++; + } else { + wrd = 0; + } + } // wrd_phase = 0 .. WORDS_PER_PHASE + + } // n_phases + + LOOP_ACC_PHASES: + for (ap_uint<5> w = 0; w < words_per_image; ++w) { + for (IdxType b = 0; b < WORD_SIZE; ++b) { + #pragma HLS unroll + fixed_temp[b] = fixed_buffer[w][b]; + } + + LOOP_ACC_PHASES_I: + for (ap_uint<8> i = words_per_image; i < WORDS_PER_PHASE; i += words_per_image) { + for (IdxType b = 0; b < WORD_SIZE; ++b) { + fixed_temp[b] += fixed_buffer[w+i][b]; + } } + + for (IdxType b = 0; b < WORD_SIZE; ++b) { + #pragma HLS unroll + fixed_buffer[w][b] = fixed_temp[b]; // now fixed_buffer[w][b]'w range 0 to words_per_image, which is reasonable! + } + } + + const Address bank_idx = o_index % CONVOLVERS; + const Address bank_off = o_index / CONVOLVERS; + const ap_uint<5> pool_width = 1 << (log_width-1); + DB(4, + unsigned width = 1 << log_width; + printf (""=== conv result ===\n""); + print_mat(fixed_buffer[0], width, 8, width); + ); + DB_PRINT(2, "" o_idx=%3d: nc=%6d\n"", o_index.to_int(), nc.to_int()); + + static Word outword; + Word poolword; + LOOP_BATCH_NORM: + for (ap_uint<6> w = 0; w < words_per_image; ++w) { + Word binword; + Address o_bank_idx = bank_idx; + Address o_bank_offset = bank_off*words_per_image + w; + const ap_uint<6> out_offset = (w % 4) << 4; + + for (ap_uint<7> i = 0; i < WORD_SIZE; ++i) { + binword[i] = (fixed_buffer[w][i] >= nc) ? 0 : 1; // ML: find out what is nc? + } + + if (norm_mode == 1) { + outword = binword; + } + else if (norm_mode == 2) { + // horizontal pooling first + ap_int poolword_h; + for (ap_uint<6> i = 0; i < WORD_SIZE/2; ++i) { + poolword_h[i] = binword[2*i] & binword[2*i+1]; + } + + // vertical pooling + for (ap_uint<6> i = 0; i < WORD_SIZE/4; ++i) { + // source indices + ap_uint<5> i0 = i >> (log_width-1); + i0 = (i0 << log_width) + i(log_width-2,0); + ap_uint<5> i1 = i0 + pool_width; + // dest index + ap_uint<6> d0 = out_offset + i; + poolword[d0] = poolword_h[i0] & poolword_h[i1]; + } + + // For log_width > 3 we can just assign the word, but log_width = 3 means width = 8, + // which means pooled width = 4, which is only 16 bits, which is less than 1 Word. + // So each time we get here we only have 16 bits, meaning we have to accumulate four + // of these 16-bit batches before writing a word out. + if (log_width != LOG_BANK_WIDTH) { + o_bank_offset /= 4; + outword = poolword; + } else { + outword = outword >> WORD_SIZE/4; + outword(63,48) = poolword(15,0); + o_bank_idx = (o_index/4)%CONVOLVERS; + o_bank_offset = (o_index/4)/CONVOLVERS; + } + } + + dmem[d_o_idx][o_bank_idx][o_bank_offset] = outword; // ML: this three idex dont understand + } +} + +// ----------------------------------------------------------------------- +// Module to do the first conv layer +// ----------------------------------------------------------------------- +void fp_conv( + Word wt_mem[CONVOLVERS][C_WT_WORDS], + Word kh_mem[KH_WORDS], + Word dmem[2][CONVOLVERS][C_DMEM_WORDS], + ap_uint<1> d_i_idx, + ap_uint<1> d_o_idx, + const Address kh_index, + const Address o_index, + const unsigned N // ML: N supposed to be 128 which is num of output fmaps +) { + const unsigned M = 3; + const unsigned S = 32; //supposed to be the num of column of input images + const unsigned OUTWORDS = 16; // words per output image // ML: 32*32/64 = 16 + + C1InputType win[M][K][K]; + C1InputType lbuf[M][K-1][S]; + Word outwords[OUTWORDS]; + WtType wtbuf[M]; // ML: WtType ... ap_int<9> + + Address wt_offset = 0; + ap_uint<3> wt_addr = 0; + + // Parallelized across m, better for HLS + LOOP_FP_CONV_O: + for (IdxType n = 0; n < N; ++n) { + // ML: for every cycle, output a single fmaps + // clear linebuffers for each new output map + LOOP_RESET_LINEBUFFERS: + for (IdxType m = 0; m < M; ++m) { + PROLOG_COLS: for (IdxType c = 0; c < S; ++c) { + PROLOG_ROWS: for (IdxType r = 0; r < K/2; ++r) { + for (IdxType lr = 0; lr < K-2; ++lr) { + lbuf[m][lr][c] = lbuf[m][lr+1][c]; // ML: in case of K equals 3, just copy lbuf[m][1][c]-> lbuf[m][0][c] + } + lbuf[m][K-2][c] = 0; + } } + } + + // The weights for the 1st conv layer are just laid out + // linearly across wt_mem, 3 weights per 64-bit word + // ML: is very important that a 64-bit word contains 3 9-bit weights, which means only 0-26 bit in wt-mem has value + DB_PRINT(3, ""n = %u\n"", n.to_int()); + Word wt_word = wt_mem[n % CONVOLVERS][n / CONVOLVERS]; + LOOP_LOAD_WTS: + for (ap_uint<2> m = 0; m < M; ++m) { + wtbuf[m] = wt_word((m+1)*WT_SIZE-1, m*WT_SIZE); // ML: dont see the opo wt_word(), seems like copy. + DB(3, print_wt(wtbuf[m])); + DB(3, printf(""--\n"")); + } + + // load batch norm params + C1Comp nc; + load_kh(nc, kh_mem, (kh_index+n)); + //printf ("" n=%3d, nc=%6.3f\n"", n.to_int(), nc.to_float()); + + // begin convolution + LOOP_CONV_ROWS: for (IdxType r = 0; r < S+1; ++r) { + LOOP_CONV_COLS: for (IdxType c = 0; c < S+1; ++c) { + // load input word + Word inword = 0; + if (r < S && c < S) { + const Address addr = r*S + c; + inword = dmem[d_i_idx][addr/C_DMEM_WORDS][addr%C_DMEM_WORDS]; + } + + for (ap_uint<2> m = 0; m < M; ++m) { + // load data: the value of pix is either the pixel at [r,c] + // 0 -> +1, -1 -> -1 + // or -> 0 for padding around the boundaries + C1InputType pix; + const unsigned W = pix.length(); + pix(W-1,0) = inword(W-1+m*W, m*W); + + // window: shift left, leaving rightmost col for new data + for (IdxType wr = 0; wr < K; ++wr) { + for (IdxType wc = 0; wc < K-1; ++wc) { + win[m][wr][wc] = win[m][wr][wc+1]; + } } + + // window: fill top K-1 pixels of rightmost column from lbuf + for (IdxType wr = 0; wr < K-1; ++wr) { + C1InputType val = (c != S) ? lbuf[m][wr][c] : C1InputType(0); + win[m][wr][K-1] = val; + } + + // window: fill bottom right with new input pixel + win[m][K-1][K-1] = pix; + + // lbuf: shift up column c + if (c != S) { + for (IdxType lr = 0; lr < K-2; ++lr) { + lbuf[m][lr][c] = lbuf[m][lr+1][c]; + } + lbuf[m][K-2][c] = pix; + } + } // m + + // only perform the conv and store if legal position + if (r > 0 && c > 0) { + C1ConvType res = 0; + for (ap_uint<2> m = 0; m < M; ++m) { + for (ap_uint<2> wr = 0; wr < K; ++wr) { + for (ap_uint<2> wc = 0; wc < K; ++wc) { + const C1InputType& pix = win[m][wr][wc]; + const Bit& b = wtbuf[m][8-(wr*K+wc)]; + res += (b==0) ? pix : (C1InputType)(-pix); + } } + } + + // perform normalization right here + outwords[(r-1)/2][((r-1)%2)*S + (c-1)] = + (res >= nc) ? Bit(0) : Bit(-1); + } + + } // CONV_COLS + } // CONV_ROWS + + // Here i is the word offset within the outwords buffer + LOOP_OUTPUT: + for (IdxType i = 0; i < OUTWORDS; ++i) { + Address img_idx = o_index+n; + Address bank_idx = img_idx % CONVOLVERS; + Address bank_off = img_idx / CONVOLVERS; + dmem[d_o_idx][bank_idx][bank_off*OUTWORDS + i] = outwords[i]; + } + } // n +} + +void bin_dense( + const Word wt_mem[CONVOLVERS][C_WT_WORDS], + const Word kh_mem[KH_WORDS], + Word dmem[2][CONVOLVERS][C_DMEM_WORDS], + ap_uint<2> layer_type, + ap_uint<1> d_i_idx, + ap_uint<1> d_o_idx, + const Address o_index, + const unsigned n_inputs, + const unsigned n_outputs +) { + //assert(n_outputs % WORD_SIZE == 0); + assert(layer_type == LAYER_DENSE || n_outputs == 10); + assert(n_inputs/WORD_SIZE % CONVOLVERS == 0); + + DenseSum sum_m[CONVOLVERS]; + // for last layer + DenseNorm best_out = -1024; + ap_int<8> prediction = -1; + + // read words from dmem and the wt store, dot them + // o is the output bit, i is the input bit + LOOP_DENSE_O: + for (Address o = 0; o < n_outputs; ++o) { + const Address o_addr = (o_index+o)/WORD_SIZE; + const ap_uint<6> o_offset = (o_index+o) % WORD_SIZE; + Word o_word = dmem[d_o_idx][o_addr%CONVOLVERS][o_addr/CONVOLVERS]; + + DenseSum sum = 0; + + LOOP_DENSE_I: + for (Address i = 0; i < n_inputs; i+=CONVOLVERS*WORD_SIZE) { + const Address wt_addr = (o*n_inputs+i) / WORD_SIZE; + + for (IdxType j = 0; j < CONVOLVERS; ++j) { + // in_wrd addr = [(i/WORD_SIZE+j) % CONVOLVERS][(i/WORD_SIZE+j) / CONVOLVERS] + // wt_wrd addr = [wt_addr % CONVOLVERS][wt_addr / CONVOLVERS] + const Word in_wrd = dmem[d_i_idx][j][i/WORD_SIZE/CONVOLVERS]; + const Word wt_wrd = wt_mem[j][wt_addr / CONVOLVERS]; + + Word x = wt_wrd ^ in_wrd; + + // count_set bit for 64 bits, returns 2*cnt + x -= (x >> 1) & m1; + x = (x & m2) + ((x >> 2) & m2); + x = (x + (x >> 4)) & m4; + x += x >> 8; + x += x >> 16; + x += x >> 32; + x = x & 0x7f; + + sum_m[j] = WORD_SIZE - (DenseSum)(x<<1); + } + + for (IdxType j = 0; j < CONVOLVERS; ++j) + sum += sum_m[j]; + } // n_inputs + + // not last layer -> biniarize, + // otherwise just store the value as a 64bit word + if (layer_type == LAYER_DENSE) { + Address kh_addr = o / KH_PER_WORD; + Word kh_word = kh_mem[kh_addr]; + + NormComp nc; + IdxType kh_off = o % KH_PER_WORD; + if (kh_off == 0) + nc(15,0) = kh_word(15, 0); + else if (kh_off == 1) + nc(15,0) = kh_word(31,16); + else if (kh_off == 2) + nc(15,0) = kh_word(47,32); + else + nc(15,0) = kh_word(63,48); + + o_word[o_offset] = (sum >= nc) ? 0 : 1; + } else { + Address kh_addr = o / (const unsigned)2; + Word kh_word = kh_mem[kh_addr]; + + KType ki; HType hi; + IdxType kh_off = o % 2; + if (kh_off == 0) { + ki(15,0) = kh_word(15, 0); + hi(15,0) = kh_word(31,16); + } else { + ki(15,0) = kh_word(47,32); + hi(15,0) = kh_word(63,48); + } + + //printf ("" >> %d * %f + %f\n"", sum.to_int(), ki.to_float(), hi.to_float()); + ap_fixed<20,10> out = ap_fixed<20,10>(sum)*ki + hi; + + if (o == 0 || out > best_out) { + prediction = o; + best_out = out; + } + } + + dmem[d_o_idx][o_addr%CONVOLVERS][o_addr/CONVOLVERS] = o_word; + } // n_outputs + + // Here we are using o_index as a bit index, not a word index! + if (layer_type == LAYER_LAST) { + Word o_word; + o_word(7,0) = prediction(7,0); + o_word(WORD_SIZE-1, 8) = 0; + dmem[d_o_idx][0][0] = o_word; + } +} + +// ----------------------------------------------------------------------- +// Accelerator top module +// ----------------------------------------------------------------------- +void top( + Word wt_i[WT_WORDS], + Word kh_i[KH_WORDS], + Word dmem_i[DMEM_WORDS], + Word dmem_o[DMEM_O_WORDS], + const Address n_inputs, + const Address n_outputs, + const Address input_words, + const Address output_words, + const ap_uint<3> layer_mode, // [0]='new layer', [2:1]='conv1,conv,dense,last' + const ap_uint<1> dmem_mode, // 0 means dmem[0] is input + const ap_uint<2> width_mode, // 0=8'b, 1=16'b, 2=32'b + const ap_uint<2> norm_mode // 0='do nothing', 1='do norm', 2='do pool' // *ML: norm_mode cant be zero? +) { + DB_PRINT(2, ""==== Entering Accel ====\n""); + const ap_uint<2> layer_type = layer_mode(2,1); + const unsigned width = 8 << width_mode; + DB_PRINT(1, "" Inputs = %d\n"", n_inputs.to_int()); + DB_PRINT(1, "" Outputs = %d\n"", n_outputs.to_int()); + DB_PRINT(1, "" i_words = %d\n"", input_words.to_int()); + DB_PRINT(1, "" o_words = %d\n"", output_words.to_int()); + DB_PRINT(1, "" Width = %d\n"", width); + DB_PRINT(1, "" layer_mode = %d %d\n"", layer_mode[0]==0 ? 0 : 1, layer_type.to_int()); + DB_PRINT(1, "" dmem_mode = %d\n"", dmem_mode.to_int()); + + assert(width <= MAX_WIDTH); + assert(n_inputs != 0); + if (layer_type <= LAYER_CONV) { + assert(input_words % CONVOLVERS == 0); + assert(n_inputs*width*width <= DMEM_WORDS*WORD_SIZE); + assert(n_inputs*WT_SIZE <= WT_WORDS*WORD_SIZE); + } + + static Word dmem[2][CONVOLVERS][C_DMEM_WORDS]; + static Word kh_mem[KH_WORDS]; + static Word wt_mem[CONVOLVERS][C_WT_WORDS]; + static Address kh_index = 0; + static Address o_index = 0; + + if (layer_mode[0]) { + kh_index = 0; + o_index = 0; + } else { + kh_index = kh_index[0]; + } + + ap_uint<1> d_i_idx = dmem_mode; + ap_uint<1> d_o_idx = ~dmem_mode; + + // Data input + const ap_uint<5> words_per_image = 1 << (2*width_mode); + Address img_idx = 0; // i / words_per_image; + IdxType img_off = 0; // i % words_per_image; + LOOP_DMEM_I: for (Address i = 0; i < input_words; ++i) { + if (layer_type == LAYER_CONV) { + Address bank_idx = img_idx % CONVOLVERS; + Address bank_off = img_idx / CONVOLVERS; + dmem[d_i_idx][bank_idx][(bank_off<<(2*width_mode)) + img_off] = dmem_i[i]; + } + else if (layer_type == LAYER_CONV1) + dmem[d_i_idx][i/C_DMEM_WORDS][i%C_DMEM_WORDS] = dmem_i[i]; + else + dmem[d_i_idx][i%CONVOLVERS][i/CONVOLVERS] = dmem_i[i]; + + if (++img_off == words_per_image) { + img_off = 0; + ++img_idx; + } + } + + // Weight input, we must copy every 64-bit Word from the interface + // into the accelerator + LOOP_WT_I: for (Address i = 0; i < C_WT_WORDS*CONVOLVERS; ++i) { + wt_mem[i%CONVOLVERS][i/CONVOLVERS] = wt_i[i]; + } + //printf (""\nAccel Weights:\n""); + //print_params3d(wt_mem[0], 0, n_inputs*n_outputs); + + LOOP_KH_I: for (ap_uint<16> i = 0; i < KH_WORDS; ++i) + kh_mem[i] = kh_i[i]; + + if (layer_type == LAYER_CONV1) { + assert(n_inputs == 3); + + fp_conv( + wt_mem, + kh_mem, + dmem, + d_i_idx, + d_o_idx, + kh_index, + o_index, + n_outputs + ); + + kh_index += n_outputs; + o_index += n_outputs; + } + else if (layer_type == LAYER_CONV) { + assert(norm_mode != 2 || n_outputs % 4 == 0); // needed for pooling of 8x8 image + assert(n_inputs % CONVOLVERS == 0); + + LOOP_IMG_BATCH: + for (IdxType i = 0; i < n_outputs; ++i) { + // Load the batch-norm parameters for this output + NormComp nc; + load_kh(nc, kh_mem, kh_index); + + bin_conv( + wt_mem, + nc, + dmem, + d_i_idx, d_o_idx, + n_inputs, + o_index, + i == 0 ? 1 : 0, // new_batch + width_mode, + norm_mode + ); + + kh_index++; + o_index++; + } + } + else { + bin_dense( + wt_mem, + kh_mem, + dmem, + layer_type, + d_i_idx, d_o_idx, + o_index, + n_inputs, n_outputs + ); + + o_index += n_outputs; + } // layer_type + + // Data output + ap_uint<5> words_per_out = words_per_image / ((norm_mode!=2) ? 1 : 4); + img_idx = 0; + img_off = 0; + LOOP_DMEM_O: for (Address i = 0; i < output_words; ++i) { + // exclude conv6 (width==8, norm_mode==2) here because it writes + // the output fmaps linearly + if (layer_type <= LAYER_CONV && !(width_mode == 0 && norm_mode == 2)) { + Address bank_idx = img_idx % CONVOLVERS; + Address bank_off = img_idx / CONVOLVERS; + dmem_o[i] = dmem[d_o_idx][bank_idx][bank_off*words_per_out + img_off]; + } + else + dmem_o[i] = dmem[d_o_idx][i%CONVOLVERS][i/CONVOLVERS]; + + if (++img_off == words_per_out) { + img_off = 0; + ++img_idx; + } + } +} +*/","C++" +"RNN","MinLiAmoy/rnn-fpga","cpp/accel/AccelSchedule.h",".h","968","47","#ifndef ACCEL_ACCEL_SCHEDULE_H +#define ACCEL_ACCEL_SCHEDULE_H + +#include +#include ""Accel.h"" + +// Contains all info needed to invoke the accelerator once except +// input/output data and its size which is handled separately +struct AccelInfo { + Word* wt; + Word* b; + unsigned n_inputs; + unsigned n_outputs; + ap_uint<3> layer_mode; // [0]='new layer', [2:1]='rnn1,rnn2,dense' + + + AccelInfo() { + wt = new Word[WT_WORDS]; + b = new Word[BIAS_WORDS]; + } + + ~AccelInfo() { + delete[] wt; + delete[] b; + } +}; + +typedef std::vector AccelSchedule; + +void compute_accel_schedule( + Word* wt, + Word* b, + unsigned n_inputs, + unsigned n_outputs, + const ap_uint<2> layer_type, // 0=rnn1, 1=rnn2, 2=dense + AccelSchedule &schedule, + unsigned layer_idx +); + + +void load_weights(Word* wt, Word* wt_o, + unsigned o, unsigned n_in, unsigned n_out); + +void load_bias(Word* b, Word b_i[], unsigned o, unsigned n_out); + +#endif +","Unknown" +"RNN","abhyudaynj/birnn-bionlp","tagger_utils.py",".py","6553","153","import pickle,logging,random,gensim +import sklearn,pickle +from random import shuffle +from sklearn.metrics import f1_score,recall_score,precision_score +import collections +logging.basicConfig(level=logging.INFO) +import numpy as np +import random +import string +from nltk.corpus import sentiwordnet as swn +from nltk.metrics import ConfusionMatrix + +KEY_LABEL = 'ADE' +PADDING_REPLACEMENT='None' +punct_list=[x for x in string.punctuation] + +def get_vocab(tagged_data): + vocab_set=set() + tag_set=set() + for i,sent in enumerate(tagged_data): + vocab_set= vocab_set | set([x[0].lower() for x,y in tagged_data[i] if x[0] !='\x00']) + tag_set = tag_set | set([y for x,y in tagged_data[i]]) + print('Tag Set :',tag_set) + return vocab_set,tag_set + + +def trim_tags(tagged_data): + for i,sent in enumerate(tagged_data): + tagged_data[i]=[(x,'ADE') if y=='ADE+occured' or y=='adverse+effect' else (x,y) for x,y in tagged_data[i]] + tagged_data[i]=[(x,'None') if y=='MedDRA' else (x,y) for x,y in tagged_data[i]] + return tagged_data + + +def get_embedding_weights(w2i): + i2w={i: word for word, i in w2i.iteritems()} + logging.info('embedding sanity check (should be a word) :{0}'.format(i2w[12])) + mdl=gensim.models.Word2Vec.load_word2vec_format('data/pubmed+wiki+pitts-nopunct-lower.bin',binary=True) + logging.info('{0},{1}'.format(mdl['is'].shape,len(w2i))) + emb_i=np.array([mdl[str(i2w[i])] if i in i2w and str(i2w[i]) in mdl else np.zeros(mdl['is'].shape[0],) for i in xrange(len(w2i))]) + return emb_i + + +def encode_words(entire_note): + logging.info('Reading Data Files ...') + tagged_data=pickle.load(open('data/NAACL_extracted_with_punct_dummpyPOS.pkl','rb')) + shuffle(tagged_data) + #flattening notes into sentences. + if entire_note: + note_data=[] + for notes in tagged_data: + note=[word for sent in notes for word in sent+[(('EOS_','EOS_'),'None')]] + note_data.append(note) + tagged_data=note_data + else: + tagged_data=[sentence for notes in tagged_data for sentence in notes] + tagged_data=trim_tags(tagged_data) + #tagged_data=trim_fraunhofer_tags(tagged_data) + v_set,t_set=get_vocab(tagged_data) + logging.info('Total Word Vocabulary Size : {0}'.format(len(v_set))) + logging.info('Total Tag Vocabulary Size : {0}'.format(len(t_set))) + w2i={word :i+1 for i,word in enumerate(list(v_set))} + w2i['OOV_CHAR']=0 + #print(w2i) + t2i={word :i for i,word in enumerate(list(t_set))} + logging.info('embedding sanity check (should be a number >1):{0}'.format(w2i['is'])) + X=[None]*len(tagged_data) + Y=[None]*len(tagged_data) + Z=[None]*len(tagged_data) + logging.info('Preparing data ...') + for i,sent in enumerate(tagged_data): + x=[w2i[word.lower()] if word.lower() in w2i else 0 for (word,tag),label in tagged_data[i]] + z=[word if word in w2i else 0 for (word,tag),label in tagged_data[i]] + y=[t2i[label] if label in t2i else 0 for word,label in tagged_data[i]] + X[i]=x + Y[i]=y + Z[i]=z + emb_w=get_embedding_weights(w2i) + #Z=generate_crf_features(tagged_data) + return X,Z,Y,len(t_set),emb_w,t2i,w2i + +def load_data(nb_words=None, skip_top=0, maxlen=100, test_split=0.2, seed=113, + start_char=1, oov_char=2, index_from=3,shuffle=False,entire_note=False): + X,Z,Y,numTags,emb_w,t2i,w2i = encode_words(entire_note) + if shuffle: + np.random.seed(seed) + np.random.shuffle(X) + np.random.seed(seed) + np.random.shuffle(Z) + np.random.seed(seed) + np.random.shuffle(Y) + #print ('debug : length {0} shape {1}'.format(len(Y[2]),len(Y[2]))) + if maxlen: + logging.info('Truncating {0} instances out of {1}'.format(sum(1 if len(y)>100 else 0 for y in Y),sum(1 for y in Y))) + X=[x1[:maxlen] for x1 in X] #to remove computation burden + Z=[z1[:maxlen] for z1 in Z] #to remove computation burden + Y=[y1[:maxlen] for y1 in Y] #to remove computation burden + if entire_note ==False: + pickle.dump(((X,Z,Y), numTags, emb_w ,t2i,w2i),open('data/NAACL_cancer_processed.pkl','wb')) + return (X,Z,Y),numTags,emb_w,t2i,w2i + + +def make_cross_validation_sets(data_len,n,training_percent=None): + if training_percent ==None: + training_percent = 1.0 + else: + training_percent = float(training_percent)/100.0 + split_length=int(data_len/n) + splits=[None]*n + for i in xrange(n): + arr=np.array(range(data_len)) + test=range(i*split_length,(i+1)*split_length) + mask=np.ones(arr.shape,dtype=bool) + mask[test]=0 + train=arr[mask] + training_len=float(len(train))*training_percent + train=train[:int(training_len)] + splits[i]=(train.tolist(),test) + #print ""\n"".join(str(x) for x in splits) + return splits + + +def evaluate_f1(y_true,y_pred,verbose =False,preMsg=None): + print('verbose value is ',verbose) + if verbose: + print ConfusionMatrix(y_true,y_pred) + z_true=y_true + z_pred=y_pred + label_dict={x:i for i,x in enumerate(list(set(z_true) | set(z_pred)))} + freq_dict=collections.Counter(z_true) + z_true=[ label_dict[x] for x in z_true] + z_pred=[ label_dict[x] for x in z_pred] + f1s= f1_score(z_true,z_pred, average=None) + print(str(preMsg)+'F1 score'+str(f1s)) + rs= recall_score(z_true,z_pred, average=None) + ps= precision_score(z_true,z_pred, average=None) + results =[] + f1_none=[] + print(str(preMsg)+str(label_dict)) + for i in label_dict: + print(""{5} The tag \'{0}\' has {1} elements and recall,precision,f1 ={3},{4}, {2}"".format(i,freq_dict[i],f1s[label_dict[i]],rs[label_dict[i]],ps[label_dict[i]],preMsg)) + if i!='None' and i!='|O': + f1_none=f1_none+[(rs[label_dict[i]],ps[label_dict[i]],f1s[label_dict[i]],freq_dict[i]),] + all_medical_words=sum([z[3] for z in f1_none]) + macro_averaged_recall= sum([float(z[0])*float(z[3]) for z in f1_none])/sum([float(z[3]) for z in f1_none]) + macro_averaged_precision= sum([float(z[1])*float(z[3]) for z in f1_none])/sum([float(z[3]) for z in f1_none]) + if (macro_averaged_recall+macro_averaged_precision) == 0.0: + macro_averaged_f =0.0 + else: + macro_averaged_f = 2.0* macro_averaged_recall*macro_averaged_precision/(macro_averaged_recall+macro_averaged_precision) + print(""{4} All medical tags have {0} elements and recall,precision,f1 ={1},{2}, {3}"".format(all_medical_words,macro_averaged_recall,macro_averaged_precision,macro_averaged_f,preMsg)) + return macro_averaged_f + +","Python" +"RNN","abhyudaynj/birnn-bionlp","eval_metrics.py",".py","4374","132","import pickle,itertools +import json +from nltk.metrics import ConfusionMatrix +IGNORE_TAG='None' + + + +def get_labels(label,predicted): + labels = list(set(itertools.chain.from_iterable(label)) | set(itertools.chain.from_iterable(predicted))) + print labels + return labels + +def get_ConfusionMatrix(true,predicted): + print ""Confusion Matrix of combined folds (partial evaluation)"" + true_chain=list(itertools.chain.from_iterable(true)) + predicted_chain=list(itertools.chain.from_iterable(predicted)) + print ConfusionMatrix(true_chain,predicted_chain) + +def get_Error_Metrics(true,predicted): + labels=get_labels(true,predicted) + error_types=['none2label','label2label','label2none','inj2inj'] + injury_tags=['ADE','indication','other+S%2FS%2FLIF'] + errors={key: 0 for key in error_types} + total_errors=0 + for i,sent in enumerate(true): + for j,word in enumerate(true[i]): + if true[i][j] != predicted[i][j]: + total_errors+=1 + if true[i][j] =='None': + errors['none2label']+=1 + else: + if predicted[i][j] == 'None': + errors['label2none']+=1 + else: + if true[i][j] in injury_tags and predicted[i][j] in injury_tags: + errors['inj2inj']+=1 + else: + errors['label2label']+=1 + print json.dumps(errors) + print total_errors, sum(value for key, value in errors.iteritems()) + + + + +def get_Exact_Metrics(true,predicted): + labels=get_labels(true,predicted) + get_ConfusionMatrix(true,predicted) + true_positive={label:0 for label in labels} + trues={label:0 for label in labels} + positives={label:0 for label in labels} + for i,sent in enumerate(true): + if sent.__len__() ==0: + continue + label_tags=[] + predicted_tags=[] + j=0 + tag='Nothing' + pos=[] + while j0: + avg_recall =float(avg_recall)/float(num_candidates) + avg_precision =float(avg_precision)/float(num_candidates) + avg_f1 =0.0 + if (avg_recall+avg_precision) >0: + avg_f1=2.0*float(avg_precision)*float(avg_recall)/(float(avg_recall)+float(avg_precision)) + print(""All medical tags collectively have {0} elements and recall,precision,f1 ={1},{2}, {3}"".format(num_candidates,avg_recall,avg_precision,avg_f1)) + return positives,trues,true_positive + +def decoratr(l,p): + p=[[xi[1] for xi in sent] for sent in p] + get_Exact_Metrics(l,p) + return l,p + + + +","Python" +"RNN","abhyudaynj/birnn-bionlp","tagger.py",".py","22926","422","from __future__ import absolute_import +import numpy as np +import pickle,argparse,eval_metrics +import sys,random,json +import progressbar +np.random.seed(1337) # for reproducibility + +import errno +from nltk.metrics import ConfusionMatrix +import itertools +import time +import logging +import lasagne +logging.basicConfig(level=logging.INFO) +import tagger_utils as preprocess +from sklearn.metrics import f1_score +from sklearn.utils import shuffle as sk_shuffle +import theano.tensor as T +import theano +from lasagne.regularization import regularize_layer_params_weighted, l2, l1 +from lasagne.layers import InputLayer, DenseLayer, prelu +import pycrfsuite +from nltk.tag import CRFTagger + +params={} +sl=logging.getLogger(__name__) + +wl=logging.getLogger(__name__+'_write') + + +def pad_and_mask(X,Y, maxlen=None,padding='pre', value=0.): + ''' + adapted from keras pad_and_mask function + ''' + lengths = [len(s) for s in Y] + if maxlen is None: + maxlen = np.max(lengths) + global params + params['maxlen']=maxlen + y_dim =max([max(s) for s in Y])+1 + x_dim = 1 + identity_mask=np.eye(y_dim) + Y=[[identity_mask[w] for w in s] for s in Y] + nb_samples = len(Y) + + logging.info('Maximum sequence length is {0}\nThe X dimension is {3}\nThe y dimension is {1}\nThe number of samples in dataset are {2}'.format(maxlen,y_dim,nb_samples,x_dim)) + + x = np.zeros((nb_samples, maxlen,x_dim)) + y = (np.ones((nb_samples, maxlen, y_dim)) * value).astype('int32') + mask = (np.ones((nb_samples, maxlen,)) * 0.).astype('int32') + + for idx, s in enumerate(X): + X[idx]=X[idx][:maxlen] + Y[idx]=Y[idx][:maxlen] + + for idx, s in enumerate(X): + if padding == 'post': + x[idx, :len(X[idx]),0] = X[idx] + y[idx, :len(X[idx])] = Y[idx] + mask[idx, :len(X[i])] = 1 + elif padding == 'pre': + x[idx, -len(X[idx]):,0] = X[idx] + y[idx, -len(X[idx]):] = Y[idx] + mask[idx, -len(X[idx]):] = 1 + + logging.info('X shape : {0}\nY shape : {1}\nMask shape : {2}'.format(x.shape,y.shape,mask.shape)) + return x,y,mask + + +def setup_NN(worker,x_in,mask_in,y_in): + batch_size = x_in.shape[0] + print('X train batch size {0}'.format(x_in.shape)) + print('Y train batch size {0}'.format(y_in.shape)) + print('mask train batch size {0}'.format(mask_in.shape)) + xt=theano.shared(x_in) + mt=theano.shared(mask_in) + yt=theano.shared(y_in) + premodel=time.time() + + # Setting up the NN architecture + + l_in=lasagne.layers.InputLayer(shape=(None,params['maxlen'],1),input_var=xt.astype('int32')) + l_mask=lasagne.layers.InputLayer(shape=(None,params['maxlen'])) + if params['word2vec']==1: + l_emb=lasagne.layers.EmbeddingLayer(l_in,emb_w.shape[0],emb_w.shape[1],W=emb_w.astype('float32')) + l_emb.add_param(l_emb.W, l_emb.W.get_value().shape, trainable=params['emb1']) + else: + l_emb=lasagne.layers.EmbeddingLayer(l_in,emb_w.shape[0],emb_w.shape[1]) + emb_out=lasagne.layers.get_output(l_emb) + emb_out_f=theano.function([l_in.input_var],emb_out) + print(""output shape for emb"",emb_out_f(x_in.astype('int32')).shape) + + + if params['emb2']>0: + l_emb1=lasagne.layers.EmbeddingLayer(l_in,emb_w.shape[0],params['emb2']) + l_emb=lasagne.layers.ConcatLayer([l_emb,l_emb1],axis=3) + + dropout_backward=lasagne.layers.DropoutLayer(l_emb,params['noise1']) + dropout_forward=lasagne.layers.DropoutLayer(l_emb,params['noise1']) + if params['rnn']=='GRU': + backward1= lasagne.layers.GRULayer(dropout_backward,params['hidden1'],mask_input=l_mask,backwards=True,precompute_input=True,gradient_steps= params['gradient_steps']) + + forward1= lasagne.layers.GRULayer(dropout_forward,params['hidden1'],mask_input=l_mask,precompute_input=True,gradient_steps= params['gradient_steps']) + + + else: + if params['hidden2'] >0: + backward1= lasagne.layers.LSTMLayer(dropout_backward,params['hidden2'],mask_input=l_mask,peepholes=params['peepholes'],forgetgate=lasagne.layers.Gate(b=lasagne.init.Constant(1.)),nonlinearity=lasagne.nonlinearities.tanh,backwards=True,precompute_input=True,gradient_steps= params['gradient_steps']) + forward1= lasagne.layers.LSTMLayer(dropout_forward,params['hidden2'],mask_input=l_mask,peepholes=params['peepholes'],forgetgate=lasagne.layers.Gate(b=lasagne.init.Constant(1.)),nonlinearity=lasagne.nonlinearities.tanh,precompute_input=True,gradient_steps= params['gradient_steps']) + dropout_forward=lasagne.layers.DropoutLayer(forward1,params['noise1']) + dropout_backward=lasagne.layers.DropoutLayer(backward1,params['noise1']) + + backward1= lasagne.layers.LSTMLayer(dropout_backward,params['hidden1'],mask_input=l_mask,peepholes=params['peepholes'],forgetgate=lasagne.layers.Gate(b=lasagne.init.Constant(1.)),nonlinearity=lasagne.nonlinearities.tanh,backwards=True,precompute_input=True,gradient_steps= params['gradient_steps']) + + forward1= lasagne.layers.LSTMLayer(dropout_forward,params['hidden1'],mask_input=l_mask,peepholes=params['peepholes'],forgetgate=lasagne.layers.Gate(b=lasagne.init.Constant(1.)),nonlinearity=lasagne.nonlinearities.tanh,precompute_input=True,gradient_steps= params['gradient_steps']) + + crf_layer=lasagne.layers.ConcatLayer([forward1,backward1],axis=2) + if params['dense']==1: + rlayer=lasagne.layers.ReshapeLayer(crf_layer,(-1,params['hidden1']*2)) + dropout1=lasagne.layers.DropoutLayer(rlayer,p=params['noise1']) + dense1=lasagne.layers.DenseLayer(dropout1,numTags,nonlinearity=lasagne.nonlinearities.softmax) + sum_layer=lasagne.layers.ReshapeLayer(dense1,(batch_size,params['maxlen'],numTags)) + else: + sum_layer=lasagne.layers.ElemwiseSumLayer([forward1,backward1]) + + outp=lasagne.layers.get_output(sum_layer,deterministic = False) + eval_out=lasagne.layers.get_output(sum_layer,deterministic=True) + crf_out=lasagne.layers.get_output(crf_layer,deterministic=True) + #eval_out=lasagne.layers.get_output(rlayer2) + lstm_output = theano.function([l_in.input_var,l_mask.input_var],eval_out) + crf_output = theano.function([l_in.input_var,l_mask.input_var],crf_out) + print(""output shape for theano net"",lstm_output(x_in.astype('int32'),mask_in.astype('float32')).shape) + t_out=T.tensor3() + eval_cost=T.mean((eval_out-t_out)**2) + all_params = lasagne.layers.get_all_params(sum_layer,trainable=True) # <------ CHECK THE TRAINABLE PARAMS. You always forget to set this correctly. + num_params = lasagne.layers.count_params(sum_layer,trainable=True) + print('Number of parameters: {0}'.format(num_params)) + l2_cost= params['l2'] *lasagne.regularization.apply_penalty(all_params,lasagne.regularization.l2) + l1_cost= params['l1'] *lasagne.regularization.apply_penalty(all_params,lasagne.regularization.l1) + if params['crossentropy']==1: + clipped_outp=T.clip(outp,1e-7,1.0-1e-7) + cost=lasagne.objectives.categorical_crossentropy(clipped_outp,t_out) + cost = cost.mean() + else: + cost=T.mean((outp-t_out)**2)#+ l2_penalty + cost+=l2_cost+l1_cost + updates = lasagne.updates.adagrad(cost, all_params,learning_rate=params['learning-rate']) + updates_m = lasagne.updates.apply_momentum(updates,all_params,momentum=0.9) + train = theano.function([l_in.input_var,t_out,l_mask.input_var],cost,updates=updates_m) + compute_cost = theano.function([l_in.input_var,t_out,l_mask.input_var],eval_cost) + #acc_=T.sum(T.eq(T.argmax(eval_out,axis=2),T.argmax(t_out,axis=2))*T.sum(t_out,axis =2))/T.sum(l_mask.input_var) + acc_=T.sum(T.eq(T.argmax(eval_out,axis=2),T.argmax(t_out,axis=2))*l_mask.input_var)/T.sum(l_mask.input_var) + compute_acc = theano.function([l_in.input_var,t_out,l_mask.input_var],acc_) + print('Time to build and compile model {0}'.format(time.time()-premodel)) + + return crf_output,lstm_output,train,compute_cost,compute_acc + +def iterate_minibatches(inputs,mask,targets, batchsize): + indices=np.array(range(len(inputs))) + np.random.shuffle(indices) + for start_idx in range(0, len(inputs) - batchsize + 1, batchsize): + #for start_idx in range(0, len(inputs), batchsize): + #yield inputs[start_idx:start_idx + batchsize],mask[start_idx:start_idx + batchsize], targets[start_idx:start_idx + batchsize] + yield inputs[indices[start_idx:start_idx + batchsize]],mask[indices[start_idx:start_idx + batchsize]], targets[indices[start_idx:start_idx + batchsize]] + if len(indices[start_idx+batchsize:]) >0: + last_inputs=inputs[indices[-batchsize:]] + last_targets=targets[indices[-batchsize:]] + last_mask=mask[indices[-batchsize:]] + #last_mask[:-len(indices[start_idx+batchsize:]),:-1]=0 + last_mask[:-len(indices[start_idx+batchsize:])]=0 + yield last_inputs,last_mask,last_targets + + + +def train_NN(train,crf_output,lstm_output,train_indices,compute_cost,compute_acc,worker): + if params['patience'] !=0: + vals=[0.0]*params['patience'] + sl.info('Dividing the training set into {0} % training and {1} % dev set'.format(100-params['dev'],params['dev'])) + train_i=np.copy(train_indices) + np.random.shuffle(train_i) + dev_length = len(train_indices)*params['dev']/100 + dev_i=train_i[:dev_length] + train_i=train_i[dev_length:] + sl.info('{0} training set samples and {1} dev set samples'.format(len(train_i),len(dev_i))) + x_train=X[train_i] + y_train=Y[train_i] + mask_train=Mask[train_i] + + x_dev=X[dev_i] + y_dev=Y[dev_i] + mask_dev=Mask[dev_i] + num_batches=float(sum(1 for _ in iterate_minibatches(x_train,mask_train,y_train,params['batch-size']))) + for iter_num in xrange(params['epochs']): + try: + iter_cost=0.0 + iter_acc=0.0 + print('Iteration number : {0}'.format(iter_num+1)) + progr=progressbar.ProgressBar(maxval=num_batches).start() + for indx,(x_i,m_i,y_i) in enumerate(iterate_minibatches(x_train,mask_train,y_train,params['batch-size'])): + progr.update(indx+1) + train(x_i.astype('int32'),y_i.astype('float32'),m_i.astype('float32')) + iter_cost+=compute_cost(x_i.astype('int32'),y_i.astype('float32'),m_i.astype('float32')) + iter_acc+=compute_acc(x_i.astype('int32'),y_i.astype('float32'),m_i.astype('float32')) + progr.finish() + print('TRAINING : acc = {0} loss : {1}'.format(iter_acc/num_batches,iter_cost/num_batches)) + val_acc=callback_NN(compute_cost,compute_acc,x_dev,mask_dev,y_dev) + if params['patience'] !=0: + vals.append(val_acc) + vals = vals[1:] + max_in=np.argmax(vals) + print ""val acc argmax {1} : list is : {0}"".format(vals,max_in) + if max_in ==0: + print ""Stopping because my patience has reached its limit."" + break + if iter_num %5 ==0: + res=evaluate_neuralnet(lstm_output,x_dev,mask_dev,y_dev) + except IOError, e: + if e.errno!=errno.EINTR: + raise + else: + print "" EINTR ERROR CAUGHT. YET AGAIN "" + + print ""Final Validation eval"" + evaluate_neuralnet(lstm_output,x_dev,mask_dev,y_dev) + + +def callback_NN(compute_cost,compute_acc,X_test,mask_test,y_test): + num_valid_batches=float(sum(1 for _ in iterate_minibatches(X_test,mask_test,y_test,params['batch-size']))) + logging.info('Executing validation Callback') + val_loss=0.0 + val_acc =0.0 + num_batches=float(sum(1 for _ in iterate_minibatches(X_test,mask_test,y_test,params['batch-size']))) + progr=progressbar.ProgressBar(maxval=num_batches).start() + for indx,(x_i,m_i,y_i) in enumerate(iterate_minibatches(X_test,mask_test,y_test,params['batch-size'])): + val_loss+=compute_cost(x_i.astype('int32'),y_i.astype('float32'),m_i.astype('float32')) + val_acc+=compute_acc(x_i.astype('int32'),y_i.astype('float32'),m_i.astype('float32')) + + progr.update(indx+1) + progr.finish() + print('VALIDATION : acc = {0} loss = {1}'.format(val_acc/num_valid_batches,val_loss/num_valid_batches)) + return val_acc/num_valid_batches + +def evaluate_neuralnet(lstm_output,X_test,mask_test,y_test,strict=False): + print('Mask len test',len(mask_test)) + predicted=[] + predicted_sent=[] + label=[] + label_sent=[] + original_sent=[] + num_batches=float(sum(1 for _ in iterate_minibatches(X_test,mask_test,y_test,params['batch-size']))) + progr=progressbar.ProgressBar(maxval=num_batches).start() + for indx,(x_i,m_i,y_i) in enumerate(iterate_minibatches(X_test,mask_test,y_test,params['batch-size'])): + for sent_ind,m_ind in enumerate(m_i): + o_sent = x_i[sent_ind][m_i[sent_ind]==1].tolist() + #if sent_ind ==0: + # print x_i[sent_ind][m_i[sent_ind]==1].shape + original_sent.append([i2w[int(l[0])] for l in o_sent]) + #original_sent.append(o_sent) + y_p=lstm_output(x_i.astype('int32'),m_i.astype('float32')) + for sent_ind,m_ind in enumerate(m_i): + l_sent = np.argmax(y_i[sent_ind][m_i[sent_ind]==1],axis=1).tolist() + p_sent = np.argmax(y_p[sent_ind][m_i[sent_ind]==1],axis=1).tolist() + predicted_sent.append([i2t[l] for l in p_sent]) + #predicted_sent.append(p_sent) + label_sent.append([i2t[l] for l in l_sent]) + #label_sent.append(l_sent) + m_if=m_i.flatten() + label+=np.argmax(y_i,axis=2).flatten()[m_if==1].tolist() + predicted+=np.argmax(y_p,axis=2).flatten()[m_if==1].tolist() + + progr.update(indx+1) + progr.finish() + res=preprocess.evaluate_f1([i2t[l] for l in label],[i2t[l] for l in predicted],verbose=True,preMsg='NN:') + if strict : + print ""###########EVALUATION STRICT ###################"" + eval_metrics.get_Exact_Metrics(label_sent,predicted_sent) + + #print(predicted[0],predicted.__len__()) + #print(label[0],label.__len__()) + #preprocess.evaluate_f1(label,predicted,verbose=True) + return res,(original_sent,label_sent,predicted_sent) + +def driver(worker,(train_i,test_i)): + if worker ==0: + print('Embedding Shape :',emb_w.shape) + print(len(X[train_i]), 'train sequences') + print(len(X[test_i]), 'test sequences') + print('Number of tags',numTags) + print('X train Sanity check: ', np.amax(np.amax(X[train_i]))) + print('X test Sanity check :', np.amax(np.amax(X[test_i]))) + #y_test = y_test/numTags + print('X_train shape:', X[train_i].shape) + print('X_test shape:', X[test_i].shape) + + print('mask_train shape:', Mask[train_i].shape) + print('mask_test shape:', Mask[test_i].shape) + + print('Y_train shape:', Y[train_i].shape) + print('Y_test shape:', Y[test_i].shape) + + crf_output,lstm_output,train,compute_cost,compute_acc = setup_NN(0,X[0:params['batch-size']],Mask[0:params['batch-size']],Y[0:params['batch-size']]) + #setup_NN(0,X[0:params['batch-size']],Mask[0:params['batch-size']],Y[0:params['batch-size']]) + train_NN(train,crf_output,lstm_output,train_i,compute_cost,compute_acc,worker) + print ""TESTING EVALUATION"" + callback_NN(compute_cost,compute_acc,X[test_i],Mask[test_i],Y[test_i]) + _,results=evaluate_neuralnet(lstm_output,X[test_i],Mask[test_i],Y[test_i],strict=True) + return results + + +def store_response(o,l,p,filename='response.pkl'): + print ""Storing responses in {0}"".format(params['dump-dir']+filename) + pickle.dump((params,o,l,p),open(params['dump-dir']+filename,'wb')) + + +def single_run(): + worker=0 + o,l,p=driver(worker,splits[worker]) + if params['error-analysis']==1: + store_response(o,l,p,'single_run{0}_response.pkl'.format(params['instance'])) + +def cross_validation_run(): + label_sent=[] + predicted_sent=[] + original_sent=[] + for worker in xrange(len(splits)): + print ""########### Cross Validation run : {0}"".format(worker) + o,l,p = driver(worker,splits[worker]) + label_sent += l + predicted_sent += p + original_sent +=o + print ""#######################VALIDATED SET ########"" + flat_label=[word for sentenc in label_sent for word in sentenc] + flat_predicted=[word for sentenc in predicted_sent for word in sentenc] + preprocess.evaluate_f1(flat_label,flat_predicted) + print ""STRICT ---"" + eval_metrics.get_Exact_Metrics(label_sent,predicted_sent) + if params['error-analysis']==1: + store_response(original_sent,label_sent,predicted_sent,'cv_run{0}_response.pkl'.format(params['instance'])) + + + +if __name__==""__main__"": + DATASET_DEFAULT='temp/NAACL/data/NAACL_cancer_processed.pkl' + DEFAULT_DUMP_DIR='temp/ADE/' + nonlinearity={'tanh':lasagne.nonlinearities.tanh ,'softmax':lasagne.nonlinearities.softmax} + + #parsing arguments + parser = argparse.ArgumentParser() + parser.add_argument('-i','--instance',dest='instance',type= int, default=0 ,help ='Set instance for testing purposes. Default 0') + parser.add_argument('-m','--mode',dest='document',type= int, default=0 ,help ='Run in which mode. Sentence 0 Document 1.Default 0') + parser.add_argument('-cv','--cross-validation',dest='cross-validation',type= int, default=0 ,help ='Cross Validation run. 0 off, 1 on. Default 0') + parser.add_argument('-w','--word2vec',dest='word2vec',type= int, default=0 ,help ='Initialize the Network with wordvec embeddings if 1. else random initialization. defualt 0') + parser.add_argument('-n','--epochs',dest='epochs',type= int, default=1 ,help ='Number of epochs for training. default 1') + parser.add_argument('-e2','--emb2',dest='emb2',type= int, default=100 ,help ='Number of dimension of extra embedding layer. off if 0. default is 100') + parser.add_argument('-h1','--hidden1',dest='hidden1',type= int, default=50 ,help ='Dimensionality of the first hidden layer. Default is 50') + parser.add_argument('-h2','--hidden2',dest='hidden2',type= int, default=0 ,help ='Dimensionality of the first hidden layer. 0 is off. Default is zero') + parser.add_argument('-n1','--noise1',dest='noise1',type= float, default=0.50 ,help ='Dropout Noise for first layer. Default is 0.50') + parser.add_argument('-b','--batch-size',dest='batch-size',type= int, default=32 ,help ='Batch size. Default is 32') + parser.add_argument('-r','--data-refresh',dest='data-refresh',type= int, default=0 ,help ='Use cached data, or reprocess the Dataset ? Default is 0: use cached data') + parser.add_argument('-log','--log-file',dest='log-file',type= str, default=DEFAULT_DUMP_DIR+'temp_nn.log' ,help ='Log file that should be used.') + parser.add_argument('-l','--maxlen',dest='maxlen',type= int, default=100 ,help ='Maximum Length for padding. default 100') + parser.add_argument('-f','--folds',dest='folds',type= int, default=10,help ='Number of cross validation folds. 20 of the training data will be used for dev set. default 10') + parser.add_argument('-d','--dev',dest='dev',type= int, default=20,help ='percentage of training data that will be used for dev set. default 20') + parser.add_argument('-lr','--learning-rate',dest='learning-rate',type= float, default=0.1,help ='learning rate. default 0.1') + parser.add_argument('-ce','--crossentropy',dest='crossentropy',type= int, default=0,help ='Cost function. 1 :crossentropy 0: mse. default 0') + parser.add_argument('-de','--dense',dest='dense',type= int, default=0,help ='Add dense layer on top of lstm. default 0') + parser.add_argument('-rnn','--rnn',dest='rnn',type= str, default='LSTM',help ='Use GRU or LSTM. default LSTM') + parser.add_argument('-tp','--tp',dest='training-percent',type= int, default=100,help ='Percentage of training data used. default is 100') + parser.add_argument('-e1','--emb1',dest='emb1',type= int, default=1,help ='Should the word2vec vectors be further trained. default 1') + parser.add_argument('-l2','--l2cost',dest='l2',type= float, default=0.005,help ='Add l2 penalty. default 0.005') + parser.add_argument('-l1','--l1cost',dest='l1',type= float, default=0.0,help ='Add l2 penalty. default 0.0, off') + parser.add_argument('-err','--error-analysis',dest='error-analysis',type= int, default=1,help ='Dump test output in a file. default 1') + parser.add_argument('-p','--patience',dest='patience',type= int, default=10,help ='Stop if the validation accuracy has not increased in the last n iterations.Off if 0. default 10') + parser.add_argument('-c','--peepholes',dest='peepholes',type= int, default=0,help ='Keep peephole connections in LSTM on. Default is 0, off') + parser.add_argument('-g','--gradient-steps',dest='gradient_steps',type= int, default=-1,help ='Number of timesteps to include in the backpropagated gradient. If -1, backpropagate through the entire sequence. Default is -1') + parser.add_argument('-s','--shuffle',dest='shuffle',type= int, default=0,help ='Shuffle entire dataset. By default 0, means only shuffling the training and dev datasets.') + args = parser.parse_args() + params = vars(args) + params['corpus']=DATASET_DEFAULT + params['dump-dir']=DEFAULT_DUMP_DIR + params['peepholes']=bool(params['peepholes']) + params['emb1']=bool(params['emb1']) + params['document']=bool(params['document']) + if params['document']: + params['maxlen']=1500 + if params['maxlen']==-1: + params['maxlen']=None + + wl.addHandler(logging.FileHandler(params['log-file']+str(params['instance']),mode='w')) + wl.propagate = False + wl.info('Parameters') + wl.info(json.dumps(params)) + sl.info('Using the parameters:\n {0}'.format(json.dumps(params,indent=2))) + print('Using the parameters:\n {0}'.format(json.dumps(params,indent=2))) + + # Preparing Dataset + + if params['data-refresh']==1 or params['document']==True: + sl.info('Preprocessing entire dataset ...') + (X,Z,Y) , numTags, emb_w , t2i,w2i =preprocess.load_data(maxlen=params['maxlen'],entire_note=params['document']) + else: + sl.info('Loading cached dataset ...') + (X,Z,Y) , numTags, emb_w , t2i,w2i = pickle.load(open(params['corpus'],'rb')) + X,Y,Mask=pad_and_mask(X,Y,params['maxlen']) + if params['shuffle']==1: + X,Y,Mask=sk_shuffle(X,Y,Mask,random_state=0) + i2t = {v: k for k, v in t2i.items()} + i2w = {v: k for k, v in w2i.items()} + splits = preprocess.make_cross_validation_sets(len(Y),params['folds'],training_percent=params['training-percent']) + try: + if params['cross-validation']==0: + single_run() + else: + cross_validation_run() + except IOError, e: + if e.errno!=errno.EINTR: + raise + else: + print "" EINTR ERROR CAUGHT. YET AGAIN "" + sl.info('Using the parameters:\n {0}'.format(json.dumps(params,indent=2))) + print('Using the parameters:\n {0}'.format(json.dumps(params,indent=2))) +","Python"