sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: Calling backward with create_graph on the output of a DistributedDataParallel throws error
Labels: oncall: distributed,triaged,module: ddp

## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

Calling [`backward`](https://pytorch.org/docs/stable/generated/torch.Tensor.backward.html) with `create_graph=True` on the output of a [`DistributedDataParallel`](https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html) throws a `RuntimeError`.

## To Reproduce

```python3
import torch
from torch import nn
from torch.distributed import init_process_group
from torch.nn.parallel import DistributedDataParallel as DDP

class Model(nn.Module):
    def __init__(self):
        super().__init__()
        self.p = nn.Parameter(torch.tensor(1.))
    def forward(self):
        return self.p.pow(2)

model = Model()
init_process_group(
    'gloo',
    'tcp://localhost:12355',
    rank=0,
    world_size=1,
)
ddp_model = DDP(model)
ddp_model().backward(create_graph=True)
```

```
Traceback (most recent call last):
  File "test.py", line 21, in <module>
    ddp_model().backward(create_graph=True)
  File "/usr/local/lib/python3.8/site-packages/torch/_tensor.py", line 255, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
  File "/usr/local/lib/python3.8/site-packages/torch/autograd/__init__.py", line 147, in backward
    Variable._execution_engine.run_backward(
RuntimeError: mul(): functions with out=... arguments don't support automatic differentiation, but one of the arguments requires grad.
```

<!-- 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. -->

No error.

## Environment

```
Collecting environment information...
PyTorch version: 1.9.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 11.5.2 (x86_64)
GCC version: Could not collect
Clang version: 12.0.5 (clang-1205.0.22.9)
CMake version: version 3.20.1
Libc version: N/A

Python version: 3.8.8 (default, Feb 27 2021, 02:19:17)  [Clang 12.0.0 (clang-1200.0.32.29)] (64-bit runtime)
Python platform: macOS-11.5.2-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] mypy==0.812
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.19.5
[pip3] pytorch-lightning==1.2.10
[pip3] torch==1.9.0
[pip3] torchaudio==0.9.0.dev20210313
[pip3] torchmetrics==0.2.0
[pip3] torchvision==0.10.0
[conda] Could not collect
```

<!-- ## Additional context -->

<!-- Add any other context about the problem here. -->


cc @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @osalpekar @jiayisuse @agolynski @SciPioneer @H-Huang @mrzzd @cbalioglu @gcramer23
Repository: vscode
Issue: Links/Samples where language auto-detection doesn't work
Labels: bug,languages-guessing

This issue is just to enumerate samples and things where auto-detect didn't work and why. There's likely not much that can be done beyond totally retraining the ML model... but at least we can have them in one place.

https://www.programiz.com/python-programming/examples/add-number
Repository: pytorch
Issue: [FX] Documentation for Graph.flatten_inps and Graph.unflatten_outs
Labels: triaged,module: fx

These functions don't have documentation:

https://github.com/pytorch/pytorch/blob/55f8f95ad4b36d201b63bd4b53984d378cf3d672/torch/fx/graph.py#L413

https://github.com/pytorch/pytorch/blob/55f8f95ad4b36d201b63bd4b53984d378cf3d672/torch/fx/graph.py#L417

cc @ezyang @SherlockNoMad
Repository: flutter
Issue: TextPainter draws out of position with very small fontSize
Labels: framework,engine,a: typography,has reproducible steps,P2,found in release: 2.2,found in release: 2.5,team-engine,triaged-engine

Summary: When using a TextPainter to draw font that is very small (0.53 fontSize) on a highly scaled canvas (20x), the font will be positioned above the expected draw region.

Flutter 2.2.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f4abaa0735 (8 weeks ago) • 2021-07-01 12:46:11 -0700
Engine • revision 241c87ad80
Tools • Dart 2.13.4
Tested On Android 8.0 Moto G5 Plus

Reproduction Example:

```
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key}) : super(key: key);
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CustomPaint(
        painter: TextPaintTester(),
        child: Container(),
      ),
    );
  }
}

class TextPaintTester extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    canvas.scale(20);

    var offset1 = Offset(4, 4);
    _paintText(canvas, offset1, 2.0); // positioned as expected

    var offset2 = Offset(4, 8);
    _paintText(canvas, offset2, 0.54); // positioned as expected

    var offset3 = Offset(4, 12);
    _paintText(canvas, offset3, 0.53); // unexpectedly position above expected region
  }

  static void _paintText(Canvas canvas, Offset offset, double fontSize) {
    canvas.drawCircle(offset, 0.1, Paint()..color = Colors.black);
    var span = new TextSpan(
      style: new TextStyle(
        color: Colors.black87,
        fontSize: fontSize,
      ),
      text: "Test Text",
    );
    TextPainter tp = new TextPainter(
      text: span,
      textDirection: TextDirection.ltr,
    );
    tp.layout();
    var rect = Rect.fromLTWH(offset.dx , offset.dy , tp.width , tp.height);
    canvas.drawRect(rect, Paint()..color = Colors.red.withOpacity(0.3));
    tp.paint(canvas, offset);
  }

  @override
  bool shouldRepaint(TextPaintTester oldDelegate) => true;
}

```
Repository: rust
Issue: `__rust_probestack` in binary despite no callers, LTO, and disabling stack-probes.
Labels: T-compiler,C-bug,A-stack-probe

<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicating the bug.
-->

I'm finding that `__rust_probestack` appears in static libraries created by rust for a custom x86_64 target, even when the target specifies `  "stack-probes": { "kind": "none" }`, LTO is enabled, and there are no callers of `__rust_probestack`

I tried to build the following code:

```rust
#![no_std]

use core::panic::PanicInfo;

pub fn foo() {}

#[panic_handler]
fn panic(_panic: &PanicInfo<'_>) -> ! {
    loop {}
}
```

With the following set in `Cargo.toml`:

```toml
[lib]
crate_type = ["staticlib"]

[profile.release]
lto = true
```

And the following `cargo` invocation:
```shell
cargo +nightly build --release -Zbuild-std=core,alloc --target target.json
```

`target.json` is attached.


I expected to see no instance of `__rust_probestack` in the generated output.

Instead I see:

```
objdump -d target/target/release/liblto_issue.a|head
In archive target/target/release/liblto_issue.a:

lto_issue-7670395b8b30746c.lto_issue.e6cad5ce-cgu.0.rcgu.o:     file format elf64-x86-64


Disassembly of section .text.__rust_probestack:

0000000000000000 <__rust_probestack>:
   0:	55                   	push   %rbp
   1:	48 89 e5             	mov    %rsp,%rbp
```

### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc +nightly --version --verbose`:
```
rustc 1.56.0-nightly (af140757b 2021-08-22)
binary: rustc
commit-hash: af140757b4cb1a60d107c690720311ba8e06e7de
commit-date: 2021-08-22
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 13.0.0
```
[target.json.txt](https://github.com/rust-lang/rust/files/7035641/target.json.txt)
Repository: flutter
Issue: How to debug integration tests
Labels: a: tests,c: new feature,framework,t: flutter driver,c: proposal,f: integration_test,P3,team-framework,triaged-framework

## Use case

I'm developing an integration test for a mobile app.  When the test fails, the test log says "Failed to stop app" and the app shows a black screen.  I need some way to examine the state of the app and find out why it failed.

I am not asking to run the test in a debugger.  I just want to fix my broken test.  The Flutter tooling makes this very difficult.

Adding a `dart:io:sleep()` or `await Future.delayed()` leaves the app's UI frozen and not scrollable.

So far the best I can do is add print statements and take a video of the app in Apple Simulator and step through it frame-by-frame.  This is a slow and frustrating way to fix tests.

## Proposal

Provide some way to examine the state of the app when an integration test fails.

Ideas:
- Support `flutter_driver` and make it usable.  One can comment out the call to `FlutterDriver.close()` and the app will remain live and usable after the test stops.
- Leave the app open and usable, not frozen.  Do not show a black screen.
- Explain how to run a test in the Android Studio debugger.  Let me set a breakpoint before the failing step.  Then I can examine the app's widget tree, the app's data, and the test's data.
- Automatically take a screenshot on test failure.  I'm not sure how to make this work since integration_test module runs on the target device and has no access to the test runner's filesystem to save the file.
- Make a video of the entire test.  Delete the video on success.  Leave it on failure.  This could end up using a lot of disk space.
Repository: flutter
Issue: Paint Control for Text Decoration
Labels: a: text input,c: new feature,framework,a: typography,c: proposal,P3,team-framework,triaged-framework

## Use case

In our custom design, we want to have a thick underline, something along these lines:

```dart
TextStyle(
  decoration: TextDecoration.underline,
  decorationStyle: TextDecorationStyle.solid,
  decorationColor: underlineColor,
  decorationThickness: 12.0,
),
```

This, however, looks silly when the underline is drawn in the foreground:

| Wanted behavior | Current behavior |
| :---------------------: | :--------------------: |
| ![image](https://user-images.githubusercontent.com/19204050/130544804-9324c764-deac-46de-b99e-66a4b09a3018.png) | ![image](https://user-images.githubusercontent.com/19204050/130544839-2ea091f7-efe4-4701-90e8-25ce49dadb4d.png) |


## Proposal

Looking at the [`TextStyle` class](https://api.flutter.dev/flutter/dart-ui/TextStyle-class.html), there currently already is the possibility to customize the `background` and `foreground` using [`Paint` objects](https://api.flutter.dev/flutter/dart-ui/Paint-class.html).

My proposal would be adding a `decorationPaint` parameter to the `TextStye` constructor that allows to do the following:

```dart
TextStyle(
  decorationPaint: Paint()..blendMode = BlendMode.dstOver,
  decoration: TextDecoration.underline,
  decorationStyle: TextDecorationStyle.solid,
  decorationColor: underlineColor,
  decorationThickness: 12.0,
),
```

This way, we could use [`BlendMode.dstOver`](https://api.flutter.dev/flutter/dart-ui/BlendMode-class.html#dstOver) as the blend mode to achieve the *desired result*.

### Workaround

There is a workaround, which is painting **two** `Text` widgets in a `Stack`, i.e. one with the decoration in the background and one with the text itself in the foreground. This, however, is less than ideal:

<details><summary>Click to expand workaround sample code</summary>

```dart
Stack(
  children: [
    ExcludeSemantics(
      child: Text.rich(
        text,
        style: style.copyWith(
          decoration: TextDecoration.underline,
          decorationStyle: TextDecorationStyle.solid,
          decorationColor: underlineColor,
          decorationThickness: 12.0,
        ),
        textAlign: TextAlign.center,
      ),
    ),
    Text.rich(
      text,
      style: style,
      textAlign: TextAlign.center,
    ),
  ],
)
```

</details>
Repository: flutter
Issue: WidgetTester.tap() to stop ignoring failure
Labels: a: tests,c: new feature,framework,c: proposal,f: integration_test,P3,team-framework,triaged-framework

## Use case

Most mobile apps use tapping as the primary interaction method.  App tests must use `WidgetTester.tap()` which is inherited from [`WidgetController.tap()`](https://api.flutter.dev/flutter/flutter_test/WidgetController/tap.html).  When `tap()` fails to find the target widget, it ignores this and continues.  Failing to tap puts the app into an unintended state.

In the best case the test detects this problem and fails later.  Then the engineer must waste time back-tracking to find out why the test failed.

In the worst case, the test silently does not test the behavior it is designed to test.  Then bugs end up in production and users suffer and the business loses money.

When `tap()` fails to tap, it prints out a warning.  Such warnings are easily missed in long test logs.  This is especially true when logs include print-debugging (#88756). `tap()` takes an optional kwarg to suppress the warning.

## Proposal

1. Rename `tap()` to `tryTap()` and make it return `true` when it successfully tapped.
2. Add a new `tap()` function that instantly fails the test if it cannot perform its intended purpose.
Repository: flutter
Issue: Support Image in finders
Labels: a: tests,c: new feature,framework,a: images,c: proposal,P3,team-framework,triaged-framework

Let's make this test pass:

    await tester.pumpWidget(MaterialApp(
      home: Scaffold(body: Image.asset('asset_image')),
    ));
    expect(find.image(const AssetImage('asset_image')), findsOneWidget);
Repository: flutter
Issue: [Docs]Tests to scroll a ListView and tap on a child
Labels: a: tests,framework,d: api docs,f: integration_test,P2,team-framework,triaged-framework

## Use case

I am developing a mobile app that uses a [`ListView`](https://api.flutter.dev/flutter/widgets/ListView-class.html) with a static list of child widgets.  I'm writing a test that must scroll the view and tap on a child widget.

One can use `WidgetTester.scrollUntilVisible()` (inherited from [`WidgetController.scrollUntilVisible`](https://api.flutter.dev/flutter/flutter_test/WidgetController/scrollUntilVisible.html)) to scroll a parent widget repeatedly until a particular child is visible.  The widget is now in view and being built, so one can call `WidgetTester.ensureVisible()` (inherited from [`WidgetController.ensureVisible`](https://api.flutter.dev/flutter/flutter_test/WidgetController/ensureVisible.html)) and scroll it completely into the viewport.

Unfortunately, both of those functions rely on the parent widget being  [`Scrollable`](https://api.flutter.dev/flutter/widgets/Scrollable-class.html).  Sadly, contrary to its documentation, `ListView` does NOT extend `Scrollable`.  Even more sadly, `Scrollable` is not an interface that we could implement on a custom widget.

We can use `WidgetTester.dragUntilVisible()` (inherited from [`WidgetController.dragUntilVisible`](https://api.flutter.dev/flutter/flutter_test/WidgetController/dragUntilVisible.html)) to scroll the `ListView`.  But there is no way to make sure that the center of the child widget is in the viewport so `tap` will succeed.  There is no `dragEnsureVisible()`.

I thought of some poor workarounds:
- Replace the `ListView` with a [`Column`](https://api.flutter.dev/flutter/widgets/Column-class.html) inside a [`SingleChildScrollView`](https://api.flutter.dev/flutter/widgets/SingleChildScrollView-class.html).  This will make the app heavier.
- Write my own `dragEnsureVisible()` test function.
- Write my own `tap()` that will tap on any visible part of the target.

## Proposal

Provide a way to write a test that scrolls a `ListView` and taps on a child widget.
Repository: flutter
Issue: WidgetTester.ensureVisible() to stop ignoring failure
Labels: a: tests,c: new feature,framework,c: proposal,f: integration_test,P3,team-framework,triaged-framework

## Use case

I'm writing an integration test for a mobile app.  I tried using `WidgetTester.ensureVisible()` (inherited from [`WidgetController.ensureVisible`](https://api.flutter.dev/flutter/flutter_test/WidgetController/ensureVisible.html)) to scroll a widget into the viewport and then `tap()` it.

The scroll operation failed (#88762) and `ensureVisible()` failed to move the widget entirely onto the screen.  It silently ignored this error.  Then I wasted time trying to figure out why the subsequent `tap()` call failed (which also silently failed #88759).

I'm surprised to find a library from Google that silently ignores errors.  I think future Flutter users would benefit from a `WidgetTester` rewrite that follows modern software engineering practices like "fail fast" and "fail with a useful error message".  CC: @timsneath

## Proposal

1. Rename `ensureVisible()` to `tryEnsureVisible()` and make it return `true` if it moved the widget onto the screen.
2. Add a new `ensureVisible()` method that immediately fails the test if it cannot move the widget onto the screen.
Repository: youtube-dl
Issue: Olympics Replay
Labels: site-support-request

<!--

######################################################################
  WARNING!
  IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE
######################################################################

-->


## Checklist

<!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2021.06.06. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
- Make sure that site you are requesting is not dedicated to copyright infringement, see https://yt-dl.org/copyright-infringement. youtube-dl does not support such sites. In order for site support request to be accepted all provided example URLs should not violate any copyrights.
- Search the bugtracker for similar site support requests: http://yt-dl.org/search-issues. DO NOT post duplicates.
- Finally, put x into all relevant boxes (like this [x])
-->

- [x] I'm reporting a new site support request
- [ ] I've verified that I'm running youtube-dl version **2021.06.06**
- [ ] I've checked that all provided URLs are alive and playable in a browser
- [ ] I've checked that none of provided URLs violate any copyrights
- [ ] I've searched the bugtracker for similar site support requests including closed ones


## Example URLs

<!--
Provide all kinds of example URLs support for which should be included. Replace following example URLs by yours.
-->

- Single video: https://olympics.com/tokyo-2020/en/replay/7dbb1441-691e-429f-a807-5109ba4c0a24/mens-individual-q-fs-s-fs-finals




## Description

<!--
Provide any additional information.
If work on your issue requires account credentials please provide them or explain how one can obtain them.
-->

东京奥运官方回看，很多比赛其它网站没有，特别是没有解说的视频。
Repository: TypeScript
Issue: Mapped types lose type information
Labels: Bug,Fix Available

# Bug Report

Eager mapped types result in the indexed access of an union created from all elements of a tuple resulting in the widest type in the tuple.

### 🔎 Search Terms

eager mapped types, array intersection filtering

### 🕗 Version & Regression Information

This bug exists in every version of TypeScript available on the playground with support for the necessary language features through nightly. In 3.8.3, both assignments to `test` fail.

- This changed between versions 3.8.3 and 3.9.7

### ⏯ Playground Link

[Playground link with relevant code](https://www.typescriptlang.org/play?target=99&ts=4.4.0-beta#code/JYOwLgpgTgZghgYwgAgDLAM5gKIBsIC2E4yA3gFDJXIID2IAJsGMPQFzIBGtt+cIAbkrVgDDliigA5kIC+5cnRBZkuTGGQBeZAG1hVUjXpMW7ZGCgBXCABpkojgCIAnhAyPksm-rJHGzVhAOeFwMW3sxZEcQWg8vcgBdZDgMPywhcjBnAAcUAGEACwgEAGs84wD6AB4fdBUIAA9IRlSoCDgGelxnNHU8QmIwHQTvamQASQARZEbmhlS6oZBLAk5oBJ1HUUcRnwA+LWQACkMHCenZZAAyXqwdZdX1gEpNpRNAnYUs3OQAWThsrkGIcKGMdFN7CAoq53AkOIVimUKqYQFVvhBaDBVOo7FM9uRZJsYZ9MjkUAA5Whgf6AiDA7QI0rlfwotFkzHYrB2FxuRz48gMYq4OBtNIaAgAoEcGlAgVCkUoJQqGLUyV0jiU1W0hgKfAaSBYDgWayHY0QTJuDTaCXai0qbQqmV0oA)

### 💻 Code

```ts repro
interface ListElement {
    condition: boolean;
    id: string;
}

const list = [
    { condition: true, id: "yes" },
    { condition: false, id: "no" },
] as const;

type CheckCondition<
    List extends readonly ListElement[],
    ID extends List[number]["id"],
    > = ({ id: ID } & List[number])["condition"]

type Mapped = {
    [ID in "yes"]: CheckCondition<typeof list, ID>
}["yes"]

type NotMapped = CheckCondition<typeof list, "yes">

declare const mapped: Mapped
declare const notMapped: NotMapped

let test: true = true
test = mapped // error, should pass
test = notMapped
```

### 🙁 Actual behavior

The type constructed using a mapped type loses specificity, becoming `(typeof list)[number]["condition"]`, which in this case is `true | false == boolean`

### 🙂 Expected behavior

The mapped type should have no effect on the resulting type.

This is the result of a question on the [TS discord](https://discord.com/channels/508357248330760243/766001660375859262/879551562744201246).
Repository: flutter
Issue: integration_test missing FlutterDriver.waitFor support
Labels: a: tests,c: new feature,framework,c: proposal,f: integration_test,P3,team-framework,triaged-framework

## Use case

In previous integration tests for my Flutter apps, a crucial method was [`FlutterDriver.waitFor`](https://api.flutter.dev/flutter/flutter_driver/FlutterDriver/waitFor.html) as it allowed the app to load up something before performing the actual test case.

With the [migration to the `integration_test` package](https://flutter.dev/docs/testing/integration-tests#migrating-from-flutter_driver), this is not possible anymore. We cannot access `FlutterDriver.waitFor` anymore and there is no analog in the [`WidgetTester` class](https://api.flutter.dev/flutter/flutter_test/WidgetTester-class.html).

---

The doc actually states:

> Instead of calling `driver.wait*` API, use `WidgetTester.pumpAndSettle()` or equivalent methods.

However, this is not actually feasible.

### Why there are no equivalent methods

Let us use the example of a loading screen for an app.

* `WidgetTester.pumpAndSettle()` will not work at all if there is a static screen that will be replaced after some loading as it only waits for no frames being scheduled but simply cannot wait for any loading.
* `WidgetTester.pumpAndSettle(const Duration(seconds: 2))` as an example **also** does not work because loading will differ based on network speed, device speed, etc.

## Proposal

The `FlutterDriver.wait*` methods should be introduced to `WidgetTester`. Thinking about it, the same methods should also be useful for regular widget tests anyway.  
Furthermore, it is a regression to not have these. I can in fact not even migrate my old `flutter_driver` tests to `integration_test`.

### Workaround

One workaround I found was writing my own `waitFor` function:

```dart
Future<void> waitFor(WidgetTester tester, Finder finder) async {
  do {
    await tester.pumpAndSettle();
    await Future.delayed(const Duration(milliseconds: 100));
  } while (finder.evaluate().isEmpty);
}
```