nuts-ml icon indicating copy to clipboard operation
nuts-ml copied to clipboard

Get output/activation of a network layer

Open maet3608 opened this issue 6 years ago • 1 comments

Example code for Keras:

@nut_function def GetActivations(batch, model, layer, istrain=1): from keras import backend as K

f = K.function([model.input, K.learning_phase()],
               [model.get_layer(layer).output])
return f([batch[0], istrain])

build_batch >> GetActivations(network.model) >> FlattenCol(0) >> Collect()

Having a network function for it would be nice, e.g. build_batch >> network.activation('layername') >> Collect()

maet3608 avatar Jul 11 '17 23:07 maet3608