sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: libtorch gpu set id bug
Labels: module: cpp,module: cuda,triaged

## 🐛 Bug

## To Reproduce

Steps to reproduce the behavior:

1.libtorch1.6.0+cuda9.2

```c++
std::string model_path = "/data/rrjia/project/torch_engine/yolo5s_detect_cuda.torchscript.pt";
	std::string image_path = "/data/rrjia/project/torch_engine/1.jpg";
	
	torch::jit::script::Module module;		
	try 
	{	
		module = torch::jit::load("../yolov5s.torchscript.pt", torch::Device(torch::kCUDA, 0));
	}
	catch (const c10::Error& e) 
	{
		std::cerr << "error loading the model\n";
		return -1;
	}	
	std::cout << "ok\n";

	std::vector<std::string> classnames;
	std::ifstream f("../coco.names");
	std::string name = "";
	while (std::getline(f, name))
	{
		classnames.push_back(name);
	}

	cv::Mat frame, img;
	img = cv::imread(image_path, cv::ImreadModes::IMREAD_COLOR);
	cv::resize(img, frame, cv::Size(640, 640));
	cv::cvtColor(frame, frame, cv::COLOR_BGR2RGB);
	torch::Tensor imgTensor = torch::from_blob(frame.data, { frame.rows, frame.cols,3 }, torch::kByte);
	imgTensor = imgTensor.permute({ 2,0,1 });
	imgTensor = imgTensor.toType(torch::kFloat);
	imgTensor = imgTensor.div(255);
	imgTensor = imgTensor.unsqueeze(0);	
	imgTensor = imgTensor.to("cuda:0");

	// preds: [?, 15120, 9]		
	torch::Tensor preds = module.forward({ imgTensor }).toTuple()->elements()[0].toTensor();
	
```
code error as fellow:
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
means that ,	imgTensor = imgTensor.to("cuda:0"); no works
## Expected behavior
it will work success
## Environment

ubuntu 16.04 
libtorch-cxx11-abi-shared-with-deps-1.6.0+cu92



cc @yf225 @glaringlee @ngimel
Repository: flutter
Issue: [google_maps][web] Add support for Polyline patterns
Labels: c: new feature,p: maps,platform-web,package,P3,team-web,triaged-web

I use the following keywork on the GoogleMap widget:
 polylines: Set<Polyline>.of(polylines.values)
Where polylines is set as follows:
```
polylineCoordinates = decodeEncodedPolyline(r"_lgiJ_hkmBs@eEiB_@NsF`CR? ...
    PolylineId id = PolylineId("poly");
    Polyline polyline = Polyline(
        polylineId: id,
        color: Colors.red,
        width: 3,
        patterns: [PatternItem.dash(15), PatternItem.gap(5)],
        points: polylineCoordinates);
    polylines[id] = polyline;
```
This results in a dashed line on Android, as it should. But the same code gives a solid line on web.
Repository: PowerToys
Issue: [FancyZones] Optional overflow direction & Snapping choice
Labels: Idea-Enhancement,Product-FancyZones

## 📝 Provide a description of the new feature

Allow user to choose direction app overflows should be allowed and which side of the application should snap to the zone.

This would allow users to have more control over how applications appear when the zone is smaller than the apps smallest window size. An example of this would be Spotify desktop app has a minimum window size of 800px x 600px. 

*Note: In the following example pictures, notepad is attached to the same size zone as Spotify should be attaching to*

## An example where application overflows onto the second screen incorrectly using current default configuration: 
![image](https://user-images.githubusercontent.com/11413796/104300582-96798d80-54be-11eb-8c21-7ab3bad5f9f3.png)


## How it should sit instead: 

![image](https://user-images.githubusercontent.com/11413796/104300511-7d70dc80-54be-11eb-9cf9-77b06a869665.png)

---

If you'd like to see this feature implemented, add a 👍 reaction to this post.
Repository: go
Issue: proposal: cmd/go: add GOPROXY=cache to rely only on module cache
Labels: Proposal

When I try to import a yet-unrequired module, e.g.

```
mero@hix ~/src/github.com/Merovius/foo$ cat foo.go 
package main

import "rsc.io/qr"

func main() {
	var _ qr.Code
}
mero@hix ~/src/github.com/Merovius/foo$ cat go.mod
module github.com/Merovius/foo

go 1.15
```

and I run `go mod tidy`, while not connected to the internet, I get an error

```
go: finding module for package rsc.io/qr
github.com/Merovius/foo imports
	rsc.io/qr: module rsc.io/qr: Get "https://proxy.golang.org/rsc.io/qr/@v/list": dial tcp: lookup proxy.golang.org on [::1]:53: read udp [::1]:57927->[::1]:53: read: connection refused
