Dr.-Ing. Nicolas Weber

Researching Automatic Performance Optimizations for Artificial Intelligence, Scientific and High Performance Computing

Keras Merge

09.11.2022 Open Source Nicolas Weber

Today we released my newest Open Source project: Keras Merge! Keras Merge allows you to merge two Keras models, even when you don’t have access to their building functions! Just run pip3 install keras-merge to install it.

A = init_model_a() # -> keras.Model
B = init_model_b() # -> keras.Model

input_a = init_input_a()
input_b = init_input_b()

c = B(input_b, A(input_a))

import keras_merge as km
C = km.merge(A, B,  			# models
	[*A.inputs, B.inputs[0]],	# inputs
	B.outputs,					# outputs
	[							# mapping [(src->dst), ...]
		(A.outputs[0], B.inputs[1])
	]
)

d = C(input_a, input_b)

Checkout Github or PyPI for more information!