sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: [jit] `__hash__` magic method is missing
Labels: oncall: jit,low priority

```python
class X(object):
    def __init__(self):
        pass
    def __hash__(self):
        return 2

@torch.jit.script
def fn():
    x = X()
    return hash(x)

print(fn())
```

should work but errors out

cc @suo
Repository: godot
Issue: GPU Driver crash on GLES 3 on Geforce 210
Labels: bug,topic:rendering,confirmed,crash

>What hardware I have?

Geforce 210

>What's my issue?

Windows and Windows manager crash if you switch to the GLES 3 mode or create a GLES 3 project.

>What version

It keeps happening since 3.2
Repository: rust
Issue: Confusing error message with `str::parse`
Labels: C-enhancement,A-diagnostics,T-compiler

The following code:

```rust
fn bar() -> Result<(), std::num::ParseIntError> {
    let a = "Hello".parse()?;
    Ok(())
}

fn main() {}
```

gives the following error message:

```
error[E0277]: the trait bound `(): std::str::FromStr` is not satisfied
 --> src/main.rs:2:21
  |
2 |     let a = "Hello".parse()?;
  |                     ^^^^^ the trait `std::str::FromStr` is not implemented for `()`

error: aborting due to previous error
```

The bound `(): std::str::FromStr` appears seemingly out of thin air. We should explain where the type `()` and trait `std::str::FromStr` come from.

The `()` appears to be produced by never-type fallback, which was quite surprising to me.
Repository: terminal
Issue: Epic: Make input and output mode process state instead of global state
Labels: Product-Conhost,Area-Server,Issue-Scenario

Notes:

