Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what is the difference between calculate cosloss using py_func and tf api in utils.py line 104-109? #19

Open
xiaowenhe opened this issue Oct 24, 2019 · 0 comments

Comments

@xiaowenhe
Copy link

Hi,I have a question, what is the difference as follows:
#implemented by py_func
#value = tf.identity(xw)
#substract the marigin and scale it
value = coco_func(xw_norm,y,alpha) * scale

#implemented by tf api
#margin_xw_norm = xw_norm - alpha
#label_onehot = tf.one_hot(y,num_cls)
#value = scale*tf.where(tf.equal(label_onehot,1), margin_xw_norm, xw_norm)

Implemented by py_func is more complex,you should calculate grad by youself ,and implemented by tf api is simple,only 3 lines. And have any difference between the two?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant