sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: `torch.autograd.Function` subclasses *sometimes* throw away custom subclasses
Labels: module: autograd,triaged,actionable

## 🐛 Bug

`apply`ing a torch.autograd.Function usually returns the same `torch.Tensor` subclass as the input, but not always. This seems to happen when an input `requires_grad` and potentially some other requirements.

## To Reproduce

Steps to reproduce the behavior:

```python
import torch
import torch.autograd

class IdFunction(torch.autograd.Function):
  @staticmethod
  def forward(ctx, arg):
    return arg

  @staticmethod
  def backward(ctx, arg):
    return arg

class MyTensor(torch.Tensor):
  pass

x = torch.ones([1, 5, 5]).as_subclass(MyTensor)
x.requires_grad_()
applied = IdFunction.apply(x)
assert type(applied) is MyTensor, f"Expected MyTensor, got {type(applied)}"
```

If you remove the `x.requires_grad_()` call, the assertion passes.

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

I expect `torch.autograd.Function` to preserve the subclass passed in.
Barring that, I expect it to behave consistently about whether it preserves it or throws it away.

The documentation claims

> As of version 1.7.0, methods on torch.Tensor and functions in public torch.* namespaces applied on torch.Tensor subclasses will return subclass instances instead of torch.Tensor instances:

It's a bit unclear to me if that's meant to encompass custom `torch.autograd.Function` implementations that are built on such primitives.

## Environment

PyTorch version: 1.8.1+cu102
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.2 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: `13.0.0-++20210418052640+d480f968ad8b-1~exp1~20210418153358.383`
CMake version: version 3.16.3

Python version: 3.8 (64-bit runtime)
Is CUDA available: True
CUDA runtime version: 10.1.243
GPU models and configuration: GPU 0: GeForce RTX 2080 SUPER
Nvidia driver version: 450.119.03
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.18.5
[pip3] torch==1.8.1
[pip3] torchvision==0.9.1
[conda] Could not collect


cc @ezyang @albanD @zou3519 @gqchen @pearu @nikitaved @soulitzer @Lezcano
Repository: TypeScript
Issue: Infer type isn't contextual typed by type bounds
Labels: Bug

# Bug Report
Infer type isn't contextual typed by type bounds
```ts
type Foo<T> = T extends string ? Record<T, number> : never;

type Foo2<T extends {a:string}>= T extends {a: infer A} ?  Record<A, number>:never; //error here, A should extends string already, but seems not
```
<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms

generic infer bounds

### 🕗 Version & Regression Information
4.2.3

### ⏯ Playground Link

https://www.typescriptlang.org/play?#code/C4TwDgpgBAYg9nAPAFQHxQLxWVCAPYCAOwBMBnKM4AJwEsiBzKAfigCUIBjOaklAGihEArgFsARhGroAXEIgA3KQG4AUKtCRYCAEwpcBYuSgBvAIYyqdRgF9UWHPkKkK5ufQBmUqAEEbLKHYuHj4fQREJKVQZIkUVIA
### 💻 Code

<!-- Please post the relevant code sample here as well-->
```ts
type Foo<T> = T extends string ? Record<T, number> : never;

type Foo2<T extends {a:string}>= T extends {a: infer A} ?  Record<A, number>:never; //error here, A should extends string already, but seems not

```

### 🙁 Actual behavior

throw error

### 🙂 Expected behavior

not throw error
Repository: flutter
Issue: documentation: Upgrading pre 1.12 Android projects: step 1b is missing Kotlin sample code
Labels: platform-android,d: wiki,P3,team-android,triaged-android

#50004 seems to have the right sample code. It'd be nice to include it so that readers don't have to try porting the sample Java code to Kotlin themselves.
Repository: rust
Issue: Error message contains `$crate` instead of crate name
Labels: A-diagnostics,A-macros,T-compiler,C-bug

Since https://github.com/rust-lang/rust/pull/82069 was merged, the 'this error originates in macro `<name>`) messages sometimes contain `$crate`, instead of the actual crate name.

