Skip to content

Implement comparison and logical operations for tensors#342

Merged
apaszke merged 1 commit intomasterfrom
comparison_ops_v2
Dec 27, 2016
Merged

Implement comparison and logical operations for tensors#342
apaszke merged 1 commit intomasterfrom
comparison_ops_v2

Conversation

@apaszke
Copy link
Copy Markdown
Contributor

@apaszke apaszke commented Dec 21, 2016

I tried to have them behave like numpy arrays. Fixes #296.

@apaszke apaszke force-pushed the comparison_ops_v2 branch 3 times, most recently from 0a48435 to c0e8577 Compare December 26, 2016 23:07
Copy link
Copy Markdown
Member

@colesbury colesbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment thread torch/tensor.py
def __bool__(self):
if self.numel() == 0:
return False
raise RuntimeError("bool value of non-empty " + torch.typename(self) +

This comment was marked as off-topic.

This comment was marked as off-topic.

@apaszke apaszke merged commit cd82b2b into master Dec 27, 2016
@apaszke apaszke deleted the comparison_ops_v2 branch December 27, 2016 23:04
@sajjo79
Copy link
Copy Markdown

sajjo79 commented Dec 14, 2017

Hi,
I am trying to implement following code but i could not find tf.where equivalent in pytorch
new_weights = tf.where(tf.is_inf(weights), tf.zeros_like(weights), weights)
any help plz.

@fmassa
Copy link
Copy Markdown
Member

fmassa commented Dec 15, 2017

You can do something like

weights[weights == float('inf')] = 0

Also, questions like that are better suited for the forums

KyleCZH pushed a commit to KyleCZH/pytorch that referenced this pull request Sep 20, 2021
* Add more binary tests for libtorch

* fix include path

* fix runtime library discovery path

* fix cudnn check

* install unzip in docker image

* install mkl

* fix error message

* improve debug message

* fix libgomp.so path

* more debug info for patchelf --replace-needed

* DEBUG: try to find out what causes the so name change in libtorch.so

* clean

* DEBUG: build for less CUDA archs

* simplify checks

* install magma

* try to fix CUDA search path

* fix magma

* clean up

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem with comparison overload operators

5 participants