sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: [bug] libtorch bug in nn::MultiheadAttention and nn::Transformer
Labels: module: cpp,module: nn,triaged,module: correctness (silent)

### 🐛 Describe the bug

the attn_mask does not work in nn::MultiheadAttention
~~~
#include <torch/torch.h>
namespace nn = torch::nn;

// seq_length x batch_size x feature_size
torch::Tensor x = torch::randn({3,1,4});

torch::Tensor attn_mask = nn::TransformerImpl::generate_square_subsequent_mask(3);
torch::Tensor attn_mask_bool = attn_mask.to(torch::kBool);

nn::MultiheadAttention multihead_attention(4,1);
std::tuple<torch::Tensor, torch::Tensor> output_with_attn_mask = multihead_attention ->forward(x,x,x,{},true,attn_mask_bool);

torch::Tensor attn_output, attn_output_weights;
std::tie(attn_output, attn_output_weights) = output_with_attn_mask; //unpacking tuple into variables

std::cout << attn_output_weights << std::endl;
~~~

~~~
attn_mask:
/*
 0  1  1
 0  0  1
 0  0  0
[ CPUBoolType{3,3} ]
*/


attn_output_weights:

(1,.,.) = 
  0.1918  0.5302  0.2780
  0.2074  0.1919  0.6007
  0.1948  0.5092  0.2960
[ CPUFloatType{1,3,3} ]
~~~

* 1 the attn_mask does not affect the attn_output_weights.
* 2  the API in libtorch for MultiheadAttention and Transformer is not comparable with that of in pytorch. e.g. libtorch api have no batch_first param. 
* 3 more detail comparison see https://github.com/walkacross/pytorch-libtorch-API-translation/tree/main/translation/torch.nn/transformer_layers

### Versions

libtorch: 1.11.0+cu113

cc @jbschlosser @albanD @mruberry @walterddr @kshitij12345 @saketh-are @bhosmer @cpuhrsch @erichan1
Repository: pytorch
Issue: DDP find_unused_parameters=True does not work for Sparse gradients
Labels: oncall: distributed

### 🐛 Describe the bug

If you have an unused parameter that is a sparse embedding table like below

```
class Example(nn.Module):
    def __init__(self): 
        self.a = nn.Embedding(10, 32, sparse=True)
        self.b = nn.Embedding(10, 32, sparse=True)

    def forward(self, x):
        return self.a(x)
```

and in main, you are using `DDP(model, find_unused_parameters=True)`
then the code above fails with 

```
  File "/home/ec2-user/anaconda3/envs/elanmark/lib/python3.7/site-packages/torch/autograd/__init__.py", line 132, in backward
    allow_unreachable=True)  # allow_unreachable flag
RuntimeError: Expected sparse gradient to be defined.
```

Switching `self.b` to `sparse=False` fixes the issue. However, in my actual case, each embedding is required under different cases. 

It looks like `Reducer::mark_variable_ready_sparse` does not have the same checks as `Reducer::mark_variable_ready_dense`. Instead it just checks `grad.defined()`.



### Versions

Not available. Ask if specific relevant data needed.

torch==1.7.0+cu110

cc @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @osalpekar @jiayisuse @SciPioneer @H-Huang @kwen2501
Repository: flutter
Issue: Edge-case with `Asset`s and declared packages
Labels: framework,a: images,has reproducible steps,P2,found in release: 3.0,found in release: 3.1,team-framework,triaged-framework

At the moment, [`AssetImage`](https://api.flutter.dev/flutter/painting/AssetImage-class.html) and other asset-related classes accepts an optional `package` parameter that can be used to access assets declared in other packages. However, if we use the current package as the `package` parameter and reference an image in the current package, Flutter is unable to find the asset.

Assuming that the following code snippet is written in `my_package`:
```dart
return const AssetImage('icons/heart.png', package: 'my_package');
```
The above will throw a `FlutterError` with the following message:`Unable to load asset: packages/my_package/assets/icons/heart.png`.

This seems like Flutter unconditionally checks the packages folder without first checking if the package is itself which IMO is unintuitive and surprising. It will be great if Flutter could check if the passed in parameter is the package itself first before looking through all other packages.
Repository: flutter
Issue: [CupertinoSliverRefreshControl] trigger `onRefresh` only when the pointer leaves contact with the screen 
Labels: c: new feature,framework,f: cupertino,c: proposal,P3,team-design,triaged-design

Refresh should be cancelled when the finger is not released when sliding up
</details>

<details>
  <summary>Logs</summary>

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, 3.0.1, on macOS 12.3 21E230 darwin-x64, locale zh-Hans-CN)
    • Flutter version 3.0.1 at /Users/frankylee/myproject/flutter_setup/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fb57da5f94 (6 weeks ago), 2022-05-19 15:50:29 -0700
    • Engine revision caaafc5604
    • Dart version 2.17.1
    • DevTools version 2.12.2
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