For example:

https://github.com/rust-lang/rust/blob/9daf546b77dbeab7754a80d7336cd8d00c6746e4/src/test/ui/bound-suggestions.stderr#L8

We should resolve these `$crate` identifiers to the actual crate name before displaying them to the user.

cc @cjgillot
Repository: flutter
Issue: TextRange.isValid can't work
Labels: a: text input,framework,a: internationalization,has reproducible steps,P2,found in release: 2.3,team-framework,triaged-framework

```
 $ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.4, on Mac OS X 10.15.5 19F101 darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Community Edition (version 2020.3)
[✓] VS Code (version 1.56.1)
[✓] Connected device (3 available)

• No issues found!

```
Hello, I'm using flutter web to develop a application. There is a problem that bothers for a long time.
I customized a TextInputFormatter to control the text.but when I input chinese character, the TextEditingValue.composing.isValid always return false(TextRange.start and TextRange.end always -1).
Looking forward to an answer, Thanks
Repository: pytorch
Issue: Torch.nn.DataParallel training model, the output of the model becomes list type, the number of lists is batch size
Labels: triaged,module: data parallel

Using Torch.nn.DataParallel to train model, the output of the model becomes list type, the number of lists is batch size.
The first epoch training output is normal,the output types are as follows：
model= torch.nn.DataParallel(model,device_ids=[0,1]).to('cuda')
out = model(data) # out size: [batch, c,h,w]

But for the second epoch, the output type is as follows：
model= torch.nn.DataParallel(model,device_ids=[0,1]).to('cuda')
out = model(data) # out :[(c,h,w),(c,h,w),(c,h,w)........], total batch size, type:list



cc @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @osalpekar @jiayisuse @agolynski @SciPioneer @H-Huang @mrzzd @cbalioglu @gcramer23
Repository: flutter
Issue: `RenderEditable.computeMinIntrinsicWidth` needs to account for `_caretMargin`, and add tests to verify the return value of `computeMaxIntrinsicWidth` is large enough to accommodate the text in a single line. 
Labels: a: text input,framework,P2,team-framework,triaged-framework

Extracted from https://github.com/flutter/flutter/pull/82286 and https://github.com/flutter/flutter/issues/82277.

https://github.com/flutter/flutter/blob/298f18b5924563b21470e597778c1c56bdfefa9d/packages/flutter/lib/src/rendering/editable.dart#L3188-L3198
Repository: next.js
Issue: next build command fails with AMP
Labels: Internationalization (i18n),Pages Router

### What version of Next.js are you using?

10.2.0

### What version of Node.js are you using?

15.5.1

### What browser are you using?

Chrome, Safari, Mozilla

### What operating system are you using?

macOS

### How are you deploying your application?

next start

### Describe the Bug

`$ next build` throws an error when add `config = { amp: "hybrid" }` variable to page but no error when `config = {amp: true}`:

```sh
> Build error occurred
[Error: ENOENT: no such file or directory, rename '/Users/.../.next/export/tr/index.amp.html' -> '/Users/.../.next/server/pages/tr/index.amp.html'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'rename',
  path: '/Users/.../.next/export/tr/index.amp.html',
  dest: '/Users/.../.next/server/pages/tr/index.amp.html'
}
```

My Index.js:

```js
import React from "react";
import { useAmp } from "next/amp";

import CustomHead from "../modules/customHead";

import Header from "../components/Header";

import styles from "../styles/Homepage.module.scss";

export const config = { amp: "hybrid" };

export default function Home() {
  const isAmp = useAmp();

  return (
    <React.Fragment>
      <CustomHead />

      <Header />
      {isAmp ? <div>AMP</div> : <div>NO AMP</div>}
    </React.Fragment>
  );
}
```

### Expected Behavior

`next build` should work when add `hybrid amp` config.

### To Reproduce

