sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: Add custom types to PyTorch
Labels: feature,triaged

## ❓ Questions and Help

Is it possible to create a PyTorch extension module that adds support for a new type of tensors?

As far as I know, in the case of NumPy,  it is possible to define a [Python extension type](https://docs.python.org/3/extending/newtypes_tutorial.html), as well as adding built-in support for this new type to NumPy with an [extension module](https://numpy.org/doc/stable/user/c-info.how-to-extend.html) that allows generating ndarrays of this custom type. Examples of this are the [rational](https://github.com/numpy/numpy-dtypes/tree/master/npytypes/rational) and [quaternion](https://github.com/moble/quaternion) packages.

Therefore, I wonder if there is a similar manner to do this (or to extend the previous NumPy dtypes) in PyTorch, so that it is possible to declare tensors of such type and perform math calculations with them (of course, all the arithmetic operations should be re-defined for this new type).

I read the [Extending PyTorch](https://pytorch.org/docs/stable/notes/extending.html#extending-torch) documentation, although I guess this way is not the most efficient one and it has some limitations, as the need to generate tensors of already-known types in some cases.
Rather, I would be looking to write an extension module such as those aforementioned (the process of which is detailed at https://numpy.org/doc/stable/user/c-info.how-to-extend.html), so that it includes a new `torch.dtype`.

Currently, if trying to create a tensor of any custom type, let's say `my_type` (which is numeric and supported either in Python or NumPy via an extension module), the following error arises:
```python
>>> arr = np.array([1., 3., 5., 7., 9.], dtype=np.my_type)
>>> arr
array([1, 2, 3, 4], dtype=my_type)
>>> torch.tensor([1., 3., 5., 7., 9.], dtype=np.my_type)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: tensor(): argument 'dtype' must be torch.dtype, not type
>>> torch.tensor(arr)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't convert np.ndarray of type my_module.my_type. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.
```

The main problem is that the custom dtype that I am defining is not based on float or ints structures, but rather on a kind of custom floating-point format whose implementation uses unsigned int for storage and redefines all arithmetic operations bit-wise.
Repository: pytorch
Issue: [feature request] Introduce env var `TORCH_USE_CUDA=OFF` and some `torch.cuda.enabled = False`  to faithfully/completely disable cuda (torch.cuda.is_available() <- False and torch.cuda.get_device_count() <- 0) and driver loading/interaction
Labels: module: cuda,triaged,enhancement,small

Maybe if `CUDA_VISIBLE_DEVICES` is empty, then it could return False immediately (at least for guard functions like `torch.cuda.is_available()` or `torch.cuda.get_device_count()`). I'm specifically nulling out `CUDA_VISIBLE_DEVICES` to prevent any CUDA-related code from running completely. I understand that checking `CUDA_VISIBLE_DEVICES` may be a bit over-fitting, maybe there's another better lightweight way.

```shell
CUDA_VISIBLE_DEVICES= python -c "import torch; print(torch.cuda.is_available())"

# /prefix/miniconda/lib/python3.8/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 10010). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at  /opt/conda/conda-bld/pytorch_1607369981906/work/c10/cuda/CUDAFunctions.cpp:100.)
  return torch._C._cuda_getDeviceCount() > 0
False
```

cc @ngimel
Repository: go
Issue: misc/cgo/testplugin: TestIssue18676 failure with "signal: killed" on darwin-amd64-10_15 builder
Labels: NeedsInvestigation

[2021-02-23T04:13:24-a2e150c/darwin-amd64-10_15](https://build.golang.org/log/6254311bef58f3ea7529b0c3c6e33e921b18c975)

```
##### ../misc/cgo/testplugin
--- FAIL: TestIssue18676 (16.93s)
    plugin_test.go:142: ./issue18676.exe: signal: killed
FAIL
FAIL	misc/cgo/testplugin	101.462s
```

CC @cherrymui @ianlancetaylor
Repository: create-react-app
Issue: "npx create-react-app my-app" stopped working in 4.0.3
Labels: needs triage,issue: bug report

<!--
    Please note that your issue will be fixed much faster if you spend about
    half an hour preparing it, including the exact reproduction steps and a demo.

    If you're in a hurry or don't feel confident, it's fine to report bugs with
    less details, but this makes it less likely they'll get fixed soon.

    In either case, please use this template and fill in as many fields below as you can.

    Note that we don't provide help for webpack questions after ejecting.
    You can find webpack docs at https://webpack.js.org/.
-->

### Describe the bug

```
/tmp
▶ npx create-react-app my-app

You are running `create-react-app` 4.0.1, which is behind the latest release (4.0.3).

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app

The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/

npm ERR! code 1
npm ERR! path /private/tmp
npm ERR! command failed
npm ERR! command sh -c create-react-app my-app

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/peterbe/.npm/_logs/2021-02-23T16_06_05_071Z-debug.log

/tmp
▶ npx --version
7.5.6
```

If `create-react-app` is not meant to work with `npx`, then https://create-react-app.dev/docs/getting-started/ is wrong. 

### Did you try recovering your dependencies?

not applicable

### Which terms did you search for in User Guide?

- `npx`
- getting started

### Environment

OSX Big Sur
npm 7.5.6
node v15.2.1

### Steps to reproduce

```
cd /tmp/
npx create-react-app my-app
```

### Expected behavior

That it should create a directory called `my-app`.

### Actual behavior

See error above. 

### Reproducible demo

Not applicable.
Repository: vscode
Issue: [product icon themes] No fallback for using icon contribution point
Labels: feature-request,icons-product

Testing #117263

While it's been nice to leverage custom icons from another extension:

![image](https://user-images.githubusercontent.com/35271042/108879713-61c91d80-75b6-11eb-9c6f-febfd6f77fb0.png)

There doesn't seem to be a way to set a fallback in case a user does not have the custom icon extension installed:

![image](https://user-images.githubusercontent.com/35271042/108879776-71e0fd00-75b6-11eb-92bb-4e906f31bc23.png)

I guess you could mark that other extension as a dependency, but that would make it harder to use and would love for an easier way. We should allow for a fallback icon that uses a `codicon` icon.
Repository: pytorch
Issue: Add Quantized{CPU|CUDA} support to Structured Kernels
Labels: module: internals,triaged,module: structured kernels

Structured Kernels currently only support CPU/CUDA. Currently, this means we'll see entries like this in native_functions.yaml: An op is marked as "structured_delegate", but still has dispatch entries for the dispatch keys that structured kernel codegen can't handle.

```
 - func: upsample_nearest2d(Tensor self, int[2] output_size, float? scales_h=None, float? scales_w=None) -> Tensor
   python_module: nn
   structured_delegate: upsample_nearest2d.out
   dispatch:
     QuantizedCPU: upsample_nearest2d_quantized_cpu
```

Quantized kernels make up ~100 or so of the ops in `native_functions.yaml`, and it would be nice to get them to work with structured kernels codegen.


One bit that complicates the work: Quantized requires some extra arguments to instantiate tensors that aren't required for CPU/CUDA. These arguments are currently passed from the user-written `meta` kernel into the codegen'd `set_output` function, which lives [here](https://github.com/pytorch/pytorch/blob/dc6fab44525c2613906b9f4094689b05f02a3a86/aten/src/ATen/TensorMeta.h#L52). It's incompatible with quantized kernels, because quantized kernels create tensors using an `_empty_affine_quantized()` function that takes in two extra arguments: `q_scale`, and `q_zero_point`. An example is [here](https://github.com/pytorch/pytorch/blob/dc6fab44525c2613906b9f4094689b05f02a3a86/aten/src/ATen/native/quantized/cpu/qupsample_nearest2d.cpp#L122).

A few options for how to get everything to work:
(1) Don't change the existing meta functions at all. Instead, see if there's a way to bike-shed extra logic into the codegen somewhere to handle quantized. One option would be for the codegen'd logic inside of `set_output` to optionally call an extra function, only for quantized kernels, that gets it those two pieces of data. Another would be to see if we could construct the `out` tensor *without* the extra quantized arguments, and later update the tensor with those arguments in the actual quantized kernel.
(2) Update the signature of `MetaBase::set_output()` to be generic enough to handle both Quantized and CPU/CUDA backends. One option would be to have it take in the entire tensor rather than (sizes, options), although I'm not sure if that would work cleanly with `TensorIteratorBase`
(3) Have a separate meta function just for quantized kernels. Ops with quantized kernels would then have 2 separate meta functions.

(1) is probably the nicest solution, but would take some exploration to figure out if it's possible.

cc @ezyang @bhosmer @smessmer @ljk53 @bdhirsh @ailzhang
Repository: rust
Issue: Rustdoc: in "Blanket Implementations" list for a given type, show std traits separately from non-std traits
Labels: T-rustdoc,C-enhancement

The "Blanket Implementations" section has a high noise level since it lists a lot of traits that you tend to assume every type implements:

* `Any`
* `Borrow<T> for T`
* `BorrowMut<T> for T`
* `From<T> for T`
* `Into<T> for T`
* `ToOwned` (for types implementing `Clone`)
* `TryFrom<T> for T`
* `TryInto<T> for T`

For example, [`blake2::Blake2b`](https://docs.rs/blake2/0.9.1/blake2/struct.Blake2b.html#blanket-implementations) has this issue where the important blanket impl of `Digest` is easy to miss amongst all the `std` traits: https://www.reddit.com/r/rust/comments/lpgw1n/hey_rustaceans_got_an_easy_question_ask_here_82021/gohdi07/?context=10000

For this reason, I'd like to see blanket impls of `std` traits listed separately, preferably _below_ traits that aren't from `std`. Perhaps this shouldn't just apply to the "Blanket Implementations" section but the main "Trait Implementations" section as well.

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":"Stupremee"}$$TRIAGEBOT_ASSIGN_DATA_END -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->
Repository: godot
Issue: 3D Workspace doesn't appear
Labels: topic:editor

Godot version: v3.2.3.stable.official (using GLE3 if that helps)
System stuff: Windows 10, Nvidia Geforce GTX GPU, Intel i5 CPU
Steps to reproduce: I have no clue.
I don't know if this is a bug or something I messed up but this image should explain it. The 3D workspace is gone.
![godot3dgone](https://user-images.githubusercontent.com/79534375/108884024-1f163e00-75d4-11eb-8b51-b8027441d16a.png)
Repository: next.js
Issue: FOUC only in production on latest Firefox
Labels: good first issue,Upstream,bug

**What version of Next.js are you using?**

10.0.7

**What version of Node.js are you using?**

12.8.3

**What browser are you using?**

Firefox 85.0.1 (64-bit)

**What operating system are you using?**

Pop_OS! 20.04 (Ubuntu 20.04)

**How are you deploying your application?**

Vercel

**Describe the Bug**

I see a FOUC when accessing [my production deployment](https://tutorbook.app) on Firefox:

![fouc](https://user-images.githubusercontent.com/20798889/111108948-0e901e00-8517-11eb-9acb-87eab1d4376b.gif)

It seems to disappear when using Chrome or Firefox on mobile.

I also appear to get the same issue [for my portfolio website](https://nicholaschiang.com) on Firefox:

![fouc-portfolio](https://user-images.githubusercontent.com/20798889/111108969-164fc280-8517-11eb-997b-8afda8034592.gif)

**Expected Behavior**

There should be no FOUC.

**To Reproduce**

1. Visit [my production deployment](https://tutorbook.app).
2. See FOUC.

Or, to reproduce locally:
1. Clone [this repository](https://github.com/tutorbookapp/tutorbook).
2. Install dependencies (using `yarn`).
3. Start a development server (using `yarn dev:next`).
4. Visit http://localhost:3000 and see FOUC.

You'll need some `env` files for that reproduction to work correctly. Instead, you can just reproduce the same FOUC using my portfolio website (which is a lot smaller than that repo anyways):
1. Clone [this repository](https://github.com/nicholaschiang/website).
2. Install dependencies (using `yarn`).
3. Start a development server (using `yarn dev`).
4. Visit http://localhost:3000 and see FOUC.
Repository: flutter
Issue: Prevent user to initiate Nav 2.0 swiping back iOS style dynamically
Labels: framework,f: routes,c: proposal,P3,team-framework,triaged-framework

### Problem
Using the Navigator 2.0 there is no built-in delegate to control conditionally whether the user can **initiate** a swipe back to the previous screen. 

### Use Case
I have a slider that is close to the edge of the screen. When the user drags the slide it causes the screen to swipe back to the previous screen. I want to disable swipe back if the user is dragging the slider.

### Work around
Wrapping any widget at any level of the build method with this widget prevents it by inserting WillPopScope conditionally.

```
class MySwipeDisable extends StatelessWidget{
  final Widget child;
  final bool disable;
  const MySwipeDisable({Key key, this.child, this.disable}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return disable? WillPopScope(child: child, onWillPop: ()async =>false): child;
  }
}
```
Repository: pytorch
Issue: [BE] Consolidating scripts/ and tools/ folder
Labels: module: docs,triaged

## 📚 Documentation

A bit confused regarding the current folder structure of `scripts/` vs `tools/`. quote the README.md in both of them:
`scripts/README.md`:
```
This directory contains the useful **tools**.
```
`tools/README.md`:
```
This folder contains a number of **scripts** which are used as
part of the PyTorch build process.  This directory also doubles
as a Python module hierarchy (thus the `__init__.py`).
```

should we consider consolidating the 2 folders?


cc @brianjo @mruberry
Repository: PowerToys
Issue: [PT Run] explorer.exe instead of execute shell
Labels: Product-PowerToys Run,Area-Quality,Run-Plugin,Planning-Consideration,Issue-Task

With https://github.com/microsoft/PowerToys/pull/7292 and https://github.com/microsoft/PowerToys/pull/9538 merged theare are still a few `explorer.exe` being called instead on executing shell.
Folder and Indexer plugin are invoking `explorer.exe` in "Open containing folder" context menu.

![image](https://user-images.githubusercontent.com/25966642/108895381-c9fa1c80-7613-11eb-89e6-604417876200.png)

Removing `explorer.exe` file won't be selected anymore when File Explorer is opened.
Repository: rust
Issue: Suggest reborrowing mutable borrow when moved
Labels: C-enhancement,A-diagnostics,A-borrow-checker,T-compiler,D-newcomer-roadblock

The following code:

```rust
fn foo(val: &mut bool) {
    match (val, true) {
        _ => { val; }
    }
}
```

results in the following error:

```
error[E0382]: use of moved value: `val`
 --> src/lib.rs:3:16
  |
1 | fn foo(val: &mut bool) {
  |        --- move occurs because `val` has type `&mut bool`, which does not implement the `Copy` trait
2 |     match (val, true) {
  |            --- value moved here
3 |         _ => { val; }
  |                ^^^ value used here after move

error: aborting due to previous error
```

We should suggest `match (&mut *val, true)`, which will make this compile.

Note that the following code *does* compile:

```rust
fn foo(val: &mut bool) {
    match val {
        _ => { val; }
    }
}
```

It looks like we automatically insert a reborrow under some circumstances.
Repository: go
Issue: tools/cmd/goyacc: goyacc generates a parser routine $$Tokname that doesn't work
Labels: NeedsInvestigation

<!--
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

1.15

</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>
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/dswartz/.cache/go-build"
GOENV="/home/dswartz/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/dswartz/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/dswartz/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/lib/golang"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build943484181=/tmp/go-build -gno-record-gcc-switches"
</summary><br><pre>
$ go env

</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.
-->

A trivial yacc grammar with the following tokens:

%token ABLE
%token BAKER
%token CHARLIE

The main function call fmt.Printf  with the output of yyTokname (passing in the token const)

### What did you expect to see?

ABLE => "ABLE"
BAKER => "BAKER"
CHARLIE => "CHARLIE"


### What did you see instead?

ABLE => "tok-57346"
BAKER => "tok-57347"
CHARLIE => "tok-57348"
Repository: ant-design
Issue: Select maxTagCount="responsive" causes lost cursor
Labels: 🐛 Bug,Inactive

- [ ] I have searched the [issues](https://github.com/ant-design/ant-design/issues) of this repository and believe that this is not a duplicate.

### Reproduction link
[![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/antd-reproduction-template-forked-xf4r9)

### Steps to reproduce
1. Clear input -> choose first tag -> cursor is lost
2. When at least one tag -> remove last tag -> cursor is lost

### What is expected?
Cursor should stay active

### What is actually happening?
Cursor is lost

| Environment | Info |
|---|---|
| antd | 4.12.3 |
| React | 17.0.1 |
| System | MacOS |
| Browser | Chrome |


<!-- generated by ant-design-issue-helper. DO NOT REMOVE -->
Repository: flutter
Issue: flutter/cocoon pixel test failures are difficult to resolve
Labels: a: tests,team,framework,P2,team-framework,triaged-framework

Right now every time we make a change in the engine that affects the pixel tests in cocoon, it involves:

- Disabling cocoon in flutter/tests
- Landing the engine roll
- Rebaselining the cocoon reference images
- Landing those in cocoon
- Re-enabling cocoon and updating the repository pin flutter/tests

This is very cumbersome and we should figure out a better way to do this.

cc/ @zanderso @jason-simmons @CaseyHillers
Repository: pytorch
Issue: [TensorExpr] Loop Transformations: `compute_inline` should use `Let` for inlined expressions
Labels: triaged,NNC

## 🚀 Feature
Currently `compute_inline` simply substitutes all accesses to the inlined buffer with its defining expression, and that potentially could generate redundant computations. We could use `Let` to first initialize a temp variable with the defining expression and then substitute the accesses with this variable - that would get rid of the redundant computations.

## To Reproduce
Consider the following example:
```python
import torch

class kernel_arena_scope(object):
    def __enter__(self):
        self.scope = torch._C._te.KernelScope()

    def __exit__(self, typ, val, traceback):
        self.scope = None

with kernel_arena_scope():
    dtype = torch._C._te.Dtype.Float
    K = 100
    KK = torch._C._te.ExprHandle.int(K)

    A = torch._C._te.Placeholder('A', dtype, [KK])
    B = torch._C._te.Compute('B', [torch._C._te.DimArg(KK, 'i')], lambda k: k*k+k)
    C = torch._C._te.Compute('C', [torch._C._te.DimArg(KK, 'j')],
            lambda k: B.load([k])*B.load([k]) - B.load([k]))

    loopnest = torch._C._te.LoopNest([C])
    print('Before inline:', loopnest.root_stmt())
    loopnest.compute_inline(loopnest.get_loop_body_for(B))
    print('After inline:', loopnest.root_stmt())
```

We have two computations here: `B[k] = k*k + k` and `C[i] = B[i]*B[i] - B[i]`. After inlining `B` to `C`, it currently becomes
`C[i] = (i*i+i)*(i*i+i) - (i*i+i)`. What we'd like to get instead is `Let t=i*i+i; C[i] = t*t - t`.

### Current Behavior
The script outputs
```
Before inline: {
  for (int i = 0; i < 100; i++) {
    B[i] = i * i + i;
  }
  for (int j = 0; j < 100; j++) {
    C[j] = (B(j)) * (B(j)) - (B(j));
  }
}
After inline: {
  for (int j = 0; j < 100; j++) {
    C[j] = (j * j + j) * (j * j + j) - (j * j + j);
  }
}
```

### Expected Behavior
The script outputs
```
Before inline: {
  for (int i = 0; i < 100; i++) {
    B[i] = i * i + i;
  }
  for (int j = 0; j < 100; j++) {
    C[j] = (B(j)) * (B(j)) - (B(j));
  }
}
After inline: {
  for (int j = 0; j < 100; j++) {
    Let t = j * j + j;
    C[j] = t * t - t;
  }
}
```
Repository: flutter
Issue: Access to Shift-toggle Keys using LogicalKeyboardKey
Labels: a: text input,c: new feature,engine,c: proposal,P3,team-engine,triaged-engine

## Use case

The [`LogicalKeyboardKey` docs](https://api.flutter.dev/flutter/services/LogicalKeyboardKey-class.html) state the following:

>A class with static values that describe the keys that [...] represent logical keys, which are keys which are interpreted in the context of any modifiers, modes, or keyboard layouts which may be in effect.

This works for most keys, however, there is this whole class of **logical** keys that is not covered:

![image](https://user-images.githubusercontent.com/19204050/108902927-9cfa3980-7614-11eb-93c2-20d1f90c3251.png)

The symbols at the top of these buttons (`!`, `@`, `#`, `$`, `%`, etc.) are all **not covered** by `LogicalKeyboardKey`.  

If I use e.g. a [`LogicalKeySet`](https://api.flutter.dev/flutter/widgets/LogicalKeySet-class.html) as in:

```
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.digit8)
```

In order to achieve the `*` symbol (multiplication/asterisk), this might work for an English keyboard layout, however, it will not work for other keyboard layouts where the `*` symbol lives somewhere completely else.

## Proposal

In our use case (a math keyboard), we need to be able to respond to **logical** `*`, `/`, etc. keys.  
This seems to not be currently possible using `LogicalKeyboardKey`, although it logically should be.

In the end, it does not matter **how** this is implemented into the framework, but there should be away to respond to these logical keys.