```

</details>


<!--
      Consider also attaching screenshots and/or videos to better
      illustrate the issue.

      You can upload them directly on GitHub.
      Beware that video file size is limited to 10MB.
-->
Repository: godot
Issue: Recent nodes remembered from previously deleted project with same name
Labels: bug,topic:editor,usability

### Godot version

v3.4.4.stable.official [419e713a2], v3.5.rc5.official [ae6059793]

### System information

Windows 10

### Issue description

The `Recent:` nodes list in the `Create New Node` window,
remembers the recent nodes from a removed project with the same name.

### Steps to reproduce

- create a new project, ex: `abc`
- add a child node, `ctrl a` or click the `+` button
- add an `AnimationPlayer` node
- from the top `Project` menu, choose `Quit to Project List`
- click on `Don't Save`
- in the `Project Manager`, select the project: `abc`
- click on the right panels button: `Remove`
- add a checkmark to: `Also delete project contents (no undo!)`
- click `Remove`
- create a new project with the same name: `abc`
- add a child node, `ctrl a` or click the `+` button


### Observed
The `Recent:` list in the `Create New Node` window, has an entry: `AnimationPlayer`

### Expected
The recent list should probably be empty when creating a new project.

The previously deleted project, with the same name, was most likely unrelated to the new project.

### Cause, `appdata\roaming\godot\projects\abc-...\create_recent.Node`
Creating and opening a new project, creates a project folder in:
`C:\Users\username\AppData\Roaming\Godot\projects`

In this case, it was called: `abc-41aa7bbfb38da0341a2d99f5ff4c802c`

Adding a child node to the project creates a file in that folder, called: `create_recent.Node`

Opening the file in a text editor, for example: `notepad`, shows the entry: `AnimationPlayer`

Godot reads this file when creating a new project with the same name, as a previously deleted project.

Deleting the `abc-41aa7bbfb38da0341a2d99f5ff4c802c` folder, and creating a new project with the name `abc`, 
opens the project with an empty `Recent:` nodes list.

