sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: gradient layout contract
Labels: triaged,module: memory format

## 🐛 Bug


# **Warning: grad and param do not obey the gradient layout contract. This is not an error, but may impair performance.**

when the warnning appear after a valid function, the gpu occupation 70% goes to 100%.and cpu ocupation 50% goes to 10%,
the valid function just do a forward pass and it will change the model's mode(train or eval) and recover the original mode.then ,after the loss computation done, loss.backward() excute ,the warnning shows.besides, the loss computation costs much time after this
```
dist_ap, relative_p_inds = torch.max(
    dist_mat[is_pos].contiguous().view(N, -1), 1, keepdim=True)  # costly
```
when annotate the valid function， no warnning, the  cpu and gpu  occupation keeps almost constant.
after my step-wise test on the code above, **dist_mat[is_pos]** takes much time,the key is that the size of it is fixed after and before the valid function...,so i have to ensure this dont bring error result.
`=========================================================`
[previous issue](https://github.com/pytorch/pytorch/issues/57706)

now i have found the solution for my code!!
and dont know how it works. hope someone can help me to understand why!!

here is my experience:

i use a numpy random matrix to replace the picture array, it works, no perf decrease.

then i add *.cpoy() to the img. works!!

``` 
    # optimizer.zero_grad(set_to_none=True)  this doesn't work, mentioned in previous issue.
    ims = Variable(self.TVT(torch.from_numpy(ims.copy()).float()))
    feat = self.model(ims)
    feat = feat.data.cpu().numpy()
```

i dont know why the img will impact the gradient contract?

not to mention that i have transfer the img to cuda, and the gradient also locate on GPU, so why would this happen from the view of you? 

i prefer to name it as a bug, intuitively there is no any realation between gradient (gpu) and the img (cpu). 



## To Reproduce
[here is the train source](https://github.com/huanghoujing/person-reid-triplet-loss-baseline/blob/a1c2bd20180cfaf225782717aeaaab461798abec/script/experiment/train.py)

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Environment
 - PyTorch Version (e.g., 1.0):1.7.0
 - OS (e.g., Linux):windows
 - How you installed PyTorch (`conda`, `pip`, source):--
 - Build command you used (if compiling from source):
 - Python version:3.6
 - CUDA/cuDNN version:
 - GPU models and configuration:1660super
 - Any other relevant information:

cc @VitalyFedyunin @jamesr66a @ppwwyyxx
Repository: pytorch
Issue: libtorch conflict with cxxopts and cause memery leak
Labels: module: memory usage,triaged

envs: ubuntu 18.04, libtorch 1.8.1, cxxopts

Hello, When I run the code from https://github.com/yasenh/libtorch-yolov5.git. the program memery is still increasing. After debugging, I find the key is that cxxopts conflict with libtorch.

when I use cxxopts in my main.cpp and load torch script by torch::jit::load, the bug sometime appears. The program memory is still increasing quickly and finally the program was killed by the operater system, and then there are some infomation like:
` Process finished with exit code 9`

Then I didn't use cxxopts and use gflags, The bug disappears.

So I think there are some conflicts between libtorch and cxxopts
Repository: rust
Issue: OnceCell docs: empty/full terminology v.s. (un)initialized
Labels: E-easy,T-libs-api,A-docs,C-bug,Libs-Small

Documentation at:

* https://doc.rust-lang.org/nightly/std/lazy/struct.OnceCell.html
* https://doc.rust-lang.org/nightly/std/lazy/struct.SyncOnceCell.html

Appears to use "empty" and "uninitialized" interchangeably to describe the state of a given cell, and similarly "full" and "initialized". I think it’d be better to pick one set of terminology and stick to it consistently. Using empty/full might be better because "uninitialized" terminology is already used for `std::mem::MaybeUninit`, and manipulating an empty cell does not have the memory-safety risks of reading bytes from `MaybeUninit::uninit()`.
Repository: flutter
Issue: ListView reversed `Return to top` header tap
Labels: framework,f: material design,f: scrolling,f: cupertino,c: proposal,P3,team-design,triaged-design

## Use case
I'm building a chat like interface and I'm using `ListView` with `reversed` setted to `true` to make UI look "chat like"
The issue I'm experiencing is that `return to top` behaviour is also reversed. 
In this case is scrolls the chat down to index `0` item. As expected by design. 
But I would like to have an ability to hook into this behaviour or any way to modify it's behaviour.

What I need is to modify `return to top` behaviour to make it scroll to the last item in `reversed` `ListView`.

I inspected several public packages which implement "chat like" UI and they have the same issues as described here.

I googled for several hours and didn't find any easy or suitable solution for my issue.

## Proposal
Some way to hook into `return to top` or any way to modify it's behaviour.
Repository: next.js
Issue: FOUC on page load with SSR
Labels: bug

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

10.2.3

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

14.16.0

### What browser are you using?

Chrome

### What operating system are you using?

Windows

### How are you deploying your application?

next start

### Describe the Bug

After creating a web app with SSR and run on the server, there is a problem with FUOC (Flash Of Unused Content). We're using CSS modules for every React Component (written in SCSS). At the beginning of loading the whole page there's no CSS styles. How can we fix it? To create our own stylesheet from all sass files and put into the head is could be a workaround, but with this modules make no sense.

### Expected Behavior

Maybe is there an option to fix it from server side or something else?

### To Reproduce

1. Build a few React components with SCSS modules styles to each of them.
2. Run **next start** and watch FUOC
Repository: terminal
Issue: `globalSummon` a new tab in explorer CWD
Labels: Issue-Feature,Area-Settings,Product-Terminal

Hey,
little question. The quake mode is really nice, but is there a way to automatically open the terminal/quake mode on current focused explorer folder.

For example I have focused an Explorer window in my Downloads directory and then press ctrl+alt+t (my shortcut for quake mode) it should automatically open the console in this directory.

Thanks

_Originally posted by @meydominic in https://github.com/microsoft/terminal/issues/8888#issuecomment-848470679_


<hr>

I'm not sure that is possible, sorry 😕 When pressing the global hotkey, we don't get any context about the active window.......

ah shoot. okay. So, maybe we could:
* get the foreground window, 
* check if it's an `explorer.exe` window, 
* then use the hack we're already using for the background context menu to get the path of that window. 
 
That might work. We'd still need a setting for "when this `globalSummon` action is performed, open a new tab with the explorer CWD." That of course leads to "I want to `globalSummon` in explorer and get a new pane" or "I want to `globalSummon` in explorer and new a new pane and have that pane running {profile}"

This deserves it's own thread

---

### Summary

A keyboard shortcut to open terminal app in the same path as file explorer window.

Lot of devs who use VS code or similar editors/IDEs are familiar with the shortcut `ctrl + `` to open terminal in the project's path.
Though windows have a right click shortcut for it, the keyboard shortcut is just muscle memory.

_from @MG-LSJ in #17192_
Repository: excalidraw
Issue: Allow custom colors in color picker and save palette to AppState
Labels: enhancement,discussion,package:excalidraw

Ideally this feature should be available via the UI.  As an interim solution it would also be nice if a custom color palette could be provided via the API.
Repository: TypeScript
Issue: String case change methods should return intrinsic string manipulation types
Labels: Suggestion,Awaiting More Feedback

# lib Update Request

## Configuration Check

My compilation *target* is `ES2018` and my *lib* is `["ES2016", "dom"]`.

## ~~Missing / Incorrect~~ Imprecise Definitions

At least `toUpperCase` and `toLowerCase` methods on `String`, maybe/probably also the `Locale` versions?

## Sample Code

````ts
type LittleT = "t" | "tt";
type BigT = Uppercase<LittleT>;
declare const smol: LittleT;
const big: BigT = smol.toUpperCase(); // err, string is not assignable to "T" | "TT
````

## Documentation Link

https://tc39.es/ecma262/#sec-string.prototype.tolowercase


## Note

I'm not sure about the `Locale` versions of these methods because I don't know what algorithm the "intrinsic" `Uppercase<T>` / `Lowercase<T>` helper types are required to follow.  (Do we need separate `LocaleUppercase` / `LocaleLowercase` helpers?)

Also worth mentioning: I think what I'm looking for is a return type of e.g. `Uppercase<this>`, which shouldn't have an impact on non-literal string types because `Uppercase<string>` is just `string`.
Repository: rust
Issue: Improve help message when using `&'a mut &'a T` and `&'a mut [&'a T]`
Labels: C-enhancement,A-diagnostics,A-lifetimes,T-compiler,A-variance

This is a follow-up of a discussion I initiated on [internals](https://internals.rust-lang.org/t/i-think-the-compiler-could-give-a-better-help-message-here/14742) after watching [crust of Rust: Subtyping and Variance](https://www.youtube.com/watch?v=iVYWDIW71jk).

Both `&'a mut &'a T` and `&'a mut [&'a T]` are (I think) always a bug in a program, and never what the programmer intended. What he wanted to write was `&'a mut &'b T` and `&'a mut [&'b T]` (ie. having two different lifetimes).

[playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=49c0f22394880a47759aedd41a84566c)

Note: `&'a mut [&'a T]` gives the same error than the following one (see the playground for more details). Using such pattern as an argument to a function, or a the field of a structure is equally buggy.

```rust
fn foo<'a>(_: &'a mut &'a str) { }

