sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: [feature request] PyTorch vmap for efficient Evolutionary Strategies
Labels: feature,triaged,module: vmap,module: functorch

### 🚀 The feature, motivation and pitch

### Situation
I am currently working on Evolutionary Strategies in PyTorch and I noticed that there is no efficient way to use Modules for defining a Network that I want to train. In [EvoJAX](https://github.com/google/evojax) it is possible to define flax Modules and vmap over their parameters and forward function. In PyTorch it is currently possible to vmap over forward functions, but not over parameters (at least not that I can think of any way).

### Imagine following scenario
You want to train a simple MLP for solving XOR with Evolutionary Strategies in PyTorch.

Writing a custom forward method, this can be done very efficiently using einsums:
c: parameters of children in current population with shape [npop, params]
x: batched input: `torch.tensor([[0., 0.], [0., 1.], [1., 0.], [1., 1.]])`

```python
@torch.jit.script
def forward(c, x):
    # linear1 (in: 2, out: 2)
    x = torch.einsum('bi,nio->bno', x, c[..., :4].view(-1, 2, 2))
    x = x + c[..., 4:6]

    # relu
    x = F.relu(x)

    # linear2 (in: 2, out: 1)
    x = torch.einsum('bni,nio->bno', x, c[..., 6:8].view(-1, 2, 1))
    x = x + c[..., 8:9]

    return x
```

Now I would like to simply define my Network as nn.Module and  vmap over its parameters and forward function like this:

```python
def f(model, c, x):
   torch.nn.utils.vector_to_parameters(c, model.parameters())
   return model(x)

outputs = vmap(f, in_dims=(None, 0, None))(model, child_params, X)
```
This is currently not possible, because parameter assignment is weird in PyTorch.


### Alternatives

_No response_

### Additional context

_No response_

cc @zou3519 @Chillee @samdow
Repository: next.js
Issue: Middleware fetch requests do not work (POST, GET)
Labels: bug

### Verify canary release

- [x] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

    Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Home
    Binaries:
      Node: 16.14.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 12.2.6-canary.1
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0

### What browser are you using? (if relevant)

Chrome 104.0.5112.102

### How are you deploying your application? (if relevant)

Other platform (it happens on dev as well)

### Describe the Bug

We're trying to use fetch inside middleware.ts, 

```
import { NextRequest, NextResponse } from "next/server";

export function middleware(request: NextRequest) {
  const response = NextResponse.next();

  fetch(new URL("http://api.tvmaze.com/search/shows?q=postman").href, {
    method: "GET",
    headers: {
      "Content-Type": "application/json",
    },
  })
    .then((response) => {
      console.log("Event sent", response);
    })
    .catch((error) => {
      console.log("Fetching error: ", error);
    });

  return response;
}
```

instead of getting a response, we get the following error:
```
[TypeError: Cannot delete property 'Symbol(set-cookie)' of #<HeadersList2>]
```

This happens also on POST requests.

### Expected Behavior

We should get a response 

### Link to reproduction

https://github.com/ornakash/reproduction-template-nextjs

### To Reproduce

1. Clone the repository
2. use "yarn" and "yarn run dev" in order to start the server
3. Enter the app
4. Check the terminal - you should see the error

![image](https://user-images.githubusercontent.com/45389557/185331184-e2954c7d-bd03-4e01-9e62-abd4b1c3e076.png)
Repository: pytorch
Issue: [Discussion] Add custom device
Labels: triaged,module: dispatch,module: backend

### 🚀 The feature, motivation and pitch

We are an accelerator vendor and provide Pytorch extensions for our hardware MLU(https://github.com/Cambricon/catch). We would like to add a custom dispatch key and notice that other vendors have submitted their requests like XPU, IPU or NPU(only parts of dispatch keys are accepted), and you recommend to use PrivateUse key instead. We know the limits of adding a new key in Pytorch files but still have some questions.

1. Are all following vendors unable to merge their own custom dispatch key?

2. In some case, PrivateUse key can not meet demands. We think each kind of device may have some special cases to handle like:

https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/native/TensorShape.cpp#L1305
```
if (!self.is_xla() && !self.is_lazy() && !self.is_ipu()) { 
    return self._reshape_alias(shape, stride.value());
} else {
    return self.view(shape);
}
```

https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/TensorIterator.cpp#L1497
```
if (common_device_.type() == DeviceType::XLA  ||
      common_device_.type() == DeviceType::IPU  ||
      common_device_.type() == DeviceType::Lazy ||
      common_device_.type() == DeviceType::ORT  ||
      common_device_.type() == DeviceType::HPU) return;
```
It is easy to deal with such conditional judgement if our custom key is merged, but how to solve the problem when we do not change Pytorch files and only use PrivateUse key?


### Alternatives

_No response_

### Additional context

_No response_
Repository: terminal
Issue: Slow terminal restoring
Labels: Needs-Repro,Issue-Bug,Product-Terminal,Priority-3,Area-Windowing

### Windows Terminal version

1.14.2281.0

### Windows build number

10.0.19044.0

### Other Software

_No response_

### Steps to reproduce

1. Open and minimize windows terminal.
2. Restore window.
3. See slow restoring.

https://user-images.githubusercontent.com/68790724/185354302-446814b2-ee78-4050-8108-282b66966ea4.mp4



### Expected Behavior

Quick restoring, like Microsoft Store.

https://user-images.githubusercontent.com/68790724/185354488-248f6114-676a-474a-9e05-f45a1248dcc8.mp4

or Firefox

https://user-images.githubusercontent.com/68790724/185356556-d0746fdb-4e27-4cbc-bb4f-0ba04888db65.mp4

### Actual Behavior

Slow restoring
Repository: go
Issue: x/net:multicast server cannot send a unicast packet 
Labels: NeedsInvestigation

<!--
Please answer these questions before submitting your issue. Thanks!
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
</pre>
1.18
### 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> ubuntu/amd64</summary><br><pre>
$ go env

</pre></details>

### What did you do?
1. setup a udp server listening multicast traffic
2. client sends a multicast packet "hello"
3. server sends  a packet "world" back to the client
[test code](https://go.dev/play/p/Jsh4HPmJSEW)
<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on go.dev/play is best.
-->



### What did you expect to see?
client will receive "world" from the server


### What did you see instead?
the program runs no any error, the server received "hello", but the client cannot get "world" packet.
Repository: godot
Issue: Direct access to documentation and functions does not work sometimes
Labels: bug,topic:gdscript,topic:editor,confirmed

### Godot version

v3.5.stable.official [991bb6ac7]

### System information

win10 64

### Issue description

When you press CTRL + Right Click on the mouse Godot takes you to the documentation of the function or class.
The problem:
Sometimes this doesn't work, as you can see in this video.
In this video the problem occurs with "load_interactive" and with "get_ticks_msec".

https://user-images.githubusercontent.com/19652075/185357705-c77929a5-44ce-4f8c-93e2-03fd866442dd.mp4

I have not been able to reproduce the problem.

### Steps to reproduce

See the video

### Minimal reproduction project

...
Repository: create-react-app
Issue: provide some ability to set crossorigin attribute for JS chunk script tags when need
Labels: issue: proposal,needs triage

### Is your proposal related to a problem?

I am using CRA for a website, which serve its script via CDN, by set PUBLIC_URL to CDN host , everthing works fine . But soon I realized  its imposiible for sentry-like tools to get Error detail for the crossOrigin attribute is not 'annoymous' in script tag. 


<!--
  Provide a clear and concise description of what the problem is.
  For example, "I'm always frustrated when..."
-->


### Describe the solution you'd like

<!--
  Provide a clear and concise description of what you want to happen.
-->

Just like  what we do with PUBLIC_URL , maybe it is convient to provide a ENV key like 'SCRIPT_ACCROSS_ORIGIN' ?
Or maybe more convinent is to detect  whether the PUBLIC_URL is an absolute path , and if does ,automatically generate scipt tag with acrossorigin="annoymous" ?

### Describe alternatives you've considered

<!--
  Let us know about other solutions you've tried or researched.
-->

I have to turn my project into a  react-app-rewired or craco  version  to modify webpack config to achieve my goal;
Or write some ugly script to parse and modify my generated index.html  after build;

### Additional context

<!--
  Is there anything else you can add about the proposal?
  You might want to link to related issues here, if you haven't already.
-->
Repository: vscode
Issue: Enable history in input prompt
Labels: feature-request,debug

<!-- ⚠️⚠️ 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. -->

To provide a way to enable history in the input prompt, used for launch.json and tasks.json. This would enable developers to re-use the previously used values for the same input, without having to edit the default field all the time.

See this practical example (from https://github.com/rogalmic/vscode-bash-debug/pull/139):

![image](https://user-images.githubusercontent.com/29799350/185379324-2e398b54-9da0-493a-b273-670f7c75b3d5.png)


Instead of writing manually or relying on the default value, it would be extremely useful to have a history of the last used values, which could be presented as a list of options to pick above of input prompt or even simply having the last value in the field (instead of the default).

In this specific scenario, I'm debugging a big amount of bash scripts in a single repository, all of them with their own set of optional and positional arguments (and any sort of mix between them), which makes unfeasible to create a new configuration property in launch.json for every possibility.

But this, of course, would not be only useful for this, since the input prompt is acceptable from other fields as well.

For the specification, it could be something like (look at the commented line):

```
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "bashdb",
      "request": "launch",
      "name": "Bash-Debug (simplest configuration)",
      "program": "${file}",
      "cwd": "${workspaceFolder}",
      "argsString": "${input:arguments}"
    }
  ],
  "inputs": [
    {
      "id": "arguments",
      "type": "promptString",
      "default": "--help",
      "history": true, // <-- this activates the history for this input
      "description": "The arguments to pass to the script"
    }
  ]
}
```

Note there was a previous feature request (#97655) which did not reach enough votes, however I feel, that this time, as more people are using vscode it might get there.
Repository: vscode
Issue: Command to substitute variables from launch config should also get workspaceFolder as an argument
Labels: feature-request,api,debug

Issue raised by @nturinski:

We register the command `pickFuncProcess` which is triggered by pressing the Debug Start (F5) button. When we get the `DebugConfiguration` as the passed in the argument, it comes in as so:

![MicrosoftTeams-image (1)](https://user-images.githubusercontent.com/1926584/185382014-a346e4a2-b58f-4ea0-91b3-62ad2bd298c3.png)

The launch.json has `"processId": "${command:azureFunctions.pickProcess}"` set which is what triggers our `pickFuncProcess` command. 


Comment from @isidorn: The problem is that the Azure team can not differentiate what exact configuration it is in a Multi Root Workspace. Can we also pass the workspace folder as the second argument to command (the first argument is the configuration)?
Repository: vscode
Issue: Git - Use incrementing branch names / branch names based on date
Labels: feature-request,git

Rather than using `hediet/limited-vulture`, `hediet/passive-badger` etc. I think it would nice to experiment with incrementing branch names, e.g. `hediet/1`, `hediet/2`, ...
Or even based on the date (`hediet/2022-aug-18-1`, `hediet/2022-aug-18-2`, ...).

In general, it would be cool if (extension contributed) commands could be used in the template name.
Repository: next.js
Issue: Fonts are loaded from `assetPrefix` client-side only
Labels: bug

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

    Operating System:
      Platform: darwin
      Arch: x64
      Version: Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64
    Binaries:
      Node: 14.17.5
      npm: 6.14.14
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 12.2.6-canary.1
      eslint-config-next: N/A
      react: 17.0.2
      react-dom: 17.0.2

### What browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

next start

### Describe the Bug

Thanks to [`assetPrefix`](https://nextjs.org/docs/api-reference/next.config.js/cdn-support-with-asset-prefix), it's easy to use a CDN for JS and CSS code. 

However, it is interfering with fonts and is not working as expected.

![Screenshot 2022-08-18 at 10 07 38](https://user-images.githubusercontent.com/61967614/185343911-5fdd9ea3-b642-46ef-9af3-96c38bf50d60.png)

It appears that the client code uses the `assetPrefix` for fonts, but the server-side generated code is not using it, creating mismatched requests.

Important note: our environment variables are used at runtime and not at build time, because we reuse the build for different environments.


### Expected Behavior

Fonts to be handled consistently by `assetPrefix`. It should either work like JS and CSS file, or not be handled at all.

### Link to reproduction

https://github.com/florian-milky/asset-font-bug

### To Reproduce

1- npm run build

2- npm run copy

3- npx serve -C -p 3006 and in another tab: npm run start

4- open http://localhost:3000/

5- Debug network requests. Observe that font is preloaded from localhost:3000 and then loaded from localhost:3006
Repository: opencv
Issue: flann.knnMatch
Labels: category: features2d,needs reproducer

- OpenCV => 4.5.4-2021.4.1.2590
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2019

##### Detailed description

The function flann.knnMatch is supposed to "Find the k best matches for each descriptor from a query set".

Two issues occured : 1st  I found it finds and saves more than the best k matches for each descriptor. 2nd regarding the trainIdx and queryIdx, they seem to be swapped at times within the matches vector.

I found I could fix the issue, by applying matches.clear() in advance to calling knnMatches. I thought this function would do it anyways. Is it generally necessary to clear vectors before using them as function arguments that are supposed to be overwritten in opencv functions? If the function is supposed to delete the vector's content anyways but fails to do so in my case the problem might have to do with matches being a nested vector. Otherwise it would be my mistake.
Repository: material-ui
Issue: Style transition not working with mui/system
Labels: package: system


We've recently changed from styled-components to styled() coming from mui/system. We noticed that transitions do not take place as expected. 
Below is the code for a font-size transition when we were using styled-components:
```
const StyledHeader = styled(Grid)<{ $scrolled: boolean }>`
  background: linear-gradient(127.84deg, #bbf7f7 0%, #f3e1fc 100%);
  box-shadow: ${props =>
    props.$scrolled
      ? '0px 2px 4px -1px rgba(0, 0, 0, 0.05), 0px 4px 5px 0px rgba(0, 0, 0, 0.03), 0px 1px 10px 0px rgba(0, 0, 0, 0.03)'
      : 'none'};
  ${({ $scrolled }) =>
    $scrolled &&
    `
    ${StyledTitle} {
      font-size: 1.4rem;
    }
  `}
  padding: 8px;
  padding-top: 16px;
  transition: padding 0.5s;
  position: sticky;
  top: ${TOPBAR_HEIGHT}px;
  z-index: 996;
`

const StyledTitle = styled(Typography)<{ $mobileBreakpoint: string }>`
  transition: font-size 0.5s;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  overflow: hidden;
  margin-y: 1rem;
` 
```
When using styled() from mui/system this transition does not take place. The code is as follows:

```
const StyledHeader = styled(Grid)(() => ({
    background: 'linear-gradient(127.84deg, #bbf7f7 0%, #f3e1fc 100%)',
    boxShadow: scrolled
      ? '0px 2px 4px -1px rgba(0, 0, 0, 0.05), 0px 4px 5px 0px rgba(0, 0, 0, 0.03), 0px 1px 10px 0px rgba(0, 0, 0, 0.03)'
      : 'none',
    padding: '8px',
    paddingTop: '16px',
    transition: 'padding 0.5s',
    position: 'sticky',
    top: `${TOPBAR_HEIGHT}px`,
    zIndex: 996,
  }))
  
  const StyledTitle = styled(Typography)(() => ({
    fontSize: scrolled ? '1.4rem !important' : 'inherit',
    transition: 'font-size 0.5s',
    whiteSpace: 'nowrap',
    textOverflow: 'ellipsis',
    display: 'block',
    overflow: 'hidden',
    marginY: '1rem',
  }))
```
Ps.: If I define the font-size to be changed in a hover event, using the class '&:hover',the transition will work.

I'm attaching some screen recordings below of the transitions as they worked before, and how they're not working properly now, in that order.

Thanks in advance.

https://user-images.githubusercontent.com/33661312/185409004-e52f128c-d16f-46f7-b991-04ec6005f986.mp4
https://user-images.githubusercontent.com/33661312/185409022-64d9a56a-79f1-4b94-9a4c-650f33bcbf84.mp4
Repository: godot
Issue: File opened with "open_encrypted_with_pass" and "READ_WRITE" mode failes to store data
Labels: bug,topic:core

### Godot version

v3.5.stable.mono.official [991bb6ac7]

### System information

Windows 11

### Issue description

When I open a file using `open_encrypted_with_pass` method with `READ_WRITE` mode, `seek_end` of the file (but without it, does not work either) and then try to store_string some text I 'm getting an error:

```
E 0:00:02.128   store_buffer: File has not been opened in write mode.
  <C++ Error>   Condition "!writing" is true.
  <C++ Source>  core/io/file_access_encrypted.cpp:241 @ store_buffer()
  <Stack Trace> TestScene.gd:24 @ _input()
```

If I open a file with `open` method it works as expected.

I experienced this bug when I was trying to troubleshoot someone's problem on Reddit.

### Steps to reproduce

Check minimal reproduction project. Just create a scene with Node node and attach this script to it.

### Minimal reproduction project

```gdscript
extends Node


func _ready():
	var file = File.new()
	var err = file.open_encrypted_with_pass("user://file.txt", File.WRITE, "tralalalalala")
#	var err = file.open("user://file.txt", File.WRITE)
	if err == OK:
		file.store_line("Test")
		file.close()
	else:
		push_error(err)

func _input(event):
	if event is InputEventKey:
		if event.pressed and event.scancode == KEY_SPACE:
			var file = File.new()
			var err = 0
			
			err = file.open_encrypted_with_pass("user://file.txt", File.READ_WRITE, "tralalalalala")
#			err = file.open("user://file.txt", File.READ_WRITE)
			if err == OK:
				file.seek_end()
				file.store_string("Test" + str(OS.get_time()) + "\n")
				file.close()
			else:
				push_error(err)
			
			err = file.open_encrypted_with_pass("user://file.txt", File.READ, "tralalalalala")
#			err = file.open("user://file.txt", File.READ)
			if err == OK:
				print(file.get_as_text())
				file.close()
			else:
				push_error(err)

```
Repository: neovim
Issue: API: save/restore context (options, lockmarks, keepjumps, ...): vim.with()/vim.context()
Labels: enhancement,api,core,editor-state



### Problem

Currently, both `nvim_buf_set_lines` and `nvim_buf_set_text` destroys marks (`:h mark-motions`) between the `{starting}` and `{ending}` index. Fortunately, there is a `lockmarks` command but not having a callback signature makes it difficult to use from Lua script.

Ref: https://github.com/numToStr/Comment.nvim/issues/24 https://github.com/numToStr/Comment.nvim/issues/76

### Proposal

Introduce lua API (`nvim_lock_marks`) equivalent to `lockmarks` with lua callback support

```
api.nvim_lock_marks({command})                         *vim.api.nvim_lock_marks*
    Execute {command} without adjusting marks

    Parameters: ~
        {command}  (string|function)  Command/Callback to be executed

    See: ~
        |lockmarks|

    Usage: ~
        >
            vim.api.nvim_lock_marks(function()
                vim.api.nvim_buf_set_lines(0, 0, 1, true, { "hello" })
            end)
        <
```

Following is an example of workaround that is needed in the absence of aforementioned lua API.

- Current

```lua
-- my-module.lua

local mod = {}

function mod.run(motion, cfg)
    print(motion, cfg)
    local line = string.gsub(vim.api.nvim_get_current_line(), '^(%s*)', '%1-- ')
    vim.api.nvim_buf_set_lines(0, 0, 1, true, { line })
end

---@param motion string See |g@|
---@param cfg table Plugin config
function mod.locked(motion, cfg) -- I can't use this {cfg} table without converting it string or something
    vim.cmd(string.format("lockmarks lua require'my-module'.run'%s'", motion))
end

function mod.op()
    vim.o.operatorfunc = "v:lua.require'my-module'.locked"
    return 'g@'
end

vim.keymap.set('n', 'gc', mod.op, { expr = true })

return mod
```

- With Lua API (`nvim_lock_marks`)

```lua
-- my-module.lua

local mod = {}

---@param motion string See |g@|
---@param cfg table Plugin config
function mod.run(motion, cfg)
    -- I can then wrap plugin's API function and expose them directly to user
    vim.api.nvim_lock_marks(function()
        print(motion, cfg)
        local line = string.gsub(vim.api.nvim_get_current_line(), '^(%s*)', '%1-- ')
        vim.api.nvim_buf_set_lines(0, 0, 1, true, { line })
    end)
end

function mod.op()
    vim.o.operatorfunc = "v:lua.require'my-module'.run"
    return 'g@'
end

vim.keymap.set('n', 'gc', mod.op, { expr = true })

return mod
```
Repository: tensorflow
Issue: Bazel CI Failing for Tensorflow with Bazel@HEAD
Labels: stat:awaiting tensorflower,type:build/install,subtype:bazel

Tensorflow is impacted by an incompatible Bazel change: https://github.com/bazelbuild/continuous-integration/issues/1404

Tensorflow will need to migrate usages of `@bazel_tools//platforms` to `@platforms`, as described in the above bug.

Example breakage: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/2590#0182aec8-7365-4995-81b0-a0494cafc3ea