```

That makes sense - the proxy is not reachable. However, my module cache contains a usable version of this module:

```
mero@hix ~/src/github.com/Merovius/foo$ l -d ~/pkg/mod/rsc.io/qr@v0.2.0 
dr-x------. 5 mero mero 4,0K 14. Mai 2020  /home/mero/pkg/mod/rsc.io/qr@v0.2.0
```

So, it might be a reasonable course of action for me, to just use the version I have in the cache - whether it is the latest, or not. If I want to do that, as far as I can tell, either

a) I have to look up what versions I have in my cache and run `go get rsc.io/qr@v0.2.0`, to update `go.mod`. It would be great, if that could be automated, or
b) set `GOPROXY=file:///home/mero/pkg/mod/cache/download` and run `go mod tidy`

Both of these can be considered somewhat clunky (and the latter is not very discoverable). I would like to suggest to make this easier. There are several ways this could happen:

1. Automatically fall back to the module cache when running `go mod tidy` or similar and a network error happens. IMO that would be the most convenient - it also has the downside of unexpectedly adding an outdated version of the module.
2. Add a value to the `-mod` flag that is equivalent to `-mod=mod`, but only touching the local cache.
3. Add a flag to `go mod tidy` (and similar), to use the local cache as a proxy (essentially automate setting the environment variable).

It's also fine, if this is deemed WAI, of course. I just thought I would suggest it [after the case came up on golang-nuts](https://groups.google.com/g/golang-nuts/c/0VgPQbQEKdU/m/Mvsfd7jQAAAJ).
Repository: flutter
Issue: Flutter Slider Label showing strange numbers
Labels: framework,f: material design,has reproducible steps,P2,found in release: 2.5,found in release: 2.6,team-design,triaged-design

The Slider widget is is set to show every integer from 0 to 100, but sliding across sometimes it shows numbers like the image below.