I can make a sandbox if necessary.
Repository: create-react-app
Issue: the project of created can't run
Labels: needs triage

I use the command create a project
```
npx create-react-app demo
```
there is a error that can't found @babel/core@13.72 when I eject the project,but It can run.

and the webpage no content,the console error:
![image](https://user-images.githubusercontent.com/16410281/118094519-6ce75900-b401-11eb-8a8e-0ad1183d32db.png)
Repository: ant-design
Issue: Calendar 能否增加鼠标滚动 一行一行往上去的功能，类似WIN10的日历?
Labels: 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.

### What problem does this feature solve?
用户提出来的，觉得操作方便；
另外能否不要默认选择一个日期？因为目前切换月份时不希望有默认的值，而是由用户自己选择。

### What does the proposed API look like?
鼠标滚动控件内部支持即可；默认选择一个日期可以作为开关。我现在在Calendar上监听onWheel事件，可以一个月一个月滚动（通过value改变达到控制Calendar切换）觉得不太好（不能一行一行往上或往下滚外；没有接口方法调用，而是通过改变value)


<!-- generated by ant-design-issue-helper. DO NOT REMOVE -->
Repository: rust
Issue: [ER] Help for unresolved super::X imports too.
Labels: A-diagnostics,T-compiler,A-suggestion-diagnostics,D-papercut

This code:

```rust
mod foo {
    use super::NonZeroU8;

    pub(crate) fn bar() -> NonZeroU8 {
        NonZeroU8::new(1).unwrap()
    }
}

use foo::bar;

fn main() {
    let y = NonZeroU8::new(2).unwrap();
}
```

Trying to compile it with rustc (1.54.0-nightly 5c0292654 2021-05-11), it gives:

```rust
error[E0432]: unresolved import `super::NonZeroU8`
 --> ...\test.rs:2:9
  |
2 |     use super::NonZeroU8;
  |         ^^^^^^^^^^^^^^^^ no `NonZeroU8` in the root

error[E0433]: failed to resolve: use of undeclared type `NonZeroU8`
  --> ...\test.rs:12:13
   |
12 |     let y = NonZeroU8::new(2).unwrap();
   |             ^^^^^^^^^ not found in this scope
   |
help: consider importing one of these items
   |
9  | use core::num::NonZeroU8;
   |
9  | use std::num::NonZeroU8;
   |
```

I'd like to see the 'use std::num::NonZeroU8;' help for the first unresolved import in the module too.
Repository: flutter
Issue: Unable to use debugger when running apps on macOS (target) if project is in /tmp folder
Labels: platform-mac,a: debugging,a: desktop,has reproducible steps,P2,found in release: 2.10,found in release: 2.13,team-macos,triaged-macos

Usually when I'm cloning users repos to reproduce issues I clone them to `/tmp` on my MacBook. While trying to debug an issue today I noticed when running on macOS from that folder, debugging did not work correctly (I don't know if it's isolated to `/tmp` because I'm not sure what specifically is causing it).

Steps:

- `cd /tmp`
- `flutter create flutter_testing1`
- `code flutter_testing1`
- Add `debugger();` as the first thing inside `_incrementCounter` (before the `setState` call)
- Run on macOS
- Click the increment button

The app seems to pause, but VS Code never shows that it is paused. Capturing the VM service traffic shows nothing at all (no pause events).

Running the exact same steps on any other folder, everything works fine.
Repository: pytorch
Issue: "_amp_foreach_non_finite_check_and_unscale_cuda" not implemented for 'ComplexFloat'
Labels: module: cuda,triaged,module: complex,needs design,module: amp (automated mixed precision)

## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

## To Reproduce

Steps to reproduce the behavior:

1. input_complex = torch.view_as_complex(input_complex)
2. scaler = torch.cuda.amp.GradScaler()

RuntimeError: "_amp_foreach_non_finite_check_and_unscale_cuda" not implemented for 'ComplexFloat'

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