### Multiple roaming projects
A new `abc-...` folder, in `roaming\godot\project\`, might only be created once per day.
Because there's only one when deleting and recreating the `abc` project in the `Project Manager` multiple times.

But I have two `roaming\godot\project\test-...` projects with different dates. 
With different child nodes in their `create_recent.Node` files.

Creating a new project with the name: `test`, shows the recent nodes from the `test-...` project with the most recent date.

### A possible solution?
Maybe the `roaming\godot\project\abc-...` folder also should be removed when removing a project in the `Project Manager`,
with the choice: `Also delete project contents (no undo!)`

Although, the issue would persist if one didn't delete the project contents.

Or, if a project, is created and deleted twice on different days, but the project contents only was deleted the second time.

Now, Godot might read the first roaming projects `create_recent.Node` file.

### Minimal reproduction project

_No response_
Repository: vscode
Issue: Treat numpad-enter and enter keys as different
Labels: feature-request,keybindings

<!-- ⚠️⚠️ Do Not Delete This! feature_request_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- Please search existing issues to avoid creating duplicates. -->

<!-- Describe the feature you'd like. -->

I'd like to bring across some keybindings from another editor. In those bindings I use the numpad enter key to trigger functions different from the main enter/return key.  In VSCode the two keys are treated as one.

I believe that all three platforms supported by VSCode have underlying keycodes and libraries that can distinguish the two keys.
Repository: flutter
Issue: Flutter engine: embedder_external_texture for Vulkan
Labels: c: new feature,engine,P3,team-engine,triaged-engine

There is EmbedderExternalTextureGL for video player with opengl rendering:
  using ExternalTextureCallback = std::function<
      std::unique_ptr<FlutterOpenGLTexture>(int64_t, size_t, size_t)>;

  EmbedderExternalTextureGL(int64_t texture_identifier,
                            const ExternalTextureCallback& callback);

Is there a plan for video player with Vulkan？ such as EmbedderExternalTextureVK, FlutterOpenVKTexture

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Use case

<!--
     Please tell us the problem you are running into that led to you wanting
     a new feature.

     Is your feature request related to a problem? Please give a clear and
     concise description of what the problem is.

     Describe the alternative solutions you've considered. Is there a package
     on pub.dev/flutter that already solves this?
-->

## Proposal

<!--
     Briefly but precisely describe what you would like Flutter to be able to do.

     Consider attaching something showing what you are imagining:
      * images
      * videos
      * code samples

     Does this have to be provided by Flutter directly, or can it be provided
     by a package on pub.dev/flutter? If so, maybe consider implementing and
     publishing such a package rather than filing a bug.
-->
Repository: go
Issue: cmd/compile: reduce unnecessary register copies in regalloc
Labels: Performance,NeedsInvestigation,compiler/runtime

The instructions generated by the Go compiler for the code below contain too many unnecessary register copies.

```
//go:noinline
func swap(x, y float64) (float64, float64) {
        if y > x {
                x, y = y, x
        }
        return x, y
}
```

The assembly instructions:
```
0x0000 00000 (p.go:9)   TEXT    main.swap(SB), LEAF|NOFRAME|ABIInternal, $0-16
0x0000 00000 (p.go:10)  FCMPD   F1, F0
0x0004 00004 (p.go:10)  BMI     20
0x0008 00008 (p.go:13)  FMOVD   F1, F2
0x000c 00012 (p.go:13)  FMOVD   F0, F1
0x0010 00016 (p.go:13)  FMOVD   F2, F0
0x0014 00020 (p.go:13)  FMOVD   F0, F2 
0x0018 00024 (p.go:13)  FMOVD   F1, F0
0x001c 00028 (p.go:13)  FMOVD   F2, F1
0x0020 00032 (p.go:13)  RET     (R30)
```

The expected instruction sequence:
```
0x0000 00000 (p.go:9)   TEXT    main.swap(SB), LEAF|NOFRAME|ABIInternal, $0-16
0x0000 00000 (p.go:10)  FCMPD   F1, F0
0x0004 00004 (p.go:10)  BPL     20
0x0008 00008 (p.go:13)  FMOVD   F1, F2
0x000c 00012 (p.go:13)  FMOVD   F0, F1
0x0010 00016 (p.go:13)  FMOVD   F2, F0
0x0020 00020 (p.go:13)  RET     (R30)
```
Repository: vscode
Issue: Commit operation was cancelled notification might not be needed
Labels: git,ux,polish,under-discussion

Testing #153366

When I close the editor with the empty commit message you show the notification.
I think this is a bit out of context.

I would prefer if we do not show a notification at all. And potentially show the model dialog on editor close. "Are you sure you want to close since the commit will get canceled?"


![Screenshot 2022-06-29 at 12 44 34](https://user-images.githubusercontent.com/1926584/176418484-4b7393b4-5ca8-4a34-804e-fece53023b0b.png)
Repository: vscode
Issue: Make commit editor more discoverable
Labels: git,under-discussion

Testing #153366

The only way I can discover the commit editor is if I commit with an empty message. Something that I believe most users will not discover.
For example one of the commit actions in the dropdown could be "commit in editor".

![Screenshot 2022-06-29 at 12 52 21](https://user-images.githubusercontent.com/1926584/176420329-e840f2e5-8ddd-43e1-bef4-c495359c2b48.png)
Repository: godot
Issue: Godot Mono creates a .mono directory in projects with no C# scripts
Labels: enhancement,topic:dotnet

### Godot version

3.4.4 mono, 3.5 rc5 mono

### System information

Arch Linux

### Issue description

When you open a project using Godot with Mono support, it will create a `.mono` folder containing the Godot Mono assemblies, regardless if the project uses C# scripts. It would be a better idea to copy these assemblies when the `.csproj` file is created or updated to avoid creating unnecessary files

### Steps to reproduce

* Download Godot with Mono support
* Create or open an existing project

### Minimal reproduction project

_No response_
Repository: transformers
Issue: TF: XLA generation not working properly in some models
Labels: TensorFlow,Good Second Issue

This issue is used to track TensorFlow XLA generation issues, arising from #17857. There are three categories of issues, sorted in descending order by severity:

### Key model issues

These are heavily-used models, whose quality should be prioritized.

- [x] T5 -- The quality of the results decreases with `max_length`. See [here](https://github.com/huggingface/transformers/pull/17857/files#r906702367).
- [x] GPT-J -- fails simple generate tests with numerical issues

### Models failing basic tests

These models are failing `test_xla_generate_fast` -- a short greedy generation.

- [ ] LED
- [ ] Speech2Text
- [ ] XLNet
- [ ] XGLM

### Models failing complex tests

These are models failing `test_xla_generate_slow` -- a long beam search generation.

- [x] Bart
- [x] Blenderbot
- [x] Marian
- [x] mbart
- [x] OPT
- [x] Pegasus
Repository: opencv
Issue: Faile to compile when add stitching module to OpenCV
Labels: feature,category: stitching,category: javascript (js)

##### System information (version)
- OpenCV => 4.5.5
- Operating System / Platform => Linux
- Compiler => docker emscripten/emsdk:2.0.10 

##### Detailed description

I want add stitching module in opencv.js, so I modify some parameters and complie the module.

when running the command:

`docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk:2.0.10 emcmake python3 ./platforms/js/build_js.py build_js `

it reported the error message:

```
Generator error: unable to resolve base detail::GraphCutSeamFinderBase for detail_GraphCutSeamFinder
make[3]: *** [modules/js_bindings_generator/CMakeFiles/gen_opencv_js_source.dir/build.make:170: modules/js_bindings_generator/gen/bindings.cpp] Error 255
make[2]: *** [CMakeFiles/Makefile2:1681: modules/js_bindings_generator/CMakeFiles/gen_opencv_js_source.dir/all] Error 2
```

reply me if need more detail of error message.

##### Steps to reproduce

step 1. add js parameter in ocv_define_module method of file modules/stitching/CMakeLists.txt

before:

```
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_flann
                  OPTIONAL opencv_cudaarithm opencv_cudawarping opencv_cudafeatures2d opencv_cudalegacy opencv_cudaimgproc ${STITCHING_CONTRIB_DEPS}
                  WRAP python) 
