sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: Sparse matrices in dataloader error
Labels: module: sparse,triaged

I have noticed that using sparse matrices with a DataLoader works only if num_processes = 0.

Example:

```
import torch
from torch.utils.data import DataLoader

print('torch version: ', torch.__version__)

i = torch.LongTensor([[0, 1, 1], [2, 0, 2]])
v = torch.FloatTensor([3, 4, 5])
sparse_tensor = torch.sparse.FloatTensor(i, v, torch.Size([2, 3]))

dataset_sp = 2 * [sparse_tensor]


def collate_fn(batch):
    return batch[0]


loader = DataLoader(dataset_sp, batch_size=1, collate_fn=collate_fn)

print('num_workers=0: ')
for i, b in enumerate(loader):
    print(i, b.size())

loader = DataLoader(dataset_sp, batch_size=1, collate_fn=collate_fn, num_workers=1)

print('num_workers=1: ')
for i, b in enumerate(loader):
    print(i, b.size())
```

Gives the result:

```
torch version:  0.2.0+5989b05
num_workers=0:
0 torch.Size([2, 3])
1 torch.Size([2, 3])
num_workers=1:
Process Process-1:
Traceback (most recent call last):
  File "/Users/liam/anaconda/lib/python3.6/multiprocessing/process.py", line 249, in _bootstrap
    self.run()
  File "/Users/liam/anaconda/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/liam/anaconda/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 45, in _worker_loop
    data_queue.put((idx, samples))
  File "/Users/liam/anaconda/lib/python3.6/multiprocessing/queues.py", line 348, in put
    obj = _ForkingPickler.dumps(obj)
  File "/Users/liam/anaconda/lib/python3.6/multiprocessing/reduction.py", line 51, in dumps
    cls(buf, protocol).dump(obj)
  File "/Users/liam/anaconda/lib/python3.6/site-packages/torch/multiprocessing/reductions.py", line 46, in reduce_tensor
    metadata = (tensor.storage_offset(), tensor.size(), tensor.stride())
AttributeError: 'torch.sparse.FloatTensor' object has no attribute 'storage_offset'
```

cc @vincentqb
Repository: vue
Issue: Issues with v-model.number
Labels: discussion

### Version
2.5.8

### Reproduction link
[https://jsfiddle.net/50wL7mdz/79189/](https://jsfiddle.net/50wL7mdz/79189/)

### Steps to reproduce
Included in fiddle

### What is expected?
Input type='number' should  not clear values, accept stings formatted in different locales. v-model.number should not return string.

### What is actually happening?
Input value is cleared sometimes, v-model.number returns "" for "" and partially typed numbers.

---
This issue started with topic on forum https://forum.vuejs.org/t/extra-directive-for-number-inputs/22438, it was suggested to open an issue for that. Here is original post:

Hi!

I've found that `v-model.number` has limitations and requires some boilerplate in some cases. This is mostly because `input[type="number"]` returns `''` for partially input numbers (like `1.`). Here are some problems with it:

- App has no difference when input is either empty or invalid/partial.
- Bound attribute has to be of `[String, Number]` type.
- `''`, `undefined`, and `0` are falsy values. This leads to `val !== ''` checks in all places this attribute is used.

2nd and 3d issues can be solved with computed property, but it's hard to implement for nested ones and array of values.

I came to using separate field for casted values: 

```
<input
  type='number' 
  v-model='obj.val' 
  @input='$set(obj, "valCasted", _nOrNull($event.target.value))'
/>
```

I wanted to it implement with custom directive (like `v-model-number='obj.valCasted'`), but I see that `v-model` is handled differently by compiler. This way it can automatically use `$set` when property is not defined on object. But I have not found how this  can be implemented with custom directives.

 So here are questions :)  :

- Is there a better way to work with `input[type="number"]`?
If not:
- Can this be implemented with custom directives as convenient as `v-model` is?
- Should this be added to vue?

-----

After that post I've tried to implement custom component, it's included in fiddle, but it also has some issues.
I've also added different types of inputs to fiddle to check their behaviour and checked against different locales.

Thank you!

<!-- generated by vue-issues. DO NOT REMOVE -->
Repository: opencv
Issue: features2d wrapper without flann module
Labels: bug,category: python bindings,category: build/install,category: features2d,category: flann

<!--
If you have a question rather than reporting a bug please go to http://answers.opencv.org where you get much faster responses.
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).

