Giter Club home page Giter Club logo

list-of-differentiable--ops-and-non-differentiable-ops--in-tensorflow's People

Contributors

mainak431 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

list-of-differentiable--ops-and-non-differentiable-ops--in-tensorflow's Issues

How to find the equivalents of python/keras api functions

Note for python tensorflow API users... to find the tensorflow equivalent class names, you can search for them in tensorflow/python/ops/array_ops.py, and look for which tensorflow operator it is getting mapped to for your arguments. Often this can be a constant, or not. In my case, where_v2 maps to select_v2, which is probably SelectV2, which shows up in the output.

$ rg Select
DIFFERENTIABLE LIST.txt
283:"Select"

README.md
308:"Select" \

DIFFERENTIABLE.TXT
220:"Select"
221:"SelectV2"

There are probably operators that are differentiable, or not, depending on the arguments.

Incorrect list - I guess the script somehow also needs to check return values?

I think currently the list of differentiable OPs is incorrect.

Take ArgMax as an example:

https://github.com/tensorflow/tensorflow/blob/87462bfac761435a46641ff2f10ad0b6e5414a4b/tensorflow/python/ops/math_grad.py#L37

It returns [None, None].
And I guess, that is why I'm still getting:
ValueError: No gradients provided for any variable
when I use a Lambda-Layer with tf.math.argmax within keras.
So my guess is that ArgMax is indeed not differentiable.

But maybe I'm just missing something?

Example code:

import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras.layers import *
from tensorflow.keras.models import *
from tensorflow.keras.optimizers import *

def ArgMax():
    return Lambda(lambda q:tf.math.argmax(q, 2))
inputs1 = Input(shape = (1,1,))
d = Dense(3)(inputs1)
out = ArgMax()(d)

model = Model(inputs = [inputs1], outputs = [out], name = "test")

model.summary()
model.compile(SGD(0.1),loss="mae")
model.fit(
        x = [np.ones((100,1,1))],
        y = [np.zeros((100,1))],
        batch_size = 100,
        verbose = 2,
        epochs = 10)

feature request: include results for a range of recent tensorflow versions

Alternatively, you could just focus on the list of known differentiable functions, and include a "since" flag when you detect a version that doesn't have AD.

Your script ran successfully over a tensorflow 1.14 installation from conda, by the way. I would include it, but if you do this, you probably want to automate checking out the versions and gathering all the info anyway.

Thanks!

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.