```

->after:

```
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_flann
                  OPTIONAL opencv_cudaarithm opencv_cudawarping opencv_cudafeatures2d opencv_cudalegacy opencv_cudaimgproc ${STITCHING_CONTRIB_DEPS}
                  WRAP python js)
```

step 2. change DBUILD_opencv_stitching=ON in file platforms/js/build_js.py

before:

`DBUILD_opencv_stitching=OFF`

->after:

`DBUILD_opencv_stitching=ON`

step 3. run command:

`docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk:2.0.10 emcmake python3 ./platforms/js/build_js.py build_js `

##### Issue submission checklist

 - [x] I report the issue, it's not a question
   
 - [x] I checked the problem with documentation, FAQ, open issues,
       forum.opencv.org, Stack Overflow, etc and have not found any solution
 
 - [x] I updated to the latest OpenCV version and the issue is still there
  
 - [x] There is reproducer code and related data files: videos, images, onnx, etc
Repository: vscode
Issue: Colouring in Git commit editor a bit off
Labels: git,under-discussion

Testing #153366

I would expect the modified lines to be in green, since they are commented out and will be ignored?

![Screenshot 2022-06-29 at 14 27 54](https://user-images.githubusercontent.com/1926584/176436210-e1c2914e-e6ed-4e15-a7e6-ae349ca82245.png)
Repository: go
Issue: syscall: SysProcAttr.Noctty only works if child's stdin is controlling terminal
Labels: NeedsDecision,compiler/runtime

`SysProcAttr.Noctty` is implemented by calling `RawSyscall(SYS_IOCTL, 0, uintptr(TIOCNOTTY), 0)` before exec. The `TIOCNOTTY` ioctl is only implemented on the file descriptor of the controlling terminal, which is not necessarily attached to the child's FD 0. This means that `SysProcAttr.Noctty` only works when `cmd.Stdin` is the session terminal, and it's not possible to run a child that is both without a terminal and with a functioning stdin.

This came up because I am writing tests for an application that uses `/dev/tty` to interact with the user, and stdin to take input separately. I want to test what happens when `/dev/tty` is not available, so I start the child with `SysProcAttr.Noctty` set, and a pipe for stdin. The result is that `TIOCNOTTY` is issued on the pipe, causing `operation not supported by device`.

Here's a short example.

```go
package main