**Strange outcomes:**
![image](https://user-images.githubusercontent.com/20194456/104326383-7353db80-54c8-11eb-83dd-5b368dfd634f.png) ![image](https://user-images.githubusercontent.com/20194456/104326899-fffe9980-54c8-11eb-88c5-f8754aba7ea1.png)

**Normal outcome:**
![image](https://user-images.githubusercontent.com/20194456/104326977-14429680-54c9-11eb-8abb-2e6d5db71b1b.png)

Note: All 3 images were taken without reloading the app.

**Code:** 

`Slider(
     value: _initialValue == null ? 70 : _initialValue,
     min: 0,
     max: 100,
     divisions: 100,
     label: '$_initialValue',
     onChanged: (value) {
         setState(() {
               _initialValue = value;
            });
         },
),`
Repository: flutter
Issue: Proposal to support Hex Keyboard format
Labels: a: text input,c: new feature,framework,engine,c: proposal,P3,team-engine,triaged-engine

I would like an option for keyboard TextInputType to support hex value entry.

https://api.flutter.dev/flutter/services/TextInputType-class.html has many nice options for email, numbers, dates, names, street address, phone, etc.  Hex would be just numbers and A-F of course.
Repository: godot
Issue: Area2D erroneously emits body_entered signal if collision mask *and* layer are reset.
Labels: documentation,topic:physics

**Godot version: v3.2.3**


**OS/device including version: Linux 5.10.2-2-MANJARO**


**Issue description:**
I have an obstacle (Area2D) that "destroys" the player character(KinematicBody2D) on contact using the `body_entered` signal. I then hide the player, disable the collisions and start a timer. 
I disable collisions by using: 
```
set_collision_layer_bit(0,false)
set_collision_mask_bit(0,false)
```
After the timer has run out the player respawns at the start location. I do this by resetting the position and re-enabling collisions.
When the player respawns the Area fires the `body_entered` signal again even though the player character does not collide with the area anymore . 

![godotBug](https://user-images.githubusercontent.com/5324711/104343161-e460b680-54fb-11eb-9ab8-978e1c29d207.gif)



This problem only appears if I reset both the collision layer *and* the mask.
If I reset only one of those it somehow works.


Did I stumble upon a Bug or is this documented behavior? 

Other users seem to have a similar problem: https://godotengine.org/qa/56193/how-to-manually-set-the-position-of-a-kinematicbody2d


**Steps to reproduce:**

1. Have a body enter an area (body_entered signal is emitted)
2. Disable collisions and start a timer
3. On timeout: Set the position of the body to somewhere outside the area and re-enable collisions
4. `body_entered` is emitted again


**Minimal reproduction project:**
[collission_example.zip](https://github.com/godotengine/godot/files/5803403/collission_example.zip)
Repository: rust
Issue: Rustc isn’t warning about usage of and even suggests importing #[doc(hidden)] items.
Labels: C-enhancement,A-diagnostics,T-compiler,A-suggestion-diagnostics,D-invalid-suggestion

Motivated by [this thread](https://users.rust-lang.org/t/serde-compatibility-broken/54041) on URLO, I’m wondering if we shouldn’t add warnings for using items that are hidden in documentations, in particular hidden modules (but e.g. also hidden fields that can be used to make structs with public fields extensible while still supporting `Struct { foo: 1, bar: 2 ..Struct::default() }`-style initialization).

Even more unfortunate is how rustc even _suggests_ hidden re-export modules, e.g. in [this playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=2b8190cd176daec757c7e8eeff4db781), the compiler suggests, among other things, to add `use pin_utils::core_reexport::fmt::Formatter;` or `use serde::export::Formatter;`, which are semver-hazards.
```
   Compiling playground v0.0.1 (/playground)
error[E0412]: cannot find type `Formatter` in this scope
 --> src/lib.rs:2:16
  |
2 | pub fn foo(_f: Formatter) {}
  |                ^^^^^^^^^ not found in this scope
  |
help: consider importing one of these items
  |
2 | use core::fmt::Formatter;
  |
2 | use env_logger::fmt::Formatter;
  |
2 | use pin_utils::core_reexport::fmt::Formatter;
  |
2 | use serde::export::Formatter;
  |
    and 3 other candidates
```

@rustbot modify labels: C-enhancement, T-compiler, A-diagnostics, A-suggestion-diagnostics, D-invalid-suggestion

_(regarging `D-invalid-suggestion`: I **would** consider code that explicitly uses unstable internal (for macros) re-exports of another crate to be “incorrect”)_
Repository: go
Issue: net/http: make "http: ContentLength=N with Body length 0" error message more intelligible
Labels: NeedsInvestigation

I think it would be nice to make error message more intelligible, e. g. "Request.Body's length (0) doesn't match Content-Length header (N)"

It may seem very obvious when you already know what the present error message means, but actually I couldn't understand. [This SO question](https://stackoverflow.com/questions/31337891/net-http-http-contentlength-222-with-body-length-0) has 11k views and I suspect the majority of them are other confused developers.
Repository: next.js
Issue: with-google-tag-manager: `pageview` event doesn't fire on initial page load
Labels: examples

**What example does this report relate to?**

with-google-tag-manager

**What version of Next.js are you using?**

10.0.3

**What version of Node.js are you using?**

10.0.3

**What browser are you using?**

Chrome

**What operating system are you using?**

macOS

**How are you deploying your application?**

next start

**Describe the Bug**

`pageview` event doesn't fire on initial page load, only routchange

**Expected Behavior**

to be able set up a single tag in GTM to use the "pageview" dataLayer event, however the `routeChangeComplete` only fires on subsequent page views.

**To Reproduce**

- start with-google-tag-manager up the example
- add `console.log("pageview");` inside the exported page view function
- note in the console that it only appears on subsequent pageviews


We're going with a slight adaptation from the example, using a hook instead of a regular component. Either way, I think the addition of a call to `gtm.pageview` on initialPage would be a nice addition to `with-google-tag-manager`.

```tsx
export default function useGTM() {
  const router = useRouter();

  React.useEffect(() => {
    const handleRouteChange = (url: string) => {
      // Wrap it in a rAF to ensure the correct data is sent
      // https://github.com/zeit/next.js/issues/6025
      requestAnimationFrame(() => gtm.pageview(url));
    }
    router.events.on('routeChangeComplete', handleRouteChange);
    return () => router.events.off('routeChangeComplete', handleRouteChange);
  }, [router.events]);
}

```
Repository: go
Issue: x/tools/gopls: reload metadata on the most durable awaiting context
Labels: gopls,Tools,gopls/metadata

We try to avoid cloning a snapshot when the previous snapshot has not initialized, by awaiting on a detached context:
https://cs.opensource.google/go/x/tools/+/master:internal/lsp/cache/view.go;l=602;drc=929a8494cf60267d89035bc211b797a67b65a6b9

However, we also guard initialization with a sync.Once.  As has been observed in #43554, it's possible to lose this race to awaitInitialized, such that we run initialization on the snapshot background context, which can be canceled.

As a result, we can clone a snapshot with incomplete metadata. This causes problems for any invalidation logic trying to preserve metadata, such as only invalidating metadata on go.mod _saves_.  Additionally, this was difficult to debug: it would be nice to have a guarantee that we have a linear history of metadata in our snapshots.

After discussing, we think this is a relatively low priority since the current logic should only result in rare and transient breakages.

CC @stamblerre @heschik
Repository: rust
Issue: Rustc diagnostics don’t realize that assignments from a match guard can be used in the following match arms.
Labels: A-lints,A-diagnostics,T-compiler,C-bug,D-incorrect,A-patterns

```rust
fn main() {
    let mut x = 0;
    match () {
        () if {
            x = 42;
            false
        } => {}
        _ => {
            println!("{}", x); // prints 42
        }
    }
}

```

([Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=e7024ccae1da8b707c092163bf09f883))

Output:

```
42

```

Errors:

```
   Compiling playground v0.0.1 (/playground)
warning: value assigned to `x` is never read
 --> src/main.rs:5:13
  |
5 |             x = 42;
  |             ^
  |
  = note: `#[warn(unused_assignments)]` on by default
  = help: maybe it is overwritten before being read?

warning: 1 warning emitted

    Finished dev [unoptimized + debuginfo] target(s) in 0.74s
     Running `target/debug/playground`

```

@rustbot modify labels: T-compiler, A-diagnostics, A-lint, D-incorrect, C-bug
Repository: electron
Issue: Child window becomes visible when parent is maximized
Labels: 8-x-y,10-x-y,12-x-y

<!--  As an open source project with a dedicated but small maintainer team, it can sometimes take a long time for issues to be addressed so please be patient and we will get back to you as soon as we can.
-->

### Preflight Checklist
<!-- Please ensure you've completed the following steps by replacing [ ] with [x]-->

* [X ] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
* [X ] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
* [X ] I have searched the issue tracker for an issue that matches the one I want to file, without success.

### Issue Details

* **Electron Version:**
  * 10.1.15, 8 and 12 beta.14
* **Operating System:**
  * Windows 10
* **Last Known Working Electron version:**
  * N/A

### Expected Behavior
I expect that if a child window is hidden whilst parent is minimized it should remain hidden when maximized

### Actual Behavior
Child window is visible.  If The child window is hidden while the parent is maximized then it remains hidden if minimized -> maximized

### To Reproduce
1. Create a child window and assign it a parent
2. Set a timeout to hide the child window
3. Minimize parent and wait for timeout to expire
4. Maximize

See Fiddle: https://gist.github.com/1cbc8cf24a5e753cec22368355aff9b2
Repository: rust
Issue: diagnostics could be improved when creating references inside structs conditionally 
Labels: C-enhancement,A-diagnostics,A-lifetimes,T-compiler,A-suggestion-diagnostics

````rust
pub struct S {
    left: String,
    right: String,
}

impl S {
    pub fn new<LC: ToString, RC: ToString>(left: &LC, right: &RC) -> Self {
        Self {
            left: left.to_string(),
            right: right.to_string(),
        }
    }
}

pub fn main() {
    let x = 1;
    let _ = &S::new(
        &"",
        if x == 1 {
            &format!("{}", x)
        } else {
            &format!("{} {}", x, x)
        },
    );
}
````
This produces one error for each of the `&format!()`s 

````
 Compiling playground v0.0.1 (/playground)
error[E0716]: temporary value dropped while borrowed
  --> src/main.rs:20:14
   |
17 |     let _ = &S::new(
   |              ------ borrow later used by call
...
20 |             &format!("{}", x)
   |              ^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
21 |         } else {
   |         - temporary value is freed at the end of this statement
   |
   = note: consider using a `let` binding to create a longer lived value
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0716]: temporary value dropped while borrowed
  --> src/main.rs:22:14
   |
17 |     let _ = &S::new(
   |              ------ borrow later used by call
...
22 |             &format!("{} {}", x, x)
   |              ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
23 |         },
   |         - temporary value is freed at the end of this statement
   |
   = note: consider using a `let` binding to create a longer lived value
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors
````

The suggested solution seems kinda overkill when we could simply move the `&`  from in front of the `format()` in front of the `if`
This looks very strange but I think it might be the most straightforward solution:

````rust
pub fn main() {
    let x = 1;
    let _ = &S::new(
        &"",
        &if x == 1 { // moved here
            format!("{}", x) // from here 
        } else {
            format!("{} {}", x, x) // and here
        },
    );
}
````
Repository: create-react-app
Issue: What is the alternative to setting SASS_PATH in the env file.
Labels: needs triage


React V17 has deprecating setting SASS_PATH as an environment variable. The main React documentation however is not updated and I can not find some other ways to set up SASS_PATH.
Repository: next.js
Issue: [i18n] explicit access to /en not redirecting to /
Labels: bug,Internationalization (i18n)

**What version of Next.js are you using?**

10.0.5

**What version of Node.js are you using?**

14.15.0

**What browser are you using?**

Chrome

**What operating system are you using?**

Windows 10

**How are you deploying your application?**

next dev (localhost)

**Describe the Bug**

According to [docs](https://nextjs.org/docs/advanced-features/i18n-routing#sub-path-routing) when enabling i18n with following config:

```
module.exports = {
  i18n: {
    locales: ['en-US', 'fr', 'nl-NL'],
    defaultLocale: 'en-US',
  },
}
```
only available URLs should be: 
```
/blog
/fr/blog
/nl-nl/blog
```

but if I try to access page explicitly specifing default locale (i.e. `/en-US`) then it will show page as is, without being redirected to `/`

**Expected Behavior**

It should redirect all paths prefixed with default locale to non-prefixed paths (i.e. `/en` to `/`, `/en/hello` to `/hello` etc).

I would like to get rid of duplicated pages, because it potentially can bring problems with SEO. 

Also, I couldn't fix it using `redirects` section because it runs into infinite loop (ERR_TOO_MANY_REDIRECTS ): 
```
 async redirects() {
            return [
                {
                    source: '/en',
                    destination: '/',
                    locale: false,
                    permanent: true,
                },
                {
                    source: '/en/:path*',
                    destination: '/:path*',
                    locale: false,
                    permanent: true,
                }
            ];
        },
```


**To Reproduce**

1. Download and run official `i18n-routing` example
2. Try to access to `/en` (default locale) and  make sure it will show page without redirect
Repository: TypeScript
Issue: JS output contains imports only used in types when `emitDecoratorMetadata: true`
Labels: Bug,Help Wanted

# Bug Report

<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms

- emitDecoratorMetadata require
- emitDecoratorMetadata import 
<!--
  What search terms did you use when trying to find an existing bug report?
  List them here so people in the future can find this one more easily.
-->

### 🕗 Version & Regression Information

<!-- When did you start seeing this bug occur?

"Bugs" that have existed in TS for a long time are very likely to be FAQs; refer to
  https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs

If possible, please try testing the nightly version of TS to see if it's already been fixed.
For npm: `typescript@next`
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly

Note: The TypeScript Playground can be used to try older versions of TypeScript.

Please keep and fill in the line that best applies:
-->
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about 3.3.3, 4.1.3

### ⏯ Playground Link

<!--
  A link to a TypeScript Playground "Share" link which shows this behavior

  The TypeScript Workbench can be used for more complex setups, try
  https://www.typescriptlang.org/dev/bug-workbench/

  As a last resort, you can link to a repo, but these will be slower for us to investigate.
-->
[Playground link with relevant code](https://www.typescriptlang.org/play?emitDecoratorMetadata=false&target=2&module=1&ts=4.1.3&ssl=20&ssc=25&pln=1&pc=1#code/JYWwDg9gTgLgBAKjgQwM5wG6oMYQCYCmcAZlBCHAORa6GUDcAUI8QK4B22MwE7cAMhADmAWQIwAFvgAUjOHBjIoQ8QC4U7AJ4AaOXDBkwBWJoDSBTetQwowdkLgAfOKk0gARhAA2u+YRy2YDDQ6gAKhsYwmgAiBAHAQdCMAJRwAN56uOyo3gQAdF7C0orK4slM8lk5XvmFQtIGEEYm5prlmbzVtUX+2IHBUO0AvszYXmjosSAQ6XoAAoKi4lJ4emCs7l7A2CQQENLuSuo0+PliIATswakZ8vIA9PdweDPsEJJ2QnojI4xV8IRpnAALxwdgEADucCm+3KQA)

### 💻 Code

<!-- Please post the relevant code sample here as well-->
```ts
import * as vscode from 'vscode';

function LogMethod(
  target: any,
  propertyKey: string | symbol,
  descriptor: PropertyDescriptor
) {
  console.log(target);
  console.log(propertyKey);
  console.log(descriptor);
}

class Demo {
  @LogMethod
  public foo(bar: vscode.Memento) {
    // do nothing
  }
}

const demo = new Demo();
```

### 🙁 Actual behavior

The output contains `const vscode = __importStar(require("vscode"));` when `emitDecoratorMetadata: true` but not when `emitDecoratorMetadata: false`

### 🙂 Expected behavior

As the type of `bar` as nothing to do with the compiled JS, the import of vscode should not exist regardless of the value of `emitDecoratorMetadata`