Giter Site home page Giter Site logo

Comments (4)

raphaelvalentin avatar raphaelvalentin commented on July 2, 2024

Maybe I just answer to myself. Need to double check that my addition is okay.

In levenberg_marquardt.py

def _compute_jacobian(self, inputs, targets):
...
        jacobians = tape.jacobian(
            residuals,
            self.model.trainable_variables,
            experimental_use_pfor=self.experimental_use_pfor, unconnected_gradients=tf.UnconnectedGradients.ZERO)
...
    jacobians = [tf.reshape(j, (num_residuals, -1)) for j in jacobians if j is not None]

src: https://stackoverflow.com/questions/57144586/tensorflow-gradienttape-gradients-does-not-exist-for-variables-intermittently

from tf-levenberg-marquardt.

fabiodimarco avatar fabiodimarco commented on July 2, 2024

Hi Raphael,

I executed the code you provided, it seems that adding unconnected_gradients=tf.UnconnectedGradients.ZERO does solves the error.
Does it also work as expected?

from tf-levenberg-marquardt.

raphaelvalentin avatar raphaelvalentin commented on July 2, 2024

Hi Fabio,
yes, it is working perfectly for my case.
Thanks a lot !
Raphael.

from tf-levenberg-marquardt.

fabiodimarco avatar fabiodimarco commented on July 2, 2024

Perfect, I'll commit your changes then.

from tf-levenberg-marquardt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.