fn main() {
    let mut x = "test";
    foo(&mut x);
    assert_eq!(x, "test");
}
```

The current output is:

```rust
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
  --> src/main.rs:15:9
   |
14 |         foo(&mut x);
   |             ------ mutable borrow occurs here
15 |         assert_eq!(x, "test");
   |         ^^^^^^^^^^^^^^^^^^^^^^
   |         |
   |         immutable borrow occurs here
   |         mutable borrow later used here
```


I think that the output should look something like:

```rust
help: it is possible that you want to use two different lifetimes
 5 |  fn foo<'a>(_: &'a mut &'a str) {
   |                 ^^      ^^
help: you may try to introduce a new lifetime
 5 | fn foo<'a1, 'a2>(_: &'a1 mut &'a2 str) {
   |        ^^^  ^^^      ^^^      ^^^
help: You can learn more about variance and lifetimes (todo: put a link)
```

---

TL;DR and notes:

 - `&'a mut &'a T` and `&'a mut [&'a T]` are valid Rust, but is (IMHO) never what the programmer intended to write
 - While  `&'a &'a T` is also probably buggy, in practice it never cause issue since `&` doesn’t requires uniqueness for the borrow. This link shouldn’t warn against it.
 - `&'a mut S<'a>` is valid, this lint shouldn’t warn against it.
Repository: go
Issue: net/http: ServeFile may return 404 on temporary FS errors (such as »too many open files«)
Labels: NeedsInvestigation

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.16.4 darwin/arm64
</pre>

### Does this issue reproduce with the latest release?

Yes.

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GOARCH="arm64"
GOOS="darwin"
</pre></details>

(for completeness's sake, I first observed it on a linux server running a go1.14 binary)

### What did you do?

Compile the following program into an executable (say `http-ulimit-404` by doing `go build -o http-ulimit-404 http-ulimit-404.go`).

```
package main

