MATLAB Answers

Computed gradients for a keras model in MATLAB

4 views (last 30 days)
James Walt
James Walt on 25 Jun 2018
Commented: James Walt on 26 Jun 2018
MATLAB via NN Toolbox now supports directly importing and working with keras models. Is it possible to compute gradients input/output of any layer, similar to keras backend function K.gradients() ?


Sign in to comment.

Answers (1)

Don Mathis
Don Mathis on 26 Jun 2018
If you're referring to the Tensorflow-Keras Importer support package, that imports a Keras model into MATLAB and returns a MATLAB (Neural Network Toolbox) model. The Keras model is not retained; it is translated into a MATLAB model, so you can only perform operations defined on MATLAB models from that point onward.

  1 Comment

James Walt
James Walt on 26 Jun 2018
@Don Mathis Thanks for a response, and clarification. Sorry but I still don’t have the full answer since I am new to MATLAB. I saw documentation which mentions defaultderiv() can be used to compute gradients but I am not sure how to use it to compute say dy_i/dx_ik where y_i is the ith target class/node and x_ik is the ith input/feature map at layer k.

Sign in to comment.

Sign in to answer this question.