The following shows an example code for adding new layers to SOL’s TensorFlow frontend.

import sol.tensorflow

def parse_inputs(conf, paramA, paramB, paramC=None):
	return tuple(scope[i.unique()] for i in node.inputs())

def my_handler(conf, a, b, c=None):
	input = sol.tensorflow.get_tensor(conf.get('input'), 0)
	x = sol.hlir.Tensor(my_backend_lib.add_my_layer(input, a, b, c))
	sol.tensorflow.set_tensor(conf.get('name'), 0, x)

sol.tensorflow.add_handler("not_implemented_by_sol", my_handler)

my_handler gets called with handler(conf, *args, **kwargs) so the order and name of the arguments need to match the TensorFlow function call! Within your handler you can either use sol.hlir API or your own backend to add layers to the neural network representation within SOL. Last, don’t forget to add the output tensor of your layer using sol.tensorflow.set_tensor(key, index, tensor), so that following layers can access it! Use sol.tensorflow.get_tensor(key, idx) to retrieve a tensor instance.