import (
	"os"
	"os/exec"
	"syscall"
)

func main() {
	if len(os.Args) > 1 && os.Args[1] == "child" {
		_, err := os.OpenFile("/dev/tty", os.O_RDWR, 0)
		if err != nil {
			println(err.Error()) // expect: "device not configured"
		}
		return
	}

	cmd := exec.Command(os.Args[0], "child")
	// Uncomment this block to have Noccty work correctly,
	// but making stdin in the child unusable.
	// f, err := os.OpenFile("/dev/tty", os.O_RDWR, 0)
	// if err != nil {
	// 	panic(err)
	// }
	// cmd.Stdin = f
	cmd.Stderr = os.Stderr // to see the output
	cmd.SysProcAttr = &syscall.SysProcAttr{}
	cmd.SysProcAttr.Noctty = true
	if err := cmd.Run(); err != nil {
		panic(err)
	}
}
```
Repository: material-ui
Issue: [Dialog] disableRestoreFocus only way to enable nested focus
Labels: bug 🐛,component: dialog

### Duplicates

- [X] I have searched the existing issues

### Latest version

- [X] I have tested the latest version

### Current behavior 😯

Setting `<Dialog disableRestoreFocus>` seems to be the only way for an internal `<TextField autoFocus>` element to maintain focus after opening.
```
<Dialog disableRestoreFocus>
  <DialogContent>
    <TextField autoFocus label="WILL BE IN FOCUS" />
  </DialogContent>
</Dialog>
```

**Additional testing notes:**
It seems this only happens when using `react=18` in `<StrictMode>`.  `react=17` in `<StrictMode>` and vanilla `react=18` work as expected.

### Expected behavior 🤔

I would expect either `disableAutoFocus` and/or `disableEnforceFocus` to allow for nested focusing, but they currently have no effect. This is problematic as `disableRestoreFocus` disables some additional accessibility I'd like to maintain.

```
<Dialog disableAutoFocus disableEnforceFocus>
  <DialogContent>
    <TextField autoFocus label="WILL NOT BE IN FOCUS" />
  </DialogContent>
</Dialog>
```

### Steps to reproduce 🕹

I've created a demo [here](https://github.com/kellengreen/mui-issue).

Steps:

1. Run `npm start`
2. Click `<Button>Open<Button/>`
3. `<TextField>` will no be highlighted unless `<Dialog disableRestoreFocus>` is set.

### Context 🔦

_No response_

### Your environment 🌎

<details>
  <summary><code>npx @mui/envinfo</code></summary>

```
  System:
    OS: macOS 12.4
  Binaries:
    Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
    Yarn: Not Found
    npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
  Browsers:
    Chrome: 103.0.5060.53
    Edge: Not Found
    Firefox: 102.0
    Safari: 15.5
  npmPackages:
    @emotion/react: ^11.9.3 => 11.9.3
    @emotion/styled: ^11.9.3 => 11.9.3
    @mui/base:  5.0.0-alpha.87
    @mui/material: ^5.8.6 => 5.8.6
    @mui/private-theming:  5.8.6
    @mui/styled-engine:  5.8.0
    @mui/system: ^5.8.6 => 5.8.6
    @mui/types:  7.1.4
    @mui/utils:  5.8.6
    @types/react:  18.0.14
    react: ^18.2.0 => 18.2.0
    react-dom: ^18.2.0 => 18.2.0
    typescript:  4.7.4
```
</details>