Skip to content

[feature]: support for trigonometric functions in XLA #8315

Closed

Description

@fxsuper

I'd like to request support for basic trigonometric functions in XLA, things like cos, sin, etc, as well as basic geometry options like cross products. These are already supported in TF and I imagine there's native support in eigen. Looking through tf2xla I didn't see them anywhere.

Activity

  1. added
    type:feature
    on Mar 12, 2017
  2. prb12 commented on Mar 12, 2017

    @prb12
    Member

    @learyg @eliben We currently only have Tanh - any reason not to have the rest?

  3. added
    stat:awaiting tensorflower
    on Mar 12, 2017
  4. fxsuper commented on Mar 26, 2017

    @fxsuper
    Author

    Any updates on this?

  5. eliben commented on Mar 26, 2017

    @eliben
    Contributor

    I think element-wise trigonometric functions can be added - I don't see a strong reason not to support them, because building them out of other XLA primitives would be challenging

  6. added
    stat:contribution welcome
    and removed
    stat:awaiting tensorflower
    on Mar 26, 2017
  7. fxsuper commented on Mar 27, 2017

    @fxsuper
    Author

    Does the "contributions welcome" tag mean no one at Google has any plans to add this? Also what about things like cross? It's currently a builtin TF function.

  8. girving commented on Jun 16, 2017

    @girving
    Contributor

    @fxsuper Yep, no one at Google is working on this.

  9. ghost removed
    stat:contribution welcome
    on Jul 24, 2017
  10. ghost
    self-assigned this
    on Jul 24, 2017
  11. fxsuper commented on Jul 25, 2017

    @fxsuper
    Author

    Thanks for the update, and I'm glad that sin will be in there soon!

    Regarding cross--it's certainly possible to build out of existing XLA blocks, but my concern was speed. Is that not a valid concern? TF-level cross can be defined pretty easily indeed:

    with tf.op_scope([u, v], name, 'cross') as scope:
        u_t = tf.transpose(u)
        v_t = tf.transpose(v)
    
        u1, u2, u3 = tf.unstack(u_t)
        v1, v2, v3 = tf.unstack(v_t)
    
        return tf.transpose(tf.stack([(u2 * v3) - (u3 * v2), (u3 * v1) - (u1 * v3), (u1 * v2) - (u2 * v1)]))
    

    I'm asking so that I know whether to start a new issue or not. Thanks.

  12. ghost closed this as completedon Jul 26, 2017
  13. fxsuper commented on Jul 26, 2017

    @fxsuper
    Author

    Thanks for investigating this! I just opened a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions