sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: Have the possibility to reduce a tensor with median on more than one specified dimension
Labels: triaged,enhancement,module: numpy,has workaround,module: reductions

## 🚀 Feature
<!-- A clear and concise description of the feature proposal -->
Allowing tuple of integers to be used when specifying the dimensions to reduce in the median function.

## Motivation

Currently it is not possible to use the median function with multiple reduction dimensions.
This is specified in [the docs](https://pytorch.org/docs/stable/generated/torch.median.html) and you also get the following error:
```
TypeError: median() received an invalid combination of arguments - got (Tensor, dim=tuple), but expected one of:
 * (Tensor input)
 * (Tensor input, name dim, bool keepdim, *, tuple of Tensors out)
 * (Tensor input, int dim, bool keepdim, *, tuple of Tensors out)
```
when trying to use it anyway.
This is what I get with the code:

```python
import torch
a = torch.ones(10, 10, 10)
torch.median(a, dim=(1, 2))
```

This feature would basically replicate what is the case for the [mean function](https://pytorch.org/docs/stable/generated/torch.mean.html#torch.mean).
It would make the computation of the median possible on batches easily.

## Pitch

It should be possible to do `torch.median(a, dim=(1, 2))` without errors, and the documentation should change to reflect that.

## Alternatives

I think there are 2 alternatives currently:
- reshape the tensor and then take the median along the non-reduced dimension. Can be error-prone and also add some tedious code.
- use [`vmap`](https://pytorch.org/docs/master/generated/torch.vmap.html) when trying to use median in a batched way. But this doesn't work for all configurations. However, I stumbled upon the following error `AttributeError: module 'torch' has no attribute 'vmap'` with version 1.7.1.

## Additional context

Definitely happy to submit a PR for this but I don't know where to find the definition of `median`.


cc @mruberry @rgommers @heitorschueroff
Repository: pytorch
Issue: [JIT] Support `torch.ones([])`
Labels: oncall: jit

## 🐛 Bug

```
import torch

def fn():
    return torch.ones([])

torch.jit.script(fn)
```

Error:
```
RuntimeError:
Arguments for call are not valid.
The following variants are available:

  aten::ones.names(int[] size, *, str[]? names, int? dtype=None, int? layout=None, Device? device=None, bool? pin_memory=None) -> (Tensor):
  Expected a value of type 'List[int]' for argument 'size' but instead found type 'List[Tensor]'.
  Empty lists default to List[Tensor]. Add a variable annotation to the assignment to create an empty list of another type (torch.jit.annotate(List[T, []]) where T is the type of elements in the list for Python 2)

  aten::ones(int[] size, *, int? dtype=None, int? layout=None, Device? device=None, bool? pin_memory=None) -> (Tensor):
  Expected a value of type 'List[int]' for argument 'size' but instead found type 'List[Tensor]'.
  Empty lists default to List[Tensor]. Add a variable annotation to the assignment to create an empty list of another type (torch.jit.annotate(List[T, []]) where T is the type of elements in the list for Python 2)

  aten::ones.out(int[] size, *, Tensor(a!) out) -> (Tensor(a!)):
  Expected a value of type 'List[int]' for argument 'size' but instead found type 'List[Tensor]'.
  Empty lists default to List[Tensor]. Add a variable annotation to the assignment to create an empty list of another type (torch.jit.annotate(List[T, []]) where T is the type of elements in the list for Python 2)

The original call is:
  File "scalar_ones.py", line 4
def fn():
    return torch.ones([])
           ~~~~~~~~~~ <--- HERE
```

Even though it is theoretically possible to infer that `[]` is `List[int]` here because all operator schemas of `aten::ones` indicate that first positional argument must be `List[int]`, we don't have such type inference logic in place to make it work.

cc @gmagogsfm
Repository: go
Issue: spec: clarify legality of non-ASCII graphic characters in import paths
Labels: Documentation,NeedsFix

About import paths, the spec (https://golang.org/ref/spec#Import_declarations) says:

> Implementation restriction: A compiler may restrict ImportPaths to non-empty strings using only characters belonging to Unicode's L, M, N, P, and S general categories (the Graphic characters without spaces) and may also exclude the characters !"#$%&'()*,:;<=>?[\]^`{|} and the Unicode replacement character U+FFFD.

but the Go 1.16 release notes (https://golang.org/doc/go1.16#go-command) say

> In module mode, the go command now disallows import paths that include non-ASCII characters or path elements with a leading dot character (.). Module paths with these characters were already disallowed (see Module paths and versions), so this change affects only paths within module subdirectories.

The latter wording appears to be a stronger restriction than allowed by the spec. Does the spec need to be changed?
Repository: flutter
Issue: Describe how to test on mobile browser with canvaskit forced on
Labels: d: api docs,platform-web,e: web_canvaskit,P2,team-web,triaged-web

https://flutter.dev/docs/development/tools/web-renderers talks about mobile browsers. It should then also have a short description on what's the recommended way of testing on mobile browsers (such as serving, opening firewall and then having the mobile phone on the same network navigate to the same serving url)
Repository: vscode
Issue: Notebook output must support more ANSI sequences
Labels: feature-request,notebook-output

follow up from https://github.com/microsoft/vscode/pull/116416#discussion_r593259173 and other discussions

Kernels often print stdout/stderr content with the assumption of being connected to a terminal. With that mindset they send ANSI sequences. Some of those sequences we support, like colors. We current don't support the sequence that clears the screen and that forces the jupyter extension to employ funny workarounds: they scan all output for that sequence, remember that so that they can clear the output before appending the next chunk. Things would be much simpler for them if we would simply support that ANSI sequence.
Repository: godot
Issue: [Editor Plugin] Control's clip content not showing when activated
Labels: bug,topic:plugin,topic:gui

**Godot version:**
3.2.4 RC4

**OS/device including version:**
Windows 10 x64

**Issue description:**
When I click **clip content** and activate the plugin, the texture rect child doesnt show.

https://user-images.githubusercontent.com/58845030/110977216-a8ea3900-8340-11eb-819c-b0bd6217e017.mp4

Here's a print from inside the running game, it works perfectly:
![image](https://user-images.githubusercontent.com/58845030/110977622-24e48100-8341-11eb-9709-e9318b28fd5d.png)


**Steps to reproduce:**
* Create a plugin
* Create a main scene for the plugin
* Add some control nodes
* add a child texture rect
* on texture rect's parent activate clip content
* activate the plugin
* bug can be seen

**Minimal reproduction project:**
This must be inside addon folder
[fight_anim.zip](https://github.com/godotengine/godot/files/6131887/fight_anim.zip)
Repository: pytorch
Issue: There should be a CI build with OpenBLAS in addition to MKL
Labels: module: ci,triaged

## 🚀 Feature
There should be a CI build with OpenBLAS in addition to MKL.

## Motivation

It is possible to compile PyTorch with BLAS and LAPACK implementations other than MKL. OpenBLAS is one of the popular alternatives to MKL. It would help detect possible failures with non-MKL installs.

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->
There could be potential failures that we don't see with MKL, for example https://github.com/pytorch/pytorch/issues/53454.

cc @malfet @seemethere @walterddr @ezyang @pytorch/pytorch-dev-infra
Repository: godot
Issue: Unable to use negative indices in Array.remove
Labels: enhancement,topic:core

<!-- Please search existing issues for potential duplicates before filing yours:
https://github.com/godotengine/godot/issues?q=is%3Aissue
-->

**Godot version: 3.2.3**
<!-- Specify commit hash if using non-official build. -->


**OS/device including version: Windows 10 x 64**
<!-- Specify GPU model, drivers, and the backend (GLES2, GLES3, Vulkan) if graphics-related. -->


**Issue description:**
When you create an `Array` and later use `Array.remove(index)`, `index` must be positive, althouth `Arrays` can be indexed using negative indices. The debugger message in the minimal reproduction project is: E 0:00:00.895   remove: Index p_index = -1 is out of bounds (size() = 3).  <C++ Source>  ./core/cowdata.h:161 @ remove()  <Stack Trace> Spatial.gd:7 @ _ready()

Maybe other methods have the same problem.


**Steps to reproduce:**
Create an `Array` and try to remove one element using a negative index with `Array.remove`

**Minimal reproduction project:**
<!-- A small Godot project which reproduces the issue. Drag and drop a zip archive to upload it. -->
[Github.zip](https://github.com/godotengine/godot/files/6132358/Github.zip)
Repository: go
Issue: cmd/cgo: exported function name shadowing issue
Labels: NeedsInvestigation,compiler/runtime

<!--
Please answer these questions before submitting your issue. Thanks!
For questions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.16.2 linux/amd64
</pre>

### Does this issue reproduce with the latest release?
Yes, this was introduced somewhere between 1.14 and 1.16.

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/xxx/.cache/go-build"
GOENV="/home/xxx/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/xxx/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/xxx/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/xxx/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/xxx/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2817633273=/tmp/go-build -gno-record-gcc-switches"

</pre></details>

### What did you do?

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->

Attempting to compile the following snippet fails in 1.16:
```
package baz

// typedef struct { int x; } foo;
import "C"

//export bar
func bar(foo *C.foo) {
}
```
```
$ /xxx/go1.14/bin/go build foo.go 
$ /xxx/go1.16.2/bin/go build foo.go 
# command-line-arguments
_cgo_export.c: In function ‘bar’:
_cgo_export.c:28:3: error: expected specifier-qualifier-list before ‘foo’
   28 |   foo* p0;
      |   ^~~
_cgo_export.c:32:8: error: ‘_cgo_argtype’ {aka ‘struct <anonymous>’} has no member named ‘p0’
   32 |  _cgo_a.p0 = foo;
      |        ^

```
The generated C code fails to compile, because of the overloaded `foo` name (variable shadowing the type):
```
void bar(foo* foo) {
        typedef struct {
                foo* p0; // <---- fails here
        } __attribute__((__packed__, __gcc_struct__)) _cgo_argtype;
}

```

With 1.14, the generated code doesn't use the name from the go code, and so doesn't have this issue:
```
void bar(foo* p0) {
	struct {
		foo* p0;
	} __attribute__((__packed__, __gcc_struct__)) a;
```

### What did you expect to see?
No build failure.


### What did you see instead?
Build failure.
Repository: electron
Issue: [Bug]: BrowserView elements do not retain input focus between BrowserWindow blur/focus
Labels: platform/windows,bug :beetle:,component/BrowserView,12-x-y

### Preflight Checklist

- [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](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.

### Electron Version

12.0.1

### What operating system are you using?

Windows

### Operating System Version

10

### What arch are you using?

x64

### Last Known Working Electron version

_No response_

### Expected Behavior

When I'm focused in a BrowserView, I expect that alt+tabbing away, and alt+tabbing back, will keep focus in the BrowserView

### Actual Behavior

Focus is lost, and I have to click back into the BrowserView

### Testcase Gist URL

_No response_

### Additional Information

_No response_

This is a continuation of this closed [issue](https://github.com/electron/electron/issues/5900) concerning webview, though it seems like this works fine for webview. Only BrowserView have this problem.

1. start the app below and focus in the google input field
2. alt tab away and alt tab back
3. focus isn't in the input field (in fact, it goes back to the main input element)

main.js:
```
const {app, BrowserWindow, BrowserView} = require('electron');

app.on('ready', () => {
  const mainWindow = new BrowserWindow();
  const view = new BrowserView();
  view.setBounds({x: 0, y: 50, width: 800, height: 550});
  mainWindow.setBrowserView(view);

  mainWindow.loadFile(__dirname + "/index.html")
  view.webContents.loadURL("https://google.com");

  view.webContents.openDevTools({mode: "detach"}); // seems like this is required for BV to load the page for wrhatever reason
});
```

index.html:
```
<html>
	<head></head>
	<body>
		this is an input in index.html:<br/>
		<input></input>

		<br/>
	</body>
</html>
```

I'm having to work around it by intercepting the `focus` event of the `BrowserWindow` and explicitly focus the `BrowserView`'s `WebContents`.

![focusretain](https://user-images.githubusercontent.com/6374473/110993051-6cb4d980-833c-11eb-8650-1c908c54c83b.gif)
Repository: pytorch
Issue: [JIT] TorchScript infers incorrect type for `or` in non-boolean context
Labels: oncall: jit

## 🐛 Bug

TorchScript seems to always treat an `or`-based expression as boolean type, this is incorrect in non-boolean context.

## To Reproduce

```
import torch


class OrModule(torch.nn.Module):
    def __init__(self, v = 5):
        super().__init__()
        self.v = v

    def forward(self, a: int):
        b: int = self.v or a
        return b

m = OrModule()
torch.jit.script(m)
```

Error:
```
RuntimeError:
Variable 'b' is annotated with type int but is being assigned to a value of type bool:
  File "or.py", line 10
    def forward(self, a: int):
        b: int = self.v or a
        ~ <--- HERE
        return b
```

## Expected behavior

TorchScript should be able to mimic Python behavior to tell that `self.v or a` means return either `self.v` or `a` rather than evaluating `self.v` and `a` as boolean values and then `or` them.

( I think we have an issue about this before, but can't find it now )


cc @gmagogsfm
Repository: TypeScript
Issue: Narrow unnecessarily ambiguous Date.getMonth return type.
Labels: Suggestion,Experience Enhancement

The specified behaviour of `Date.getMonth` implies that it will **always** return a number from 0 - 11 inclusive. 

Hence annotating the return type ([source](https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es5.d.ts#L751)) as `number` is unnecessarily ambiguous. 

If it would be accepted, I would like to open a PR to narrow the type down to the 12 values from 0 - 11. 

<!--
  Please fill in each section completely. Thank you!
-->

## 🔍 Search Terms

Date
getMonth
ambiguous type
narrowing type

## ✅ Viability Checklist

<!--
   Suggestions that don't meet all these criteria are very, very unlikely to be accepted.
   We always recommend reviewing the TypeScript design goals before investing time writing
   a proposal for ideas outside the scope of the project.
-->
My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
   - the set of `0..11` inclusive is also part of the set `number`. Hence this **narrowing** is not breaking.
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).


## ⭐ Suggestion

If it would be accepted, I would like to open a PR to narrow the type down to the 12 values from 0 - 11. 

```typescript
interface Date {
  getMonth(): 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11
}
```

## 📃 Motivating Example

I think this is a very small and self-explanatory enhancement. The benefit here being that the type better describes the behaviour.

Whereas before "the set of things this function could do" was much wider. Now by reading the type (even if you didn't know the name of the method) you could rest assured that you are handling all cases correctly. 

Secondly, by looking at the type, one need not read documentation to know that January is 0, not 1 as many JS developers probably learned the hard way.

## 💻 Use Cases

Make types represent the behaviour of a function more accurately.
Repository: pytorch
Issue: SubgraphRewriter doesn't handle tensor constants in replacement graph 
Labels: triaged,module: fx

## 🐛 Bug

torch.fx doesn't handle `torch.empty` appropriately.

## To Reproduce

```
import torch
from torch.fx import symbolic_trace, replace_pattern

def pattern(inp):
    return inp

def replacement(inp):
    t = torch.empty(10)
    return t + inp

class MyModule(torch.nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, inp):
        return inp


if __name__ == "__main__":

    traced_model = symbolic_trace(MyModule())
    print ('Before Replacement: {}'.format(traced_model.code))

    replace_pattern(traced_model, pattern, replacement)

    traced_model.recompile()

    print ('After Replacement: {}'.format(traced_model.code))

    traced_model(torch.rand(10))
```

Output is:

```
Before Replacement: 
def forward(self, inp):
    return inp
    
After Replacement: 
def forward(self, inp):
    _tensor_constant0 = self._tensor_constant0
    add = _tensor_constant0.add(inp);  _tensor_constant0 = inp = None
    return add
    
Traceback (most recent call last):
  File "/tmp/test.py", line 30, in <module>
    traced_model(torch.rand(10))
  File "/data/users/pritam/pytorch/torch/fx/graph_module.py", line 506, in wrapped_call
    raise e.with_traceback(None)
AttributeError: 'MyModule' object has no attribute '_tensor_constant0'
```

## Expected behavior

Method like `torch.empty` should be supported in replacement patterns for torch.fx

cc @ezyang @SherlockNoMad
Repository: pytorch
Issue: Only tensor can be proxied in builtin operators with `__torch_function__`
Labels: triaged,module: __torch_function__,module: fx

## 🐛 Bug

Only tensor can be proxied in builtin operators, which means we couldn't accept dynamic value for non-tensor arguments, pretty fundamental limitation, we should figure out a way to fix it.


## To Reproduce

```python
import torch
from torch.fx import symbolic_trace

def test(input, world_size):
    return input_1.size(1) / world_size


class MyModule(torch.nn.Module):
    def __init__(self):
        super().__init__()
        # self.param = torch.nn.Parameter(torch.rand(3, 4))
        # self.linear = torch.nn.Linear(4, 5)

    def forward(self, input, world_size):
        return torch.narrow(input, 0, 0, input.size(1) / world_size)
        # return torch.add(input, 1)


m = MyModule()

gm = symbolic_trace(m)
print(gm.code)
```

error:

```
Traceback (most recent call last):
  File "/private/home/wanchaol/test_fx.py", line 21, in <module>
    gm = symbolic_trace(m)
  File "/raid/wanchaol/pytorch/torch/fx/symbolic_trace.py", line 621, in symbolic_trace
    graph = tracer.trace(root, concrete_args)
  File "/raid/wanchaol/pytorch/torch/fx/symbolic_trace.py", line 368, in trace
    self.create_node('output', 'output', (self.create_arg(fn(*args)),), {},
  File "/private/home/wanchaol/test_fx.py", line 15, in forward
    return torch.narrow(input, 0, 0, input.size(1) / world_size)
TypeError: narrow() received an invalid combination of arguments - got (Proxy, int, int, Proxy), but expected one of:
 * (Tensor input, int dim, Tensor start, int length)
      didn't match because some of the arguments have invalid types: (Proxy, int, int, Proxy)
 * (Tensor input, int dim, int start, int length)
      didn't match because some of the arguments have invalid types: (Proxy, int, int, Proxy)
```

## Expected behavior

should not crash


cc @ezyang @gchanan @zou3519 @hameerabbasi @rgommers @peterbell10 @SherlockNoMad @bdhirsh @jbschlosser @anjali411 @jamesr66a
Repository: terminal
Issue: Feature request: Pasting with OSC 52 (for e.g. terminal-based editors)
Labels: Help Wanted,Area-TerminalControl,Area-Settings,Product-Terminal,Issue-Task

Related: #2946, #5823

It seems like a decision was made not to support pasting due to security concerns. This is understandable of course, but considering there are editors (such as `micro`) that actually use this functionality, it's also a bit disappointing.

Perhaps a middle ground would be to have the support but require the user to opt in in Windows Terminal settings?

FWIW, `> help copypaste` in `micro` gives this useful info:

```
* Kitty: supported, but only writing is enabled by default. To enable
  reading, add `read-primary` and `read-clipboard` to the
  `clipboard_control` option.

* iTerm2: only copying (writing to clipboard) is supported. Must be enabled in
  `Preferences->General-> Selection->Applications in terminal may access clipboard`.
  You can use Command-v to paste.

* `st`: supported.

* `rxvt-unicode`: not natively supported, but there is a Perl extension
   [here](http://anti.teamidiot.de/static/nei/*/Code/urxvt/).

* `xterm`: supported, but disabled by default. It can be enabled by putting
   the following in `.Xresources` or `.Xdefaults`:
   `XTerm*disallowedWindowOps: 20,21,SetXprop`.

* `gnome-terminal`: does not support OSC 52.
```
Repository: flutter
Issue: Canvas.drawImage should have sample code
Labels: engine,d: api docs,d: examples,a: assets,P2,team-engine,triaged-engine

`Canvas.drawImage` should have sample code showing how to render an asset.
Alternatively it could point to paintImage or some such.
Repository: excalidraw
Issue: Option to hide object selection & movement controls in Zen Mode
Labels: enhancement

If I'm familiar with Excalidraw, then I don't really need the outline and the controls around an object to select it, resize or move it around. I can just hover around the edges and the corners, and as the cursor changes, I'll know which control is activated. 

![image](https://user-images.githubusercontent.com/1560745/111017672-e00d2880-83da-11eb-91fa-5c2f5994b5d3.png)

This would be especially useful in Zen mode, where even the outline and the controls tend to get your way. I use Zen mode in live online classes for whiteboarding, and the outlines & controls are definitely distracting for the audience.