<h2 dir="auto"><g-emoji class="g-emoji" alias="rocket" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f680.png">🚀</g-emoji> Feature</h2>
<p dir="auto">Add an op that performs 'and' and 'or' on a bitwise level.<br>
For example:</p>
<p dir="auto"><code class="notranslate">a = torch.LongTensor([3]) # b'11'</code><br>
<code class="notranslate">b = torch.LongTensor([2])  # b'10'</code><br>
<code class="notranslate">torch.bitwise_and(a,b) # 2 == b'10'</code></p>
<h2 dir="auto">Motivation</h2>
<p dir="auto">As of now, logical_and and logical_or always return bool, and if one wishes to get the bitwise result, there is no solution available.</p>
<h2 dir="auto">Pitch</h2>
<p dir="auto">A recent implementation of bitwise_xor is very similar to what I am describing:<br>
<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/pytorch/pytorch/commit/bd0394d47321c310bd6ff70d138e3ea648b79427/hovercard" href="https://github.com/pytorch/pytorch/commit/bd0394d47321c310bd6ff70d138e3ea648b79427"><tt>bd0394d</tt></a></p>
<p dir="auto">In cudnn rnn backend, setDropoutDescriptor is called at every step:<br>
<a href="https://github.com/pytorch/pytorch/blob/master/torch/backends/cudnn/__init__.py#L220">https://github.com/pytorch/pytorch/blob/master/torch/backends/cudnn/__init__.py#L220</a><br>
which means that rng states will be re-initialized at every step from the same seed, and dropout will generate the same randoms at every step.<br>
<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/adamlerer/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/adamlerer">@adamlerer</a></p>