> The input and output modes are global state, and while we're thinking about what it would take to change that we're definitely concerned about backwards compatibility.
> When an application exits and leaves the console in a state different from the one it has when it launched (which can happen for a number of reasons: it wasn't authored correctly, it crashes, it returns control of the console so the shell before it's ready (#4921)), we have little choice but to get into a weird state.
> You see this with most terminals on the market, unfortunately. If vim is running in mouse mode, and is abruptly terminated, suddenly moving your mouse over your terminal generates an absolute heap of garbage input. It's impossible to solve in that case, but given that we own the console subsystem in its entirety we can put together a better story.

We should investigate our options here: can we make the input or output mode process state?

If we make the input mode process-local, we need to move to an input model that miniksa and I have discussed: input records are translated (mouse -> vt, input -> vt, clipboard -> key, or clipboard -> vt) for the reader instead of upon insertion into the queue. That's a huge chunk of work.

Making the output mode process-local may have many fewer caveats. We already have some process-local output state like UTF-8 partials.

This'll solve the overarching issue in #4921 and #4949.
Repository: rust
Issue: Possibly improve the `err.stash(...)`ing API's macro friendliness
Labels: C-enhancement,A-diagnostics,P-low,A-macros,T-compiler

E.g. consider implementing https://github.com/rust-lang/rust/pull/69537#issuecomment-593082200 at some point. Right now, we will allow overwriting a stashed diagnostic, so when combined with macros, the diagnostics after the first one will be of worse quality.
Repository: pytorch
Issue: Flaky test test_ctc_loss_cuda on Windows
Labels: high priority,module: autograd,module: cuda,triaged,module: flaky-tests

## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

```
======================================================================
ERROR: test_ctc_loss_cuda (__main__.TestAutogradDeviceTypeCUDA)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\circleci\project\build\win_tmp\build\torch\testing\_internal\common_device_type.py", line 207, in instantiated_test
    return test(self, device_arg)
  File "C:\Users\circleci\project\build\win_tmp\build\torch\testing\_internal\common_device_type.py", line 365, in dep_fn
    return fn(slf, device, *args, **kwargs)
  File "test_autograd.py", line 4511, in test_ctc_loss
    gradcheck(ctc_after_softmax, [x])
  File "C:\Users\circleci\project\build\win_tmp\build\torch\autograd\gradcheck.py", line 297, in gradcheck
    'The tolerance for nondeterminism was {}.'.format(nondet_tol))
  File "C:\Users\circleci\project\build\win_tmp\build\torch\autograd\gradcheck.py", line 229, in fail_test
    raise RuntimeError(msg)
RuntimeError: Backward is not reentrant, i.e., running backward with same input and grad_output multiple times gives different values, although analytical gradient matches numerical gradient. The tolerance for nondeterminism was 0.0.

```
Example CI runs:
1. https://circleci.com/gh/pytorch/pytorch/4836419?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
2. https://circleci.com/gh/pytorch/pytorch/4824934?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link

## To Reproduce

Steps to reproduce the behavior:

1. python run_test.py -i autograd

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->
Test passes.

## Environment

Please copy and paste the output from our
[environment collection script](https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py)
(or fill out the checklist below manually).

You can get the script and run it with:
```
wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py
```

 - PyTorch Version (e.g., 1.0): master
 - OS (e.g., Linux): Windows
 - How you installed PyTorch (`conda`, `pip`, source): source
 - Build command you used (if compiling from source): `python setup.py build`
 - Python version: 3.6
 - CUDA/cuDNN version: 10.1
 - GPU models and configuration: Tesla P4
 - Any other relevant information:

## Additional context

<!-- Add any other context about the problem here. -->


cc @ezyang @gchanan @zou3519 @SsnL @albanD @gqchen @ngimel
Repository: pytorch
Issue: Extend nn.functional.softmax for arbitrary dimensions
Labels: module: nn,triaged,function request

## 🚀 Feature
<!-- A clear and concise description of the feature proposal -->
Allow dim in softmax to be: dim (python:int or tuple of python:ints).
## Motivation

<!-- Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too -->
This would allow calculation of softmax over arbitrary dimensions, which is useful in some contexts.

Example of what I'm currently doing in a project(not numerically stable):

```python

def softmax(x,dim):
    exp_x = torch.exp(x)
    return exp_x/torch.sum(exp_x,dim=dim,keepdim=True)
```
Many pytorch functions already allow a Union of int and tuples for dimensions. 
Extending this to softmax would be in line with other functions (e.g. torch.sum etc), so I think there is no ambiguity with allowing arbitrary dimensions for normalisation.

## Alternatives
None that I have found
<!-- A clear and concise description of any alternative solutions or features you've considered, if any. -->


cc @albanD @mruberry
Repository: pytorch
Issue: Set the number of CUDAStream
Labels: feature,module: cuda,triaged

## 🚀 Feature
Allow setting the number of `CUDAStream` in the stream pools

## Motivation
When running multiple inferences using different streams from different threads, the current concurrency limit is 32 (as stated in https://github.com/pytorch/pytorch/blob/master/c10/cuda/CUDAStream.h). We're using T4 which allow Concurrent Kernel Execution of 128. and would like to use more than 32 logical streams.

## Pitch
Add an API to override the `kStreamsPerPool` to allow more than 32 streams

## Additional context

https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#features-and-technical-specifications__technical-specifications-per-compute-capability


cc @ngimel
Repository: svelte
Issue: Conditional bind:this (allow undefined and conditional targets)
Labels: feature request,awaiting submitter,temp-stale

**Is your feature request related to a problem? Please describe.**

It has a lot of possible applications. Here's the latest problem I faced today.

I have a big paginated list, that has page buttons in the bottom of the list, and I want to scroll the list to the first item whenever I change the page. I want to use `scrollIntoView` method, so I need a ref to the first item of the list.

**Describe the solution you'd like**

It seems to be quite safe to allow `undefined` as a possible value for ref — it would just mean to not bind this element/component to any variable.
```html
{#each arr as item, index}
  <p bind:this={index === 0 ? ref : undefined}>{item}</p>
{/each}
```

It also seems legit from developer point of view to allow dynamic ref target with code like this:
```html
{#each arr as item, index}
  <p bind:this={cond(item) ? ref : ref2}>{item}</p>
{/each}
```

**Describe alternatives you've considered**
Right now I do this in multiple ways.

*Array of refs*. [REPL](https://svelte.dev/repl/fb849bd4c802457fa3fca9baf33e55c9?version=3.20.1). In two words:

```html
<script>
  let refs = [];
</script>

{#each arr as item, index}
  <p bind:this={refs[index]}>{item}</p>
{/each}
```
and then use `refs[0]` or `refs[refs.length - 1]` to get certain elements.

I think:

1. it is confusing
2. it might have performance implications with huge lists
3. it can even break business logic, because if your array gets smaller over time you'll end up with a bunch of null values in it. [REPL](https://svelte.dev/repl/3bb0b73b23704864a1317139a1fda366?version=3)

*Custom class name*.  Assign a conditional class via `class:custom-name={index === 0}`, and then use `document.querySelector` to get the element with this class. It is bad because of two reasons: class name clashes (need to come up with unique name) and class name duplication (one in `<script>` and one in layout).

**How important is this feature to you?**
Not that much, it just seems like a good feature to have. I'm not aware of the internals of Svelte, but I assume adding any kind of dynamic code in element binding would be a lot of pain, because it most probably happens during compile time and not in the runtime.

**Additional context**
Same ideas were mentioned in [this comment](https://github.com/sveltejs/svelte/issues/2422#issuecomment-549101659).
Repository: terminal
Issue: ReadFile: Ctrl+Z sends EOF even if console is in 'raw' mode
Labels: Product-Conhost,Help Wanted,Area-Server,Issue-Bug,Priority-2,Impact-Compatibility

# Environment

```none
Windows build number: Microsoft Windows [Version 10.0.19041.153]
.NET Core 3.1.200
```

# Steps to reproduce

C# program:

```csharp
using System;
using System.Diagnostics;
using System.Text;
using static Vanara.PInvoke.Kernel32;

namespace Test
{
    static class Program
    {
        unsafe static void Main()
        {
            var stdin = GetStdHandle(StdHandleType.STD_INPUT_HANDLE);
            var stdout = GetStdHandle(StdHandleType.STD_OUTPUT_HANDLE);

            Debug.Assert(GetConsoleMode(stdin, out CONSOLE_INPUT_MODE inMode));

            inMode |= CONSOLE_INPUT_MODE.ENABLE_VIRTUAL_TERMINAL_INPUT;
            inMode &= ~(CONSOLE_INPUT_MODE.ENABLE_PROCESSED_INPUT |
                        CONSOLE_INPUT_MODE.ENABLE_LINE_INPUT |
                        CONSOLE_INPUT_MODE.ENABLE_ECHO_INPUT);

            Debug.Assert(SetConsoleMode(stdin, inMode));

            Debug.Assert(GetConsoleMode(stdout, out CONSOLE_OUTPUT_MODE outMode));

            outMode |= CONSOLE_OUTPUT_MODE.ENABLE_VIRTUAL_TERMINAL_PROCESSING |
                       CONSOLE_OUTPUT_MODE.DISABLE_NEWLINE_AUTO_RETURN;
            outMode &= ~(CONSOLE_OUTPUT_MODE.ENABLE_PROCESSED_OUTPUT |
                         CONSOLE_OUTPUT_MODE.ENABLE_WRAP_AT_EOL_OUTPUT);

            Debug.Assert(SetConsoleMode(stdout, outMode));

            byte b = 0;

            Debug.Assert(ReadFile(stdin, (IntPtr)(&b), 1, out var r, IntPtr.Zero));

            Console.Write("Read {0} bytes; value = 0x{1:x2}", r, b);
        }
    }
}
```

(Uses the Vanara.PInvoke.Kernel32 NuGet package for convenience.)

Run the program in any console host / shell (CMD, PowerShell, Windows Terminal, etc).

# Expected behavior

Output: `Read 1 bytes; value = 0x1a` (behavior on Linux)

# Actual behavior

Output: `Read 0 bytes; value = 0x00`

---

I understand that Ctrl+Z is (roughly) Windows's equivalent to Ctrl+D to send EOF. However, I would expect it not to send EOF when the console has been put in 'raw' mode as described [here](https://docs.microsoft.com/en-us/windows/console/high-level-console-modes). This is the behavior on Unix systems for Ctrl+D when you unset `ICANON` (see [this](https://linux.die.net/man/3/tcsetattr) manual page).

Perhaps there's an additional step that I'm missing?
Repository: pytorch
Issue: Addition of Siamese loss or contrastive loss function
Labels: feature,module: loss,triaged

## 🚀 Feature

I would like to contribute to the pytorch (in python and c++) by adding the [ contrastive loss/siamese_margin_loss](http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf) function which is usually implemented  for siamese networks 

## Motivation

I have been working on siamese networks and have implemented constrastive loss/siamese_margin_loss to measure similarity between bottleneck embeddings of the autoencoder.

## Pitch

The output of the loss function is similar to that of  [TripletMarginLoss](https://github.com/pytorch/pytorch/blob/d9b97a4ffd3d65eeaccb5f8729926976fa868981/torch/nn/functional.py#L3544) but for siamese network instead of triplet network.

It returns a float value signifying the distance between the bottleneck embedding.
<!-- A clear and concise description of what you want to happen. -->


## Additional context

This loss implemented for all siamese network implementations (such as facial similarity, Omniglot examples)
<!-- Add any other context or screenshots about the feature request here. -->
Repository: ant-design
Issue: labelInValue property does not work on antd <Select>
Labels: Inactive

- [x] I have searched the [issues](https://github.com/ant-design/ant-design/issues) of this repository and believe that this is not a duplicate.

### Reproduction link
[![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/antd-reproduction-template-2etxo)

### Steps to reproduce
Select the select control, there should be 1 item in it with the text "Whatever". There is not.

### What is expected?
As per the docs
"whether to embed label in value, turn the format of value from string to {key: string, label: ReactNode}"

### What is actually happening?
reactnode labels are not being rendered. 

| Environment | Info |
|---|---|
| antd | 3.26.13 |
| React | 16.13 |
| System | Windows 10 |
| Browser | Chrome / all |


<!-- generated by ant-design-issue-helper. DO NOT REMOVE -->


Testing in **version 4** produces "Objects are not valid as a React child". So i think version 4 ignores the  labelInValue property and trys to render the value prop verbatim. It either needs support or removing from the documentation.
Repository: pytorch
Issue: Expanded tensors don't work as registered buffers
Labels: module: nn,module: error checking,triaged,module: partial aliasing

## 🐛 Bug

Consider the following code ([gist](https://gist.github.com/heiner/4e8b34c3edd66a04b11e8a3798e14656)):

```python
import torch

from torch import nn


class Module(nn.Module):
    def __init__(self):
        super(Module, self).__init__()
        self.register_buffer("mybuf", torch.arange(12).view(1, 12).expand(2, -1))


if __name__ == "__main__":
    m1 = Module()
    m2 = Module()

    try:
        m2.load_state_dict(m1.state_dict())
    except RuntimeError as e:
        # PyTorch error not very expressive (fixed in https://github.com/pytorch/pytorch/commit/c7bf4d22fe7f0de239feeb084682827c3b9a759f).
        print(e)

    # Underlying error:
    m2.mybuf.copy_(m1.mybuf)

    print(m2.mybuf)
```

The error underlying error is:

```
RuntimeError: unsupported operation: more than one element of the written-to tensor refers to a single memory location. Please clone() the tensor before performing the operation.
```

## To Reproduce

Run code above.

## Expected behavior

I can see why writing to a tensor with a non-standard stride like the one returned by `expand` is tricky. Still, there are use cases for copying the weights (and buffers) of one module into another one, and this breaks that.

The specific situation in which we are looking to have an expanded tensor as a registered buffer is when doing a batched crop centered around input-dependent positions by using `F.grid_sample`, analogous to what @soumith suggested in [this thread](https://discuss.pytorch.org/t/cropping-a-minibatch-of-images-each-image-a-bit-differently/12247).

## Environment

```
Collecting environment information...
PyTorch version: 1.4.0
Is debug build: No
CUDA used to build PyTorch: None

OS: Mac OSX 10.14.6
GCC version: Could not collect
CMake version: version 3.12.2

Python version: 3.7
Is CUDA available: No
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA

Versions of relevant libraries:
[pip3] numpy==1.16.2
[conda] Could not collect
```
Repository: flutter
Issue: Multicast_MDNS not working on iOS
Labels: platform-ios,package,p: multicast_dns,P2,team-ios,triaged-ios

## MDNS don't work in iOS

Hello,

I'm using the MDNS function, it works well on Android but not on iOS : 

```
Future<void> _incrementCounter() async{
    print('Start function');
    const String name = '_chromecast._tcp.local';
    final MDnsClient client = MDnsClient();
    await  client.start();
    print('Await Client');

      await for (PtrResourceRecord ptr in client
          .lookup<PtrResourceRecord>(ResourceRecordQuery.serverPointer(name))) {
        await for (SrvResourceRecord srv in client.lookup<SrvResourceRecord>(
            ResourceRecordQuery.service(ptr.domainName))) {
          final String bundleId =
              ptr.domainName;
          print('Dart observatory instance found at '
              '${srv.target}:${srv.port} for "$bundleId".');
        }
      }
      client.stop();

      print('Done.');
  }
```

**Expected results:** Detect chrome cast on this function

**Actual results:** There is no output. I just know that the the function blocks at "await client.start()"

<details>
  <summary>Logs</summary>

No output debug from flutter run --verbose

`Flutter analyze : `

```
No issues found! (ran in 2.9s)
```

`flutter doctor -v`

```
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76, locale fr-FR)
    • Flutter version 1.12.13+hotfix.8 at /Users/davidminard/Documents/flutter
    • Framework revision 0b8abb4724 (5 weeks ago), 2020-02-11 11:44:36 -0800
    • Engine revision e1e6ced81d
    • Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/davidminard/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] Connected device (1 available)
    • iPhone • 4efb8cc723c9901960727055771f2c2fd0102f0b • ios • iOS 13.3.1

• No issues found!
```

</details>
Repository: pytorch
Issue: libtorch memory leak
Labels: module: cpp,module: memory usage,triaged

## 🐛 Bug
result in memory leak when use libtorch. but i think that it is very strange. because i only define `torch::DeiviceType`  , then got **bug1**
### bug1
```
still reachable: 884,654 bytes in 13,927 blocks of which reachable via heuristic: stdstring :436062 bytes in 5832 blocks
```

### bug2
```
possibly lost: 3104 bytes in 22 blocks
still reachable: 1231592 bytes in 14005 blocks of which reachable via heuristic: stdstring :436062 bytes in 5832 blocks
```
## To Reproduce
### bug1
```c++
int main()
{
 torch::DeviceType device_type;
}
```
### bug2
```c++
int main()
{
 torch::DeviceType device_type;
if(torch::cuda::is_available())
{
device_type = torch::kCUDA;
}
else
{
device_type = torch::kCPU;
}
torch::Device device(device_type)
}
```


## Environment

 - PyTorch Version : 1.4
- libtorch Version: 1.4
 - OS (e.g., Linux): Ubuntu 16.04
 - How you installed PyTorch (`conda`, `pip`, source): pip
 - Python version: 3.5
 - CUDA/cuDNN version: 10


## update
- the memory leak caused by the `valgrind` tool, not bug for libtorch.
- `cuda-memcheck` is need for detect memory leak instead of `valgrind`

But `cuda-memcheck` report this error below:
```shell
Program hit cudaErrorCudartUnloading (error 4) due to "driver shutting down" on CUDA API call to cudaEventDestroy.
=========     Saved host backtrace up to driver entry point at error
=========     Host Frame:/usr/local/nvidia/lib64/libcuda.so.1 [0x377f93]
=========     Host Frame:/xxx/xxx/software/libtorch/lib/libcudart-1b201d85.so.10.1 (cudaEventDestroy + 0x18e) [0x49c8e]
=========     Host Frame:/xxx/xxx/software/libtorch/lib/libtorch.so (_ZN19cublasFixedSizePool8tearDownEv + 0xe4) [0x10a4ac34]
=========     Host Frame:/xxx/xxx/software/libtorch/lib/libtorch.so (_ZN36cublasFixedSizePoolWithGraphSuppport8tearDownEv + 0x16) [0x1083f666]
=========     Host Frame:/xxx/xxx/software/libtorch/lib/libtorch.so (cublasDestroy_v2 + 0xd0) [0xebccfd0]
=========     Host Frame:/xxx/xxx/software/libtorch/lib/libtorch.so (cudnnDestroy + 0x219) [0xf473e99]
=========     Host Frame:/xxx/xxx/software/libtorch/lib/libtorch.so [0x46cc655]
=========     Host Frame:/lib/x86_64-linux-gnu/libc.so.6 (__cxa_finalize + 0x9a) [0x3a36a]
=========     Host Frame:/xxx/xxx/software/libtorch/lib/libtorch.so [0x18ab893]
```


cc @yf225