## Environment

 - PyTorch Version: 1.8.1
 - OS: WSL2 on Windows 10
 - How you installed PyTorch: pip
 - Python version: 1.8.1
 - CUDA/cuDNN version: 10.2
 - GPU models and configuration: RTX 2080Ti
 - Any other relevant information:

## Additional context

<!-- Add any other context about the problem here. -->


cc @mcarilli @ptrblck @ezyang @anjali411 @dylanbespalko @mruberry @Lezcano @ngimel
Repository: rust
Issue: if and match produce different assembly
Labels: C-enhancement

https://rust.godbolt.org/z/zKEfaPKdn

inspired from https://stackoverflow.com/questions/67412863/match-compiles-into-suboptimal-asm-compared-to-if-else
Repository: vscode
Issue: Allow specifying an icon for config enums
Labels: help wanted,feature-request

I implemented intellisense for terminal profile icons https://github.com/microsoft/vscode/issues/122473, but currently the preview is in the description, it would be much easier to use if it was to the left of the string.

<img width="835" alt="Screen Shot 2021-05-13 at 7 41 36 AM" src="https://user-images.githubusercontent.com/2193314/118141835-a77bd200-b3be-11eb-9a51-56ec4ae2b1e2.png">

Compare that to how nice the change icon command is:

<img width="487" alt="Screen Shot 2021-05-13 at 7 41 58 AM" src="https://user-images.githubusercontent.com/2193314/118141882-b3679400-b3be-11eb-8d70-86568b17f012.png">
Repository: storybook
Issue: SB not load Angular material styles when the project is library 
Labels: bug,angular,needs triage

**Describe the bug**
When the defaultProject is a Angular Library, the styles from angular material, not working

**To Reproduce**
I create an application with this command: ng new design-system --create-application=false --prefix=css --style=scss --minimal
I create a library. I want to develop my components within: ng generate library components --prefix=cs
I add angular material to the library: ng add @angular/material
I add my slider component to my library
I add storybook to the workspace: npx -p @storybook/cli sb init --type angular
Code the story and run it: npm run storybook

