Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
model = Sequential()
model.add(Dense(units=64, activation='relu', input_dim=100))
model.add(Dense(units=10, activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer='sgd', metrics=['accuracy'])
model.save('test.h5')
kmi = java_classes.KerasModelImport
file = java_classes.File("test.h5")
java_model = kmi.importKerasSequentialModelAndWeights(file.absolutePath)
weights = adapter.retrieve_keras_weights(java_model)
model.set_weights(weights)
def get_keras_model(self):
model = self.master_network
java_model = self.java_spark_model.getNetwork()
weights = adapter.retrieve_keras_weights(java_model)
model.set_weights(weights)
return model
def get_keras_model(self):
model = self.master_network
java_model = self.java_spark_model.getNetwork()
weights = adapter.retrieve_keras_weights(java_model)
model.set_weights(weights)
return model