import (
	"net/http"
	"path/filepath"
)

func main() {
	http.ListenAndServe(":8080", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		http.ServeFile(w, r, filepath.Join(".", r.URL.Path))
	}))
}
```

Set the number of open files very low using e. g. `ulimit -n 8` (I found that on Darwin, 8 works well to reproduce the issue. Note that on Darwin this only works as root user.)

Request a file that exists in the working directory, if necessary, using multiple parallel instances of `curl`, e. g. `curl http://localhost:8080/http-ulimit-404.go`. For me, using one single `curl` instance with `ulimit -n 8` works already.

Observe the resulting error to be 404.

### What did you expect to see?

Package net/http returning a 5xx error indicating to clients that the request cannot be served due to a temporary condition (in this case number of open files), and may be retryable.

### What did you see instead?

Package net/http returning a 404 error, indicating to clients that the request cannot be served due to a permanent condition, possibly causing cache posioning or other downstream failures.

(In the real world scenario where I found this, this caused a 404 on an extant file due to a high number of concurrent requests, leading to this file not being processed – and not retried – in a workload where it should've been.)

I believe this could easily be mitigated by checking if `originalErr` implements `interface { Temporary() bool }` in mapDirOpenError (https://golang.org/src/net/http/fs.go#L48), but I'm not 100% sure yet if I'm overlooking something.
Repository: terminal
Issue: Allow binding keys to a nested action, to open the palette directly to it's children
Labels: Product-Terminal,Issue-Task,Needs-Tag-Fix,Area-CmdPal

the problem:

currently every time i go change the colour scheme of my profile because i walk into an area with different lighting and need different contrast, i have to laboriously click the colour scheme dropdown, select my scheme i want to try, then drag my mouse over to the apply button, then switch tabs back to that profile to see if it suits my lighting, which it might not, in which case i have to go do that process again.

naturally it would be nice to use keyboard shortcuts for most of this: 
1: ctrl+shift+tab to switch between settings and my terminal window
2: mouse is already over the dropdown, click to enter dropdown
3: use arrow keys to select colour profile, enter
4: >>>>press enter to apply<<<<
5: ctrl+shift+tab to switch back and check the colour scheme works

having it that way wouldnt require me to move my mouse at all, very convenient.

simple solution:
pressing enter applies changes in settings menu




<!-- 
🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨

I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING:
1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement.
2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement.
3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number).
4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement.
5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement.

All good? Then proceed!
-->

# Description of the new feature/enhancement

<!-- 
A clear and concise description of what the problem is that the new feature would solve.
Describe why and how a user would use this new functionality (if applicable).
-->

# Proposed technical implementation details (optional)

<!-- 
A clear and concise description of what you want to happen.
-->
Repository: go
Issue: x/build/buildlet: allow configurable buildlet timeouts per buildlet
Labels: Builders,NeedsInvestigation

Some buildlets take longer to start than others. Our default timeout was 5 minutes, which is reasonable for most cloud instances.

We recently added a a1.metal instance, which takes 5 minutes to boot, with additional time necessary to start a Windows ARM64 VM (#42604). We should be able to increase this timeout just for a one-off slow builder without making it wait unnecessarily long for everything.

See https://go.dev/cl/322654, which increased the timeout.
Repository: flutter
Issue: How to change the Observatory Host?
Labels: tool,d: api docs,P3,team-tool,triaged-tool

I saw that it was supported long ago, but my attempt failed.

https://github.com/flutter/flutter/issues/35079

```shell
D:\flutter_project\flutter_demo>flutter run --observatory-port=50443 --observatory-host=0.0.0.0
Could not find an option named "observatory-host".


Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
```
Repository: pytorch
Issue: [discussion] Should Optimizers be also Modules?
Labels: module: nn,module: optimizer,triaged

Then their cached gradient moments can be their own "buffers" or "parameters", and then they may be used more conveniently in bi-level optimization models. Method `step()` would then call `forward()`, and also be callable from `__call__`

Related: https://github.com/pytorch/pytorch/issues/37410

cc @albanD @mruberry @jbschlosser @vincentqb @iramazanli
Repository: godot
Issue: null crash when importing some .glb files with Gen Lightmaps
Labels: bug,confirmed,topic:import,crash


**Godot version:**
happens in 3.3.2-stable and 3.3-stable
( 3.2.3-stable does not support lightmapping and does not crash )

The crash is *not* present on master (4.0.dev 45d3b96): If the same glb files are used and set to Static Lightmaps, they import correctly on master.

**OS/device including version:**
Windows 10.0.19041.985

**Issue description:**
Because the `meshes/light_baking` enum is off-by-one in master, I accidentally enabled lightmap generation on a character model and was surpised to find the Godot 3.3.2 crashed when presented with these files.

The crash occurs if `cache_data` is null after unwrapping (probably unwrap failed)
```
>	godot.windows.tools.64.exe!ResourceImporterScene::import(const String & p_source_file, const String & p_save_path, const Map<StringName,Variant,Comparator<StringName>,DefaultAllocator> & p_options, List<String,DefaultAllocator> * r_platform_variants, List<String,DefaultAllocator> * r_gen_files, Variant * r_metadata) Line 1443	C++
 	godot.windows.tools.64.exe!EditorFileSystem::_reimport_file(const String & p_file) Line 1747	C++
 	godot.windows.tools.64.exe!EditorFileSystem::reimport_files(const Vector<String> & p_files) Line 1936	C++
 	godot.windows.tools.64.exe!EditorFileSystem::_update_scan_actions() Line 572	C++
 	godot.windows.tools.64.exe!EditorFileSystem::_notification(int p_what) Line 1122	C++
 	godot.windows.tools.64.exe!EditorFileSystem::_notificationv(int p_notification, bool p_reversed) Line 110	C++
 	godot.windows.tools.64.exe!Object::notification(int p_notification, bool p_reversed) Line 929	C++
 	godot.windows.tools.64.exe!SceneTree::_notify_group_pause(const StringName & p_group, int p_notification) Line 971	C++
 	godot.windows.tools.64.exe!SceneTree::idle(float p_time) Line 524	C++
 	godot.windows.tools.64.exe!Main::iteration() Line 2098	C++
 	godot.windows.tools.64.exe!OS_Windows::run() Line 3307	C++
 	godot.windows.tools.64.exe!widechar_main(int argc, wchar_t * * argv) Line 161	C++
 	godot.windows.tools.64.exe!_main() Line 183	C++
 	godot.windows.tools.64.exe!main(int _argc, char * * _argv) Line 195	C++
```

**Steps to reproduce:**
1. Open the project and let the file import.
2. It will only crash the first time it is is opened (it thinks the import was successful)
3. To trigger the crash again, either delete the .import folder, or reimport the individual file.

**Minimal reproduction project:**
[unwrap_cache_crash.zip](https://github.com/godotengine/godot/files/6548423/unwrap_cache_crash.zip)
Repository: terminal
Issue: Out-of-box experience (OOBE)
Labels: Issue-Feature,Area-UserInterface,Product-Terminal

<!-- 
🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨

I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING:
1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement.
2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement.
3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number).
4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement.
5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement.

All good? Then proceed!
-->

# Description of the new feature/enhancement

We should create some kind of GUI experience that helps first-run users get set up with their terminal and also demo some of our favorite features.

# Proposed technical implementation details (optional)

PowerToys has implemented something similar that we can take a look at for inspiration.
Repository: terminal
Issue: unfocusedAppearance cursorShape doesn't work
Labels: Help Wanted,Issue-Bug,Area-TerminalControl,Area-Settings,Product-Terminal,Priority-3

### Windows Terminal version (or Windows build number)

1.8.1444.0

### Other Software

_No response_

### Steps to reproduce

`settings.json`:
```
{
    ...
    "profiles":
    {
        "defaults":
        {
            ...
            "cursorShape": "filledBox",
            "unfocusedAppearance": {
                "cursorShape": "emptyBox"
            }
        },
        ...
    },
    ...
}
```

Open Windows Terminal and some other application (e.g. Explorer) and move to that application so that Windows Terminal is unfocused.

### Expected Behavior

Cursor changes to empty box.

### Actual Behavior

Cursor disappears which makes the setting useless.