![Picture1](https://user-images.githubusercontent.com/22777201/118143633-dbc9af80-b40b-11eb-9bfc-17414db31d1c.png)

Not Working...
I create an application type project: ng generate application demo --minimal
Add angular material to demo project
I use the slider component

![Picture2](https://user-images.githubusercontent.com/22777201/118143649-e126fa00-b40b-11eb-9451-5332a25b5455.png)

it works!
The surprise,... if I change the defaultProject from design-system (library) to demo (application),... works!

The example repository: https://github.com/krbaio3/bug-sb-ko.git

I understand it is a bug, because, if I want to have only one library with Storybook, I have to add an application project and change the default project to run SB?

Thx!
Repository: pytorch
Issue: torchdeploy doesn't prevent Obj from being used on wrong interpreter
Labels: triaged,module: deploy

Repro:

```
  size_t nthreads = 2;
  torch::deploy::InterpreterManager m(nthreads);
  // generate a tensor from one interpreter
  auto I0 = m.all_instances()[0].acquire_session();
  auto I1 = m.all_instances()[1].acquire_session();
  auto t = I0.global("torch", "empty")({I0.from_ivalue(2)});
  // try to feed it to the other interpreter
  I1.global("torch", "sigmoid")({t});
```

This obliquely fails with an `at()` error when attempting to unwrap.

cc @wconstab
Repository: flutter
Issue: Track analytics for BottomNavigationBar (with minimum code for analytic frameworks)
Labels: framework,f: material design,c: proposal,P3,team-design,triaged-design



## Use case

Hi,
So currently we manage the page tracking by following this approach [Firebase screen tracking](https://github.com/FirebaseExtended/flutterfire/blob/adfec52ae5679d426789ce6544201d37e8ecba93/packages/firebase_analytics/firebase_analytics/lib/observer.dart)
Well that's is convenient and almost zero effort form the app developer side (assuming we provide our own wrapper/SDK).
In many cases apps have BottomNavigationBar, how would you suggest to handle onTap: index change analytics? or any other work around for the tab bars, similar to the _observer_ approach (such that minimum code is required from the app developer )
Thanks in advance

## Proposal

Would like to have similar approach to  the observer
Repository: TypeScript
Issue: Expression produces a union type that is too complex to represent
Labels: Needs Investigation

# Bug Report

### 🔎 Search Terms

union type that is too complex to represent

### 🕗 Version & Regression Information

TS version: 4.2.3
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about union types too complex to represent

### ⏯ Playground Link

[Playground link with relevant code](https://www.typescriptlang.org/play?#code/C4TwDgpgBA6glsAFgZWAJzgOwOYAU0D2kaoAPANJQQAewEmAJgM5RPpbYB8UAvFAN4BYAFABIANq4oWKOQC6ALlbscAbhEBfdcJEAzAK6YAxsDgFMVWmgCGJ-EQgkQFS3UYs2GHJwAUAdxswYiUAEQgIMAAlCGsGcwAbZ3gkVC88QmIyck5OABooAGsIECVyAEoBEVE0CGB9NAsA6yDHcSKQOW0NEREaMAISKAYII3jrGqhQSCgwiOjYhOcAFW4+Jdd6ZigAIX04eNNMESgoAH4oJeOoJXWaNy3+buET86Fnk4+ahcxEqHFKGTtAi6C6KGbhKIxOI-Zb-OScbQfKBPE5KebQxKkFbaXrUfqDYajcbQKbQXb7Q68KD4OAAWwQcAAbtAAD5QABihhMZgsbJC1joUDZAFE0IQ0EKoNFsMK8do+gNgEMRmMJqTqRh6aZmVTPBxJZh9LSAEaOSXGggEeIxXlQY1wbBYJVspggE1WyWGYa6LAQBgG-TxeKqIA)

### 💻 Code
I have a function that should be able to take an object along with a key name that will be present within that object with a specific type, which in this example I hardcode to `string` to simplify the problem:

```ts
type WithStringProperty<K extends string> = {
	[P in K]: string;
};

function extractProperty<K extends string>(wrapper: WithStringProperty<K>, key: K) {
	return wrapper[key];
}
```

This much *works*. But when I make my `wrapper` parameter a little more complex by wrapping it in DeepReadonly, it fails with the error from the title:

```ts
function extractProperty<K extends string>(wrapper: DeepReadonly<WithStringProperty<K>>, key: K) {
	return wrapper[key];
}
```

DeepReadonly is from ts-essentials:

```ts
export declare type DeepReadonly<T> = T extends Builtin
  ? T
  : T extends {}
  ? {
      readonly [K in keyof T]: DeepReadonly<T[K]>;
    }
  : Readonly<T>;

export declare type Builtin = Primitive | Function | Date | Error | RegExp;
export declare type Primitive = string | number | boolean | bigint | symbol | undefined | null;
```

It doesn't seem like the combination should introduce some large combination of possible union types, but I guess I'm wrong?

### 🙁 Actual behavior

Error: Expression produces a union type that is too complex to represent

### 🙂 Expected behavior

No error
Repository: go
Issue: cmd/go: improve pattern matching in script_test stdout, stderr and grep commands
Labels: NeedsDecision,GoCommand

<!--
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

</pre>

### Does this issue reproduce with the latest release?



### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env

</pre></details>

### Proposal

I noted that the script tests in `cmd/go/testdata/script` often are not very readable.

These are the changes I want to propose and implement:

  1. It is not simple to specify the `os.PathSeparator` in a pattern for the `stdout`, `stderr` and `grep` command, and `[/\\`] should be used.  For multiple or long paths this reduce readability.
      As an example from `mod_replace.txt`:
      ```
      stdout '^rsc.io/quote/v3 v3.0.0 '$GOPATH'[/\\]pkg[/\\]mod[/\\]not-rsc.io[/\\]quote@v0.1.0-nomod '$GOPATH'[/\\]pkg[/\\]mod[/\\]cache[/\\]download[/\\]not-rsc.io[/\\]quote[/\\]@v[/\\]v0.1.0-nomod.mod => not-rsc.io/quote v0.1.0-nomod '$GOPATH'[/\\]pkg[/\\]mod[/\\]not-rsc.io[/\\]quote@v0.1.0-nomod '$GOPATH'[/\\]pkg[/\\]mod[/\\]cache[/\\]download[/\\]not-rsc.io[/\\]quote[/\\]@v[/\\]v0.1.0-nomod.mod$'
     ```
     In https://go-review.googlesource.com/c/go/+/319409 I proposed to use the `·` (middle dot) character, that is replaced to `os.PathSeparator` when the new `-path` flag is specified for the `stdout`, `stderr` or `grep` commands.

     A better solution is to use the `${/}` environment variable expansion, to parallel `${:}` for `os.PathListSeparator`.
     No one will probably use the middle dot character.

  2.  In a script test, only single quoted string are supported, and environment variables expansion is not allowed.

      I propose to add support for double quoted string, so that, as an example:
      ```
      '^no Go files in '${WORK}${/}'gopath'$/'src'$/'dir'$/'subdir$'
      ```
      can be replaced with the more readable:
      ```
      "^no Go files in ${WORK}${/}gopath${/}src${/}dir${/}subdir$"
      ```
  3. Many tests don't escape the `.` character when used in *semver* and *file path*.

      I propose to add support for a raw string, where the string content is quoted using `regexp.QuoteMeta`.
      Note that raw newline and tab characters are not allowed.

      This change has low priority, since it is probably ok to not escape the `.` character.
Repository: excalidraw
Issue: Freedraw lines endings turn sharply despite minimal deltas
Labels: freedraw

(I recall we've talked about this or something similar on chat.)

Often when I draw relatively straight lines the endings end in a sharp turn or a pointy end. I might move the cursor slightly on pointerup.

![image](https://user-images.githubusercontent.com/5153846/118160160-3d931500-b41e-11eb-8791-1c93d70fa5cd.png)

This one's ending turns a lot despite the last two points having same coords:

![image](https://user-images.githubusercontent.com/5153846/118160011-07559580-b41e-11eb-8570-0a784a23524c.png)

```
"points": [
  [0, 0],
  [1, 5],
  [4, 10],
  [8, 18],
  [11, 25],
  [15, 31],
  [18, 33],
  [20, 33],
  [21, 33],
  [21, 31],
  [21, 31]
],
```

Or consider these lines:

![image](https://user-images.githubusercontent.com/5153846/118159680-9d3cf080-b41d-11eb-948e-5345a71d4b73.png)

Both look very different, and the B's ending turns a lot despite the points of B differing in just the last `[14, 27]`, where `x` coord is just `1` less from prev point:

```
// A
[0, 0],
[1, 2],
[4, 6],
[11, 17],
[15, 22],
[16, 26],
[16, 27],
[15, 27]
```

```
[0, 0],
[1, 2],
[4, 6],
[11, 17],
[15, 22],
[16, 26],
[16, 27],
[15, 27],
[14, 27]
```

source: https://excalidraw.com/#json=6705652302872576,SamJrFGInpDkDXe6dtAZ9w

/cc @steveruizok
Repository: next.js
Issue: Slow page reload running in development
Labels: good first issue,bug

### What version of Next.js are you using?

10.2.0

### What version of Node.js are you using?

14.15.4

### What browser are you using?

Chrome

### What operating system are you using?

macOS

### How are you deploying your application?

n/a

### Describe the Bug

When running `npm run dev` if you reload the page (refresh) a few times, after about the 5th refresh the load time gets very slow and almost unusable.

### Expected Behavior

Refresh should be less than a few seconds.

### To Reproduce

`npx create-next-app app`
`cd app`
`npm run dev`

Refresh the page 5-10 times.