sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: react
Issue: Update release script to handle alpha react-reconciler deps
Labels: Component: Build Infrastructure,React Core Team

This commit 1a57dc6 broke it
Repository: pytorch
Issue: Improved performance for torch.multinomial with small batches
Labels: module: performance,module: cpu,triaged

## 🚀 Feature
`torch.multinomial` (with replacement) has very poor performance with small batches but large numbers of samples or categories. In the regime of batch size N=1, categories C=100,000 and samples S=10,000, `numpy.choice` (running on CPU) is up to 4x faster than `torch.multinomial` running on a P100 GPU:

![vary_c](https://user-images.githubusercontent.com/2718714/47396316-0da88880-d6df-11e8-8d83-1d2282975c8e.png)

![vary_s](https://user-images.githubusercontent.com/2718714/47396317-113c0f80-d6df-11e8-8d1b-6d3f1a518be6.png)

![vary_n](https://user-images.githubusercontent.com/2718714/47396319-1305d300-d6df-11e8-8eb0-f0c6aaaa46f8.png)

(Full benchmarking script available here: https://github.com/jcjohnson/pytorch-multinomial-benchmark)

These benchmarks suggests that `torch.multinomial` does a good job exploiting parallelism over the batch dimension, but not over the category or sample dimensions; I feel that this could be improved to yield significantly better performance in small-batch scenarios.

(There also appear to be performance issues when sampling without replacement https://github.com/pytorch/pytorch/issues/11931)

## Motivation

After some benchmarking I found that a project I'm working on is bottlenecked by sampling in small-batch, large-sample, large-category regimes; based on above benchmarks I'm forced to perform the sampling on CPU with numpy for the best performance; this both feels wrong and still causes sampling to be the bottleneck.

## Pitch

I'm not terribly familiar with details of the current CUDA backend, but when sampling with replacement it should be possible to exploit parallelism over the sample dimension to achieve significantly improved performance over numpy.
Repository: flutter
Issue: Embedded UIViews don't show in scene snapshots
Labels: c: new feature,platform-ios,engine,a: platform-views,P2,team-ios,triaged-ios
Repository: kubernetes
Issue: Service objects should be annotated by cloud-providers to track underlying resources.
Labels: sig/network,kind/feature,lifecycle/frozen,sig/cloud-provider

/kind feature

## What we want to do

We need to add an extra field `Service.Status.LoadBalancer.Ingress[0].ProviderID` in Service object to identify the CloudProvider SLB id , like what we did in Node object.
This would benefit cloudprovider for supporting rename SLB. 

## Reason
Cloud Provider createed a LoadBalancer for service with Type equals LoadBalancer.  However, Service object does not provide a way to record cloudprovider`s SLB Id .  So, each cloudprovider create the loadbalancer with a name generated from service object use the code below which is meaningless string and also NOT UNIQ for the cloud service.   People can change the name from cloud console which result in a failure in kubernetes cloudprovider.(CloudProvider would failed to find the SLB again after the name change) 

We found that if we could add an extra field named `ProviderID` in the Service.Status.LoadBalancer field then we would allow user to rename their LB name freely. 

Like what we did in Node Spec. 

Hope to hear feedback from the community.

CloudProvider auto generate an SLB name with the following code . 
`
// TODO(#6812): Use a shorter name that's less likely to be longer than cloud
// providers' name length limits.
func GetLoadBalancerName(service *v1.Service) string {
	//GCE requires that the name of a load balancer starts with a lower case letter.
	ret := "a" + string(service.UID)
	ret = strings.Replace(ret, "-", "", -1)
	//AWS requires that the name of a load balancer is shorter than 32 bytes.
	if len(ret) > 32 {
		ret = ret[:32]
	}
	return ret
}
`
Which is meaningless string.
Repository: pytorch
Issue: [caffe2]How can I export init_net.pb and predict_net.pb files on my own?
Labels: caffe2,triaged

I want to convert the retinanet in Caffe2/Detectron to an onnx model, but I need to prepare init_net.pb and predict_net.pb files first. Followed by the script bellow I got these two files, but when I tried to run the convert procedure an error occured and I don't know how to handle this. Can anybody help me with this problem?
####################
script to generate .pb files:

def SaveNet(INIT_NET, PREDICT_NET, workspace, model):
      init_net, predict_net = mobile_exporter.Export(
         workspace, model.net, model.params
      )
      with open(PREDICT_NET, 'wb') as f:
              f.write(model.net._net.SerializeToString())
      with open(INIT_NET, 'wb') as f:
              f.write(init_net.SerializeToString())
      print("== saved init_net and predict_net. ==")

#############################
script to convert files to onnx:
import os
os.environ['CUDA_VISIBLE_DEVICES']='0'
import onnx
import caffe2.python.onnx.frontend
from caffe2.proto import caffe2_pb2
data_type = onnx.TensorProto.FLOAT
data_shape = (1, 3, 480, 640)
value_info = {
          'gpu_0/data': (data_type, data_shape)
       }
predict_net = caffe2_pb2.NetDef()
with open('predict_net.pb', 'rb') as f:
         predict_net.ParseFromString(f.read())
init_net = caffe2_pb2.NetDef()
with open('init_net.pb', 'rb') as f:
         init_net.ParseFromString(f.read())
onnx_model = caffe2.python.onnx.frontend.caffe2_net_to_onnx_model(
                         predict_net,
                         init_net,
                         value_info,
                        )
onnx.checker.check_model(onnx_model)

##############################
ERROR:
[E net_async_base.cc:422] [enforce fail at context_gpu.cu:343] error == cudaSuccess. 77 vs 0. Error at: /home/bjtu/Downloads/pytorch/caffe2/core/context_gpu.cu:343: an illegal memory access was encounteredError from operator:
input: "gpu_0/conv1_3" output: "gpu_0/pool1_1" name: "" type: "MaxPool" arg { name: "kernel" i: 3 } arg { name: "order" s: "NCHW" } arg { name: "pad" i: 1 } arg { name: "cudnn_exhaustive_search" i: 0 } arg { name: "stride" i: 2 } device_option { device_type: 1 device_id: 0 } engine: "CUDNN", op MaxPool
[F context_gpu.h:118] Check failed: error == cudaSuccess an illegal memory access was encountered

System information
Operating system: ubuntu16.04
Compiler version: gcc 5.4.0
CUDA version: 8.0
cuDNN version: 7.1.4
NVIDIA driver version: 384.130
GPU models (for all devices if they are not all the same): quadro m5000
PYTHONPATH environment variable: ?
python --version output: 2.7
Anything else that seems relevant: ?
Repository: pytorch
Issue: [caffe2] How to handle multiple inputs and multiple outputs in the network architecture?
Labels: caffe2

Is it currently possible to handle multiple inputs and multiple outputs in the network architecture in CAFFE2?
Repository: TypeScript
Issue: Imports in .d.ts files break wildcard modules declarations
Labels: Bug,Help Wanted,Domain: Related Error Spans

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common "Bugs" That Aren't Bugs section!

Please help us by doing the following steps before logging an issue:
  * Search: https://github.com/Microsoft/TypeScript/search?type=Issues
  * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ

Please fill in the *entire* template below.
-->

<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
**TypeScript Version:**  3.1.3

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:**

import d.ts wildcard module

**Code**

main.ts
```ts
/// <reference path="./typings.d.ts" />

import template from './template.html';
```
typings.d.ts
```ts
import * as _angular from 'angular';

declare module '*.html' {
  const content : string;
  export default content;
}
```

```json
{
  "name": "ts-bug",
  "version": "1.0.0",
  "dependencies": {
    "angular": "^1.7.5"
  }
}
```
Compile with:
```sh
tsc main.ts
```

**Expected behavior:**

Compiled without errors.

**Actual behavior:**
Compiled with error
```
main.ts:3:22 - error TS2307: Cannot find module './template.html'.

3 import template from './template.html';
                       ~~~~~~~~~~~~~~~~~
```
Removing `import * as _angular from 'angular';` fixes the issue.

**Side Note 1**

Regular module declarations work regardless of imports being present.

**Side Note 2**
`import * as _angular from 'angular';` is needed to later do:
```ts
declare global {
  const angular : typeof _angular;
}
```
to workaround https://github.com/Microsoft/TypeScript/issues/10178
Repository: TypeScript
Issue: SourceRoot documentation inconsistent
Labels: Docs

In the [compiler options documentation](https://www.typescriptlang.org/docs/handbook/compiler-options.html) is `sourceRoot` explained as follows:
>  Specifies the location where debugger should locate TypeScript files instead of source locations. Use this flag if the sources will be located at run-time in a different location than that at design-time. The location specified will be embedded in the sourceMap to direct the debugger where the source files will be located.

In the [documentation of the `extends` property](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) is explained that all path are relative to the file they originated in.
>  All relative paths found in the configuration file will be resolved relative to the configuration file they originated in.

I have understood that the path in `sourceRoot` is relative to the compiled files and points to the source files. `sourceRoot` is not relative to the configuration file it originates in. If I use a path relative to the configuration file, the source files are not found. 

**Expected behavior:**
The documentation must be consistent or the path must be relative to the file they originated in.
Repository: rust
Issue: Misleading/unhelpful error message from borrow checker
Labels: C-enhancement,A-diagnostics,A-lifetimes,T-compiler,D-confusing

The following program, when compiled, gives rise to a misleading and unhelpful error message:
```
use std::io;

enum Error<'a> {
    Invalid(&'a [u8]),
    Io(io::Error),
}

struct Thing {
    counter: usize
}

enum Result<'a> {
    Done,
    Error(Error<'a>),
    Value(usize)
}

impl Thing {
    fn new() -> Self {
        Self { counter: 0 }
    }

    fn process(&mut self) -> Result {
        self.counter += 1;
        Result::Done // for now
    }
}

fn main() {
    let mut thing = Thing::new();
    loop {
        let result = thing.process();
        match result {
            Result::Done => {
                break;
            }
            Result::Error(e) => panic!(e),
            Result::Value(v) => {
                println!("{}", v);
            }
        }
    }
}
```

The message is:
```
   Compiling playground v0.0.1 (/playground)
error[E0499]: cannot borrow `thing` as mutable more than once at a time
  --> src/lib.rs:32:22
   |
32 |         let result = thing.process();
   |                      ^^^^^ mutable borrow starts here in previous iteration of loop
   |
   = note: borrowed value must be valid for the static lifetime...

error: aborting due to previous error
```

However, the mutable borrow complaint appears remote from the true reason for the error.

The key to determining the problem, as analysed by Daniel Keep  [here](https://users.rust-lang.org/t/trying-to-understand-lifetimes-in-loops/21356/2), is the exact language of the error message:

> note: borrowed value must be valid for the static lifetime...

At first glance, there are no static borrows anywhere in the code. But what's actually happening is that when there's the `panic!(e)`, `e` is being used as the literal panic payload. In order for that to work, `e` itself must live forever. But, as `Error` contains a borrow, that borrow must live forever.

But the `'a` lifetime of that `Error` borrow is tied to the `'a` lifetime in `Result`. And that lifetime is tied to the lifetime of `self`, which is in turn the required lifetime of the `thing` variable.

So `thing` has to be `'static`, but it cannot be `'static` because it’s on the stack.

It's not immediately obvious how best to improve the error message, but the current message isn't helpful, because it points to the borrow in the loop.

Apparently Polonius doesn't give any better message.

Links which may be useful:

[The sample in Rust Playground](https://play.rust-lang.org/?version=beta&mode=debug&edition=2018&gist=f9737238a4c8b43305e0f08487aa668a)
[Discussion on users.rust-lang.org](https://users.rust-lang.org/t/trying-to-understand-lifetimes-in-loops/21356)
Repository: electron
Issue: Custom drag and drop type
Labels: enhancement :sparkles:

**Problem**
Right now, to start a file drag you call `WebContents.startDrag({ file:<path>, icon:<path> })`. This will spawn the following DataTransfer object: 
```
DataTransfer {
  dropEffect: 'none',
  effectAllowed: 'copyLink', 
  files: FileList, 
  items: DataTransferItemList, 
  types:['Files',..]
}
```
with `FileList` containing the proper file(s).

The issue is the `effectAllowed`, which when set to `'copyLink'` will not allow dragging and dropping files from the electron BrowserWindow to say Discord as they only allow dropped items with the 'move' effect from what I can see.

**Solution**
I propose allowing either changing the default from 'copyLink' to 'copyMove', OR allowing users to pass the drop effect as an argument to `WebContents.startDrag`.

**File changes**
[drag_utils_views.cc (Line 20)](https://github.com/electron/electron/blob/6f91af93433df4e9c0e7fb592e5b2dcb0b1c7888/atom/browser/ui/drag_util_views.cc#L20) - add argument for `DragFileItems` to accept a drop type (should be an int AFAIK, the [Chromium `DragOperation`s are defined here](https://chromium.googlesource.com/chromium/src/+/66.0.3359.158/ui/base/dragdrop/drag_drop_types.h#17)).
[drag_utils_views.cc (Line 45)](https://github.com/electron/electron/blob/6f91af93433df4e9c0e7fb592e5b2dcb0b1c7888/atom/browser/ui/drag_util_views.cc#L45) - `ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK` changed to a variable passed to the function.
[drag_utils.h (Line 18)](https://github.com/electron/electron/blob/6f91af93433df4e9c0e7fb592e5b2dcb0b1c7888/atom/browser/ui/drag_util.h#L18) - add argument for `DragFileItems` to accept a drop type.
[drag_util_mac.mm (Line 28)](https://github.com/electron/electron/blob/6f91af93433df4e9c0e7fb592e5b2dcb0b1c7888/atom/browser/ui/drag_util_mac.mm#L28) - may need to add argument to `DragFileItems` to accept a drop type too for compatibility with MACOSX. (I did not see how the drag type could be changed for osx, if they even use drag types the way windows does.)
[atom_api_web_contents.cc (Line 1736)](https://github.com/electron/electron/blob/cb9be091aa203f27496b2b8993e10b5c554525c4/atom/browser/api/atom_api_web_contents.cc#L1736) - get the drop type from `item` like
```
int item;
if (!item.Get("dropType", &item)) {
  item = <some default drop type value, like ui::DragDropTypes.DRAG_COPY | ui::DragDropTypes.DRAG_LINK as it was previously>
}
```
[atom_api_web_contents.cc (Line 1754)](https://github.com/electron/electron/blob/cb9be091aa203f27496b2b8993e10b5c554525c4/atom/browser/api/atom_api_web_contents.cc#L1754) - pass argument for drop type.


**Outcome**
Example usage of WebContents.startDrag could now be
```
contents.startDrag({
  file: 'C:/example/file.png',
  icon: 'myico.png',
  dropType: 3, // 3 for copyMove
})
```
Repository: opencv
Issue: VideoCapture will fail after open it many (about 99xx) times 
Labels: category: videoio(camera)

##### System information 
- OpenCV => 2.4.13.6
- Operating System / Platform => windows7 64bit, windows10  
- Compiler => VS2015 
- WebCam => USB webcam

##### Detailed description

I found that open videocapture will fail when I did it many times.
It always failed around the 99xx times. 

The testing code is quite simple as the following.
I show image when loop > 9900 since it will be easier to tell if the webcam still alive.

Is it an known issue or  I did something wrong?
Thanks for comments.

##### Steps to reproduce

 ```
int main()
{
	Mat image;
	VideoCapture cap;      

	int i = 0;
	for (i = 0; i < 11000; i++)
	{			
		cap.open(0);          
		if (cap.isOpened())  
		{
			printf("open ok at:%d\n", i);

			if (i > 9900) //read and show image after loop 9900
			{
				cap >> image;        
				imshow("Webcam live", image);
				waitKey(100);												
			}
		}
		else
		{
			printf("open fail at:%d\n", i);
		}

	}

	return 0;

}
 ```
Repository: go
Issue: wasm: browser compatibility policy
Labels: DevExp,arch-wasm

I would like to propose a discussion on how we want to handle browser compatibility. There are several features being worked on: https://github.com/WebAssembly/proposals When do we want to use them? Do we want to offer backwards-compatibility?

Here are my own thoughts, open for debate:

(1) Go's support for WebAssembly is experimental and it should stay experimental at least until WebAssembly itself is fully standardized (right now the main spec is still in "Phase 2 - Proposed Spec Text Available").

(2) The WebAssembly project itself has no clear answer yet on how feature tests and backwards compatibility should work, see https://webassembly.org/docs/feature-test/

(3) Modern browsers (except Safari) have auto-update mechanisms, so staying with the latest version shouldn't be an issue for most users.

Due to (1), (2) and (3) I would opt for no backwards compatibility as long as Go's support for WebAssembly is experimental.

New WebAssembly features can be adopted as soon as they are marked as "standardized" and are supported by the latest stable Chrome, Firefox, Edge and Safari (on desktop).
Repository: pytorch
Issue: Generalized Data Class
Labels: module: dataloader,triaged,module: data

## Generalized Data Class Feature
I suggest to add an abstract `Data` class in the `torch.utils.data` module. The goal of which is to group a couple of data batching behaviors for the user to define: batch together arbitrary `Data` objects, `chunk`/`split` arbitrary batched data objects across batch dimension, move arbitrary data to `device`, `shared_memory`, `pin_memory`...

## Motivation

Deep learning is becoming more and more flexible and not all data is in the form `(X, y)`, that is why the current [`default_collate`](https://github.com/pytorch/pytorch/blob/ca03c10cefa1e126eab1446d490f9314bd236c1b/torch/utils/data/dataloader.py#L196) of the `Dataloader` already supports `tuple` and `dict`. Nonetheless:
  - A user may want to organize its data in an object with stronger type than `dict` and `tuple`;
  - Not all batching is done by applying `torch.stack` on individual elements.

The propose class is an easy to understand abstraction that could be passed from a `Dataset` to a `Dataloader`.

In addition to `Dataloader`, this could also be used to define how to split data in `DataParallel`.
 
## Pitch

A incomplete implementation could look like this:
```python
from abc import ABC, abstractmethod

class Data(ABC):
    @abstractmethod
    def apply(self, func: Callable) -> None:
    """Apply a function on all tensors in the data class.

    Could be passed functions like `lambda t: t.pin_memory()`, `lambda t: t.to(device)`.
    """

    @abstractmethod
    @classmethod
    def batch(cls, data_points: List[Data]) -> Data:
    """Batch together multiple data object."""

    @abstractmethod
    def split(self, chunks) -> List[Data]:
    """Split the data into chunks across the data dimension."""
```
Here I've represented individual data points and batched data with the same class, but this need not be the case.

And in the `default_collate`, we would have something like:
```python
if isinstance(batch[0], Data):
    # apply logic using` batch[0].__class__.batch`, and `batch.apply`
```
## Alternatives

It is already possible to have some of the desired behavior using a custom `collate_fn`. However if the user returns a class instead of `tuple` or `dict`, `pin_memory` will [not be applied](https://github.com/pytorch/pytorch/blob/ca03c10cefa1e126eab1446d490f9314bd236c1b/torch/utils/data/dataloader.py#L237). Furthermore, the user also needs to be aware of the `_shared_memory` [variable](https://github.com/pytorch/pytorch/blob/ca03c10cefa1e126eab1446d490f9314bd236c1b/torch/utils/data/dataloader.py#L203) to reproduce in their own `collate_fn` to leverage this.

## Additional context

A pratical example can be found in [Pytroch_geometric](https://rusty1s.github.io/pytorch_geometric/build/html/notes/introduction.html), where the author went into the trouble of redefining many `Dataloader` behaviors.


cc @VitalyFedyunin @ejguan @SsnL
Repository: rust
Issue: `Eq + Hash` rule is broken when mixing `OsStr` and `Path`
Labels: C-bug,T-libs

This program surprisingly fails:

```rust
use std::{
    ffi::OsStr,
    path::Path,
    collections::hash_map::DefaultHasher,
    hash::{Hash, Hasher},
};

fn hash<T: ?Sized + Hash>(v: &T) -> u64 {
    let mut sh = DefaultHasher::new();
    v.hash(&mut sh);
    sh.finish()
}

fn main() {
    let s = OsStr::new("/dev/null");
    let p = Path::new("/dev/null");
    assert_eq!(s, p);
    assert!(
        hash(s) == hash(p),
        "Hashes differ for values that compare as equal"
    );
}
```

The problem is that the provided impls of `PartialEq`, while convenient, cross the data domains and break the intuition on matching behavior of `Hash` and `==`. This does not affect `HashMap` due to lack of a cross-type `Borrow` impl, but the inconsistency can bite the unwary.
Repository: go
Issue: x/build/cmd/gomote: 502 Bad Gateway error
Labels: Builders,NeedsInvestigation

I often encounter this 502 Bad Gateway error while actively working with a buildlet created using gomote. I guess this is because I was holding the buildlet too long (~30min) and there is a hidden time limit on each buildlet. If so, we need a better error message than this:

<pre>
$ gomote ls user-hakim-windows-amd64-2016-0
Error running ls: 502 Bad Gateway: 
</pre>

And, `gomote list` still shows the lease is not yet expired. That's misleading.
<pre>
$ gomote list
user-hakim-windows-amd64-2016-0	windows-amd64-2016	host-windows-amd64-2016	expires in 29m49.611152102s
</pre>