This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
-->

##### System information (version)

- OpenCV => 3.3.1
- Operating System / Platform => Ubuntu 16.04
- Compiler => /usr/bin/c++ (ver 5.4.0)

##### Detailed description

[FlannBasedMatcher](https://github.com/opencv/opencv/blob/master/modules/features2d/include/opencv2/features2d.hpp#L1115) has two methods, constructor `FlannBasedMatcher` and `create()` that can't be wrapped without optional flann module but `CV_WRAP` ignores `#ifdef HAVE_OPENCV_FLANN`.

<!-- your description -->

##### Steps to reproduce

```
cmake -DBUILD_LIST=features2d,python2 .. && make -j8
```
Repository: rust
Issue: trait implementation hidden by where clause
Labels: A-trait-system,T-compiler,A-inference,C-bug,T-types

In both cases in the code below, the trait implementation `impl Op<()> for Single` seems to be hidden by the clause `where Single: Op<T>`. Using universal function call syntax works as a workaround.

```rust
trait Op<T> {
    fn op(&self, t: T);
}

struct Single;

impl Op<()> for Single {
    fn op(&self, _t: ()) {}
}

struct Pair {
    a: Single,
    b: Single,
}

// case 1
fn foo<T>(pair: Pair, t: T)
where
    Single: Op<T>,
{
    pair.a.op(t);
    // this fails to compile:
    pair.b.op(());
    // this works: <Single as Op<()>>::op(&pair.b, ());
}

// case 2
impl<T> Op<T> for Pair
where
    Single: Op<T>,
{
    fn op(&self, t: T) {
        self.a.op(t);
        // this fails to compile:
        self.b.op(());
        // this works: <Single as Op<()>>::op(&self.b, ());
    }
}
```

The error messages:
```
error[E0308]: mismatched types
  --> lib.rs:23:15
   |
23 |     pair.b.op(());
   |               ^^ expected type parameter, found ()
   |
   = note: expected type `T`
              found type `()`

error[E0308]: mismatched types
  --> lib.rs:35:19
   |
35 |         self.b.op(());
   |                   ^^ expected type parameter, found ()
   |
   = note: expected type `T`
              found type `()`
```
Repository: vue
Issue: shouldPrefetch enhancement
Labels: feature request

### What problem does this feature solve?
Currently, I use
`import(/* webpackChunkName: "lang-[request]" */ json!yaml!./myForm.lang.${currentLocale}.yaml)`
to load the appropriate translation for my components.

This generates `numberOfForms * numberOfLangages` chunks that are prefetched when the application starts.

I would like to load only translations for the current language.

`shouldPrefetch(file, type)` gives
```
0.js script
1.js script
2.js script
...
```
There is not enough information to filter files that should not been prefetched.

### What does the proposed API look like?
I don't know what are the available information at `shouldPrefetch`.
But probably API should look like:
`shouldPrefetch(file, type, originalFilename)`

<!-- generated by vue-issues. DO NOT REMOVE -->
Repository: pytorch
Issue: Implement DE in pytorch.optim
Labels: module: optimizer,triaged,enhancement,needs research

Hi,

I’d like to use PyTorch to run Evolutionary algorithms on GPU. I noticed that DE (differential evolution) is implemented in Torch (https://github.com/torch/optim/blob/master/de.lua), so I was thinking to implement DE in PyTorch.

As DE is not (widely) used in Deep Learning I wanted to check with you if it is in your interest to have DE implemented in PyTorch? I’m happy to discuss the implementation and create PR when ready.

Once I learn more about PyTorch (by implementing DE) I’d also like to implement Genetic algorithm (GA) in the near future.

Best,
Dejan

cc @vincentqb
Repository: flutter
Issue: Enable the Flutter tool to change app id after project creation
Labels: c: new feature,tool,P3,team-tool,triaged-tool

The app id can be set when a project is created using --org.

It'd be great if the flutter tool could also update the app id after the project's been created, so that the Android and Xcode projects don't have to be manually edited.
Repository: react-native
Issue: [iOS] TextInput clear button is not accessible
Labels: Component: TextInput,Accessibility,Accessibility Team - Evaluated

### Is this a bug report?
Yes

### Have you read the [Contributing Guidelines](https://facebook.github.io/react-native/docs/contributing.html)?
Yes

### Environment

Environment:
  OS: macOS High Sierra 10.13.1
  Node: 6.12.0
  Yarn: 1.3.2
  npm: 5.5.1
  Watchman: 4.7.0
  Xcode: Xcode 9.1 Build version 9B55
  Android Studio: 3.0 AI-171.4408382

Packages: (wanted => installed)
  react: 16.0.0-beta.5 => 16.0.0-beta.5
  react-native: ^0.49.5 => 0.49.5

Target Platform: iOS (9)

### Steps to Reproduce
https://snack.expo.io/S1EkFy5gG

1. Input any text for the clear button to appear.
2. Turn on Voice Over
3. Try to select the clear button.

### Expected Behavior
"Clear" button can be selected and activated. iOS native text input control supports it.

### Actual Behavior
Voice Over cannot focus on the "clear" button.

### Reproducible Demo
https://snack.expo.io/S1EkFy5gG
Repository: rust
Issue: API convention for blocking-, timeout-, and/or deadline-related functions
Labels: C-enhancement,T-libs-api,B-unstable,A-time

The standard library currently exposes several blocking- and/or timeout-related functions:

Function \ Versions | Blocking | Timeout (ms) | Timeout
--- | --- | --- | ---
`std::sync::Condvar::wait*` | `wait` | `wait_timeout_ms` | `wait_timeout`
`std::sync::mpsc::Receiver::recv*` | `recv` | none | `recv_timeout`
`std::thread::park*` | `park` | `park_timeout_ms` | `park_timeout`
`std::thread::sleep*` | none | `sleep_ms` | `sleep`

The timeout versions taking a `u32` in milliseconds are actually deprecated for the version taking a `Duration` since `1.6.0`.

This issue tracks the possibility to extend these APIs and provide a convention for blocking-, timeout-, and/or deadline-related functions. The current suggestion is:

Function \ Versions | Blocking | Timeout | Deadline
--- | --- | --- | ---
`std::sync::Condvar::wait*` | `wait` | `wait_timeout` | `wait_deadline`
`std::sync::mpsc::Receiver::recv*` | `recv` | `recv_timeout` | `recv_deadline`
`std::thread::park*` | `park` | `park_timeout` | `park_deadline`
`std::thread::sleep*` | none | `sleep_for` | `sleep_until`

The blocking versions do not take any extra argument and are not suffixed. The timeout versions take a timeout as a `Duration` and return if this timeout is reached (the timeout starts when the function is called with best-effort precision). They are suffixed by `_timeout`. The deadline versions take a deadline as an `Instant` and return if this deadline is reached (the deadline precision is best-effort). They are suffixed by `_deadline`.

For functions that do not have a meaningful blocking version (like sleep which would essentially block until the program ends), the timeout version would be suffixed by `_for` and the deadline version would be suffixed by `_until`. We don't have enough data-points to see if this rule is actually applicable. In a first iteration, we could leave aside those functions that do not have a meaningful blocking version.
Repository: react
Issue: Resetting a form containing a focused controlled number input puts it out of step with state
Labels: Type: Bug,Component: DOM

Here's a fixture demonstrating the issue (first test case): http://react-number-input-form-reset-bug.surge.sh/number-inputs

If you have a controlled number input within a form containing a reset button, hitting Enter can trigger that reset event. This causes the focused input to be reset to the `defaultValue`, which won't be in sync with the tracked value because we do that work on blur for number inputs to avoid triggering validation warnings. This doesn't affect other input types, since the tracked value is updated immediately.

This might be a viable tradeoff for avoiding those validation warnings, so I'm not sure if this is actionable, but I wanted to at least document it for future reference.


cc @nhunzaker @gaearon
Repository: go
Issue: runtime: gdb tests fail on NetBSD
Labels: help wanted,OS-NetBSD,NeedsInvestigation,compiler/runtime

The netbsd-amd64-8branch (NetBSD 8.0+) builder is back and NetBSD is kinda working for the first time in ages.

But only kinda.

The runtime tests fail with a timeout about two thirds of the time.

Examples:

https://build.golang.org/log/9ff11d9a995eb3b2555ce8f88bb3280c91639386
https://build.golang.org/log/d9a762c61874b62e34cec30f79ddc21a190922f7
https://build.golang.org/log/7ab9f1d000be47604a25b1ebf17fc55f5799d0ec
https://build.golang.org/log/6678e6c8dfb7533054836eb140f9eff8416e3a30

Many more at https://build.golang.org.

It'd be nice to have NetBSD happy for Go 1.10, considering the Go 1.9 news that NetBSD support was dead (https://golang.org/doc/go1.9#known_issues) which prompted a number of people to help fix things up.

/cc @aclements @ianlancetaylor @bsiegert
Repository: go
Issue: x/text: cgo changes broke golang.org/x/text/collate/tools/colcmp on Darwin
Labels: OS-Darwin,NeedsFix

The golang.org/x/text/collate/tools/colcmp binary no longer compiles at Go tip. (It works at Go 1.9 and Go 1.8)

https://build.golang.org/log/6a0073f83d8b33849ca6b8f57120b1161e849c32
```
# golang.org/x/text/collate/tools/colcmp
/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/gopath/src/golang.org/x/text/collate/tools/colcmp/darwin.go:41: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithBytes
/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/gopath/src/golang.org/x/text/collate/tools/colcmp/darwin.go:48: cannot use nil as type _Ctype_CFAllocatorRef in argument to func literal
/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/gopath/src/golang.org/x/text/collate/tools/colcmp/darwin.go:76: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithCharactersNoCopy
/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/gopath/src/golang.org/x/text/collate/tools/colcmp/darwin.go:79: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithCharactersNoCopy
/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/gopath/src/golang.org/x/text/collate/tools/colcmp/darwin.go:82: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithCharactersNoCopy
/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/gopath/src/golang.org/x/text/collate/tools/colcmp/darwin.go:85: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithCharactersNoCopy
/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/gopath/src/golang.org/x/text/collate/tools/colcmp/darwin.go:93: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithBytesNoCopy
/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/gopath/src/golang.org/x/text/collate/tools/colcmp/darwin.go:98: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithBytesNoCopy
/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/gopath/src/golang.org/x/text/collate/tools/colcmp/darwin.go:101: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithBytesNoCopy
/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/gopath/src/golang.org/x/text/collate/tools/colcmp/darwin.go:106: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithBytesNoCopy
/var/folders/dx/k53rs1s93538b4x20g46cj_w0000gn/T/workdir/gopath/src/golang.org/x/text/collate/tools/colcmp/darwin.go:106: too many errors
```
Repository: neovim
Issue: tnoremap <Esc> <C-\><C-n>
Labels: enhancement,defaults,terminal

Can we please make this default?

Personally I believe it would add quite a bit to the popularity of :terminal if people knew that you can use normal mode in a terminal buffer.
Repository: go
Issue: net: LookupHost shows different results between GODEBUG=netdns=cgo and go
Labels: help wanted,NeedsFix


### What version of Go are you using (`go version`)?
go version go1.9.2 darwin/amd64

### What did you do?

```
package main

import (
	"net"
	"fmt"
)

func main() {
	fmt.Println(net.LookupHost("10.256"))
	fmt.Println(net.LookupHost("10.256.1"))
	fmt.Println(net.LookupHost("10.10.256"))
	fmt.Println(net.LookupHost("10.10.256.1"))
	fmt.Println(net.LookupHost("10.10.10.256"))
}
```


### What did you expect to see?

This program works fine on both Linux & Windows and does show below output, but not on Mac
```
[] lookup 10.256: no such host
[] lookup 10.256.1: no such host
[] lookup 10.10.256: no such host
[] lookup 10.10.256.1: no such host
[] lookup 10.10.10.256: no such host
```

### What did you see instead?
```
[10.0.1.0] <nil>
[] lookup 10.256.1: no such host
[10.10.1.0] <nil>
[] lookup 10.10.256.1: no such host
[] lookup 10.10.10.256: no such host
```
Repository: pytorch
Issue: [docs] Tensor.new is not documented
Labels: module: docs,triaged

Docs master has in http://pytorch.org/docs/master/tensors.html:

new(*args, **kwargs)
Constructs a new tensor of the same data type.

Missing documentation of arguments. From some other pages it can be figured out that `new` is preserving the storage and even the device number and can take a size argument. Would be good to have complete specs.
Repository: rust
Issue: [docs] unclear how to create a Box<[T]> from a pointer and a length
Labels: C-enhancement,P-medium,T-libs-api,E-medium,A-docs

I wanted to create a `Box<[T]>` from a pointer and a length and neither the docs of `slice` or `Box` were helpful. 

It wasn't hard (`Box::from_raw(slice::from_raw_parts_mut(ptr, len) as *mut [u8])`), but the experience could have been better.
Repository: go
Issue: archive/tar: Header.FileInfo.Mode.IsRegular reports true for non-regular files
Labels: NeedsDecision

### Background ###

A tar file is a format for archiving a filesystem and is able to represent anything including regular files, directories, block and character devices, symlinks, and hardlinks.

Over the years, many incompatible extensions to tar have become common practice. Specifically, one them is the use of pseudo-files to encode additional information about a file or a set of files. A pseudo-file is encoded in the same way as a normal file, but the `Header.Typeflag` is set to some special value and the contents of the file are parsed according to some format determined by the typeflag. Both the GNU and PAX formats are heavy users of this approach.

The Go implementation of tar provides automatic parsing of the metadata contained in these pseudo-files for the real file it describes. For example, Go1.1 added support for parsing long filenames for the GNU format; Go1.3 added support for parsing local PAX headers; and Go1.3 added support for parsing GNU sparse headers.

### The problem ###

Parsing the metadata for a single file is easy to represent in the API since we can just represent the additional information in the Header struct.

However, the PAX format adds a feature called "global PAX headers" which encodes metadata intended to modify all subsequent files (#22748 indicates that this feature is actually used; e.g., `git archive --format=tgz` produces them).

In order to provide the metadata contained within a global PAX header, `Reader.Next` returns a single `Header` representing the pseudo-file (in go1.10, we actually parse the PAX records into `Header.PAXRecords`, but that is orthogonal to this issue).

The problem with global headers (and really any typeflag that the Go implementation does not recognize) is that the following reports true:
```go
Header{Typeflag: TypeXGlobalHeader}.FileInfo().Mode().IsRegular() // true
```
This is the behavior on all versions of Go thus far.

The problem with `IsRegular` reporting true is:
1. It lies. This is not a regular file.
2. A user relying only on `Header.FileInfo` alone is unable to handle pseudo-files specially (e.g., ignoring them).

However, it is not trivial to have `Header.FileInfo.Mode.IsRegular` report false since the logic for `os.FileMode.IsRegular` only reports false for a [very narrow set of types](https://github.com/golang/go/blob/92ad8df5d10b08ae73e8104f3202f458616853f1/src/os/types.go#L59), none of which are an obvious choice for "special" files like metadata or unrecognized typeflags.

Thus, we need to make decision whether to keep or change the current behavior of `Header.FileInfo.Mode.IsRegular` for special files like `TypeXGlobalHeader`. If we change it, how do we make it report false? The only approach I see is to define a new constant (e.g., `ModeSpecial`) in the `os` package.

Thoughts?

\cc @rasky @bradfitz
Repository: TypeScript
Issue: Wrong overload selected on function when passed a callback annotated with a type with multiple optional properties
Labels: Bug

**TypeScript Version:**  2.7.0-dev.20171128

**Code**

This issue was first noticed in code that uses LoDash with the typings from DefinitelyTyped.  It seems to manifest only in a very specific set of circumstances.  The following code sample is as minimal a reproduction as I could find.

```ts
let _: LoDashStatic;

interface LoDashStatic {
  mapValues<T extends object, TResult>(
    obj: T,
    callback: (value: T[keyof T]) => TResult
  ): { [P in keyof T]: TResult };

  mapValues<T extends object>(obj: T, iteratee: object): { [P in keyof T]: boolean };
}

interface Item {
  key?: string;
  bar?: number;
}

interface Collection {
  [key: string]: Item;
}

const source = { foo: { bar: 42 } };
let items: Collection = _.mapValues(
  source,
  (v: Item) => v
);
```

Note that the correct overload is selected when any of the following changes are made to the above code:

- Remove the type annotation on the callback: `(v) => v` instead of `(v: Item) => v`
- Remove the nested optional property: `{ foo: {} }` instead of `{ foo: { bar: 42 } }`
- Remove the unused optional property: `interface Item { bar?: number; }` instead of `interface Item { key?: string; bar?: number; }`
- Annotate the source collection: `const source: Collection = { foo: { bar: 42 } };` instead of `const source = { foo: { bar: 42 } };`

**Expected behavior:**

Compiles without issue.

**Actual behavior:**

```
error TS2322: Type '{ foo: boolean; }' is not assignable to type 'Collection'.
  Property 'foo' is incompatible with index signature.
    Type 'boolean' is not assignable to type 'Item'.
```