Skip to content

tf.unsorted_segment_sum exits without error message if segment_ids contains negative number. #466

Closed

Description

@panmari

When running

tf.unsorted_segment_sum(data, segment_ids, num_segments, name=None)

and passing a tensor containing -1 as segment_ids, tensorflow just exits without error message. I'm on the current master.

Desired behavior in my case would be to these values are 'rejected', i. e. are not summed anywhere at all. Would it make sense to extend this method this way? And if not, can you give me an idea how to implement this behavior?

Activity

  1. girving commented on Dec 10, 2015

    @girving
    Contributor

    Using -1 to reject is interesting, but it turns coding errors into silent incorrect behavior so I'm leery of doing it. For now, you could replace -1s with a positive value represent an "ignored" class and then drop it.

    It would be reasonable to add a boolean drop_negatives attr to ignore negative values, defaulted to false to preserve the existing error detection behavior.

  2. girving commented on Dec 10, 2015

    @girving
    Contributor

    Ah, but the fact that it exits without the error message is a bad bug.

  3. girving commented on Dec 10, 2015

    @girving
    Contributor

    I'll fix the bug part now.

  4. self-assigned this
    on Dec 10, 2015
  5. panmari commented on Dec 11, 2015

    @panmari
    ContributorAuthor

    Thanks for the fix, I'll open a new issue with my feature request.

  6. added
    type:feature
    and removed on Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type:bugtype:feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions