sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: Strange latency overhead of F.conv2d
Labels: module: performance,module: cpu,triaged

## Issue description

I'm trying to optimize the inference latency, but found that there's a strange overhead happens in one single conv layer. Even though it still fits `y=kx+b` linear relationship, but the `b` is extremely large.

The profiling result goes as follows.

|[filter, filter, input_channels, output_channels]|Latency for execute 50 times (s)|
|---|---|
|[3, 3, 16, 8]|0.024658|
|[3, 3, 16, 16]|0.032011|
|[3, 3, 16, 32]|0.031948|
|[3, 3, 16, 64]|0.037025|
|[3, 3, 16, 128]|0.049538|
|[3, 3, 16, 256]|0.062251|
|[3, 3, 16, 512]|0.105888|

## Code example

```python
import datetime
import torch
import torch.nn.functional as F
import torch.nn as nn

for i in range(7):
  shape = [3,3,16,2**(i+3)]
  kernel_value = np.random.rand(shape[0],shape[1],shape[2],shape[3]).astype(np.float32)
  kernel = torch.as_tensor(np.transpose(kernel_value, (3,2,0,1)))
  input_value = np.random.rand(1,16,32,32).astype(np.float32)
  x = torch.as_tensor(input_value)

  before = datetime.datetime.now()
  for j in range(100):
    if j==50:
      before = datetime.datetime.now()
    tmp = F.conv2d(x, weight=kernel,bias=None,stride=1,padding=(3-1)//2)
  after = datetime.datetime.now()
  interval = after-before
  print(str(shape)+"\t"+str(get_seconds(interval)))
```

## System Info
```
PyTorch version: 1.1.0
Is debug build: No
CUDA used to build PyTorch: None

OS: Mac OSX 10.14.5
GCC version: Could not collect
CMake version: version 3.14.0

Python version: 2.7
Is CUDA available: No
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA

Versions of relevant libraries:
[pip] numpy==1.14.5
[pip] torch==1.1.0
[conda] Could not collect
```
Repository: TypeScript
Issue: Document --incremental and composite project APIs
Labels: Help Wanted,API,Docs,Fix Available

Follow-up from #29978, suggested by @MLoughry at https://github.com/microsoft/TypeScript/issues/29978#issuecomment-499674541
Repository: go
Issue: compress/gzip: provide user access to size trailer (when possible)
Labels: NeedsInvestigation,FeatureRequest

The current `gzip.Reader` reads and verifies the trailer crc and size at the end, but the user currently has no way of reading (to pre-allocate output resources) the size.

How much appetite do we have for adding something like a `func ReadSize(io.ReadSeeker) (uint32, error)` utility to the `compress/gzip` package?

For concreteness, a case that I really have in mind is [decompression in Shopify/sarama](https://github.com/Shopify/sarama/blob/94536b3e82d393e4b5dfa36475b40fc668e9486f/decompress.go), leading to dynamic `bytes.Buffer` reallocation growth under `ioutil.ReadAll`.

Using that example, perhaps another / a better option would be something like `func Decode([]byte) ([]byte, error)` like both snappy and zstd provide?

However there's some appeal to being able to do the classic  "seek to the end, read the size, pre-allocate, seek back to 0 and start streaming" idiom...
Repository: rust
Issue: Lifetime mismatch from itself
Labels: C-enhancement,A-diagnostics,A-lifetimes,T-compiler,D-newcomer-roadblock

I found myself encountering error[E0623], but the error message is not understandable and seems buggy: it says some variable's lifetime mismatches from itself.

Minimum Reproducible:

```
#[derive(Debug)]
enum IntOrRef<'a> {
    I(u32),
    R(&'a u32),
}

#[derive(Debug)]
struct V<'a> {
    v: Vec<IntOrRef<'a>>,
}

fn f(v: &mut V) {
    match v.v.last().unwrap() {
        IntOrRef::I(i) => {v.v.push(IntOrRef::R(&i));}
        IntOrRef::R(_)=> {}
    }
}

fn main() {
    let mut v = V { v: vec![IntOrRef::I(1)] };
    f(&mut v);
    dbg!(v);
}
```

Result:

```
error[E0623]: lifetime mismatch
  --> src/bin/temp.rs:14:37
   |
12 | fn f(v: &mut V) {
   |         ------
   |         |
   |         these two types are declared with different lifetimes...
13 |     match v.v.last().unwrap() {
14 |         IntOrRef::I(i) => {v.v.push(IntOrRef::R(&i));}
   |                                     ^^^^^^^^^^^^^^^ ...but data from `v` flows into `v` here

error: aborting due to previous error

For more information about this error, try `rustc --explain E0623`.
```

For me, this is not understandable, and I do not know how to fix it. In the real code, I want to copy a long-lived variable's short-lived reference to a new one and failed. I wonder:

1. How should I annotate lifetimes to get this work?
2. What does it mean by "mismatching from itself"?

## Meta

`rustc --version --verbose`:
```
rustc 1.35.0 (3c235d560 2019-05-20)
binary: rustc
commit-hash: 3c235d5600393dfe6c36eeed34042efad8d4f26e
commit-date: 2019-05-20
host: x86_64-apple-darwin
release: 1.35.0
LLVM version: 8.0
```
Repository: flutter
Issue: Add ability to scroll through buttons in BottomNavigationBar
Labels: c: new feature,framework,f: material design,P3,team-design,triaged-design

Hi , Please Add **Draggable** (scroll) Feature To **Bottom Navigation Bar** Like TabBarView
It's Very Important For UX
Thanks
Repository: go
Issue: cmd/vet: copylock does not warn when "lock_type_var = *func_return_pointer_to_locktype()"
Labels: NeedsInvestigation,Analysis

I am using Go 1.12.1.

cmd/vet does not report any warning for example code below:
```go
package main

type noCopy struct{}

func (*noCopy) Lock()              {}
func (*noCopy) Unlock()            {}
func (*noCopy) MuteUnusedWarning() {}

func returnNCP() *noCopy {
	var nc noCopy
	return &nc
}

func main() {
	var nc noCopy
	nc = *returnNCP()
	nc.MuteUnusedWarning()
}
```

I read code of the analyzer copylock.go:

```
func lockPathRhs(pass *analysis.Pass, x ast.Expr) typePath {
   224     if _, ok := x.(*ast.CompositeLit); ok {
   225         return nil
   226     }
   227     if _, ok := x.(*ast.CallExpr); ok {
   228         // A call may return a zero value.
   229         return nil
   230     }
   231     if star, ok := x.(*ast.StarExpr); ok {
   232         if _, ok := star.X.(*ast.CallExpr); ok {
   233             // A call may return a pointer to a zero value.
   234             return nil
   235     }
```

my confusion is why line 234 just return nil without check the return type of the function (BTW, in my example code, "return &nc" will pass the "checkCopyLocksReturnStmt" check, b/c the return type is a pointer).  All this result to the mute of cmd/vet.

Could this case be caught by cmd/vet in future?
Repository: rust
Issue: What is a trailing expression in a block exactly?
Labels: A-frontend,A-parser,A-macros,T-lang

Is it determined syntactically or semantically?
Before or after macro expansion?

Answering these questions is necessary to specify expansion of macros (stable fn-like ones or unstable attribute ones) in expression and statement positions.
The current implementation is sometimes inconsistent.

Below I'll be dumping some code examples expanded using different expansion models in hope to come up with some rules that are both self-consistent and backward compatible.

cc https://github.com/rust-lang/rust/issues/33953
Repository: flutter
Issue: setPreferredOrientations([up, down]) doesn't actually allow down
Labels: platform-android,platform-ios,engine,a: layout,has reproducible steps,P2,found in release: 3.3,found in release: 3.7,team-engine,triaged-engine

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill our the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

```
@override
void initState() {
  super.initState();
  SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown,
  ]);
}
```

If I use this code. The screen remains in portraitUp but never portraitDown even if I rotate the phone.
Repository: vscode
Issue: Global regex search with "Not matching character" doesn't match newline
Labels: feature-request,search


Issue Type: <b>Bug</b>

I was trying to search for 
```
Promise\.all\(\[[^\]]*await[^\]]*\]\)
```
but I had no way to turn on multiline support so that `^\]` would match newlines too. So searching for below would not be found.
```
return await Promise.all([
  await this.someFunction1(),
  await this.someFunction2(),
]);
```
I later put in the below and was happy to find that it suddely worked, but knew that it would only find if await was on the first line after the bracket, and also if there was no chars other than newline space or tab.
```
Promise\.all\(\[[^\]]*[\n\r \t]await[^\]]*\]\)
```
But, I then started to find others that actually SHOULDN'T have worked.. 
It was at this point, I realsed that `^\]` was working as expected the first time, and was matching on newline chars.. (Perfect, I removed my tab/space hack).. To find, it stopped working again..

It seems I need atleast 1 `\n` in the regex to make it work.

My quick fix was to add this at the very end as such
```
Promise\.all\(\[[^\]]*await[^\]]*\]\)\n{0}
```
But this is obviously a dirty hack and not an obvious one, be far better to test for `Not Matching` and turn multiline back on, similar to what ever test you are doing for searching for `\n` and turning on multiline

VS Code version: Code 1.35.0 (553cfb2c2205db5f15f3ee8395bbd5cf066d357d, 2019-06-04T01:17:12.481Z)
OS version: Windows_NT x64 10.0.10240

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Xeon(R) CPU E5-1620 v3 @ 3.50GHz (8 x 3492)|
|GPU Status|2d_canvas: enabled<br>checker_imaging: disabled_off<br>flash_3d: enabled<br>flash_stage3d: enabled<br>flash_stage3d_baseline: enabled<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>native_gpu_memory_buffers: disabled_software<br>rasterization: enabled<br>surface_synchronization: enabled_on<br>video_decode: enabled<br>webgl: enabled<br>webgl2: enabled|
|Load (avg)|undefined|
|Memory (System)|15.92GB (5.33GB free)|
|Process Argv||
|Screen Reader|no|
|VM|0%|
</details><details><summary>Extensions (19)</summary>

Extension|Author (truncated)|Version
---|---|---
markdown-preview-github-styles|bie|0.1.6
npm-intellisense|chr|1.3.0
ssh|chr|0.0.4
vue-peek|dar|1.0.2
vscode-eslint|dba|1.9.0
vscode-ts-auto-return-type|ebr|1.0.1
tslint|eg2|1.0.43
RunOnSave|eme|0.0.18
prettier-vscode|esb|1.9.0
todo-tree|Gru|0.0.134
node-module-intellisense|lei|1.5.0
camelcasenavigation|map|1.0.1
rainbow-csv|mec|1.1.1
node-modules-resolve|nau|1.0.2
uuid-generator|net|0.0.4
vetur|oct|0.21.0
gitconfig|sid|2.0.0
open-in-browser|tec|2.0.0
sort-lines|Tyr|1.8.0


</details>
<!-- generated by issue reporter -->
Repository: kubernetes
Issue: Upgrade tests do not check pod instances and restart counts are identical for workload objects
Labels: kind/bug,priority/important-soon,sig/apps,sig/testing,lifecycle/frozen

**What happened**:

An upgrade of only the API server should not result in pod recreations or container restarts.

Today, this can accidentally be triggered by introducing new defaults to types within PodSpec (c.f. https://github.com/kubernetes/kubernetes/pull/69988, https://github.com/kubernetes/kubernetes/issues/69445, https://github.com/kubernetes/kubernetes/issues/78633).

The workload upgrade tests do not currently check if pod instances and container restart counts are identical.

**What you expected to happen**:

At the end of the upgrade test setup step, record the pod instances for the workload object in question, their uids, container restart counts, and associated node names and versions.

In the verification step post-upgrade, if the associated nodes still exist at the same versions, verify the same pod instances still exist with the same container restart counts.

For bonus points, an unrelated update (e.g. adding an annotation to the workload object) should be performed, to verify that no defaults are added in the update path that would result in a spurious rollout of new pods.

(note that test/e2e/upgrades tests are not currently running at all, see https://github.com/kubernetes/kubernetes/issues/94487)

/sig testing
/sig apps
/priority important-soon
Repository: go
Issue: cmd/compile: similar returns not optimized
Labels: Performance,NeedsFix,compiler/runtime

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version devel +323212b Sun Jun 9 16:23:11 2019 +0000 linux/amd64
</pre>

### Does this issue reproduce with the latest release?
Yes.

### What did you do?
I compiled the following function:
```go
func f1(x int, b bool) int {
	if b {
		return x
	}
	return x
}
```

### What did you expect to see?
I expected it to be compiled to a move and a return, given that the return value is always the same.

### What did you see instead?
Instead, it was compiled to:
```asm
        movblzx "".b+16(SP), AX
        testb   AL, AL
        jeq     f1_pc20
        movq    "".x+8(SP), AX
        movq    AX, "".~r2+24(SP)
        ret
f1_pc20:
        movq    "".x+8(SP), AX
        movq    AX, "".~r2+24(SP)
        ret
```
I think the compiler should recognize both cases to be the same.

Note: if this function is called from another one, the optimization is applied. For example:
```go
func f2(x int, b bool) int {
    return f1(x, b)
}
```
is compiled to
```asm
        movq    "".x+8(SP), AX
        movq    AX, "".~r2+24(SP)
        ret
```
Repository: flutter
Issue: [web] Flush handleBeginFrame microtasks before handleDrawFrame
Labels: c: crash,framework,c: API break,platform-web,P2,team-web,triaged-web

Flutter for web deviates from Flutter mobile in that it does not flush microtasks scheduled by `handleBeginFrame` before calling `handleDrawFrame`. This is done so we do not split the request animation frame into two separate VM events; animation frame event must be synchronous.

Relevant code: https://github.com/flutter/flutter_web/blob/3db7f7cf1da54a7a2a5e490b8587addd7d7e892f/packages/flutter_web_ui/lib/src/engine.dart#L150

Flutter Dart embedder controls the event loop, and for this particular case ensures that `handleBeginFrame` and `handleDrawFrame` are glued to each other and behave like events.

## Short-term solution

1. Run `handleBeginFrame` in a zone, capture all microtasks and flush them manually.
1. Schedule `handleDrawFrame` in a microtask.

The second step is added for extra protection from code that reaches into `Zone.root`/`Zone.parent` and schedules microtasks outside the zone created in step 1. It's not a 100% solution though, because if root zone microtasks schedule more microtasks (e.g. by calling `await` multiple times), they will still be executed after `handleDrawFrame`.

## Long-term solution

Dart compilers (cc @vsmenon) give us a way to fully control the event loop, such that users cannot bypass it via `Zone.root`.
Repository: vscode
Issue: The new application icon lacks resolution on HiDPI systems
Labels: bug,windows,icon-brand

- VSCode Version: 1.35.0
- OS Version: Win 10 Pro x64 1809 build 17763.503

Steps to Reproduce:
1. Pin VSCode to the Start menu on a HiDPI system (for instance at 3840×2160 resolution with 200% custom scaling);
2. Open the start menu and observe that the icon appears blurry due to insufficient resolution

The VSCode and VSCode Insider icons appear blurry and suffer from upscaling artefacts:
![Untitled](https://user-images.githubusercontent.com/4053575/59293272-d7f3e800-8c4c-11e9-81a6-94c80c95d81a.png)
Repository: flutter
Issue: The DraggableScrollableSheet to go all the way up/down when fling/dragged.
Labels: c: new feature,framework,f: material design,P3,team-framework,triaged-framework

Hi,
I want the list when its draggable to go all the way up or down as I fling or drag. Now in the DraggableScrollableNotification I only get the currentExtent which I believe is not enough data to implement that functionality. There is no way to set the currentExtent as well.

It would be nice if(possible) we could get all the details of the drag like we do in the GestureDetector.  
If there is a way this can be implemented with the current implementation please help me out on this.

Thanks
Sourabh
Repository: TypeScript
Issue: Suggestion: extract to function expression
Labels: Suggestion,Awaiting More Feedback

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Please read the FAQ first, especially the "Common Feature Requests" section.

-->

## Search Terms

<!-- List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily -->

function expression declaration extract method refactoring code fixes

## Suggestion

"Extract to function" is very useful, but it only supports generating function declarations. Some people (such as me) prefer to use function expressions instead of declarations.

For example:

``` ts
const fn = () => {
    const foo = 1;
    const bar = foo + 2
}
```

If I select line 3 and extract to function, I get

``` ts
const fn = () => {
    const foo = 1;
    const bar = newFunction(foo)
}

function newFunction(foo: number) {
    return foo + 2;
}
```

I want:

``` ts
const newFunction = (foo: number) => foo + 2;

const fn = () => {
    const foo = 1;
    const bar = newFunction(foo)
}
```

Some ideas:

- An option to toggle between expressions/declarations
- Separate refactorings for both expressions and declarations

## Use Cases

<!--
What do you want to use this for?
What shortcomings exist with current approaches?
-->

## Examples

<!-- Show how this would be used and what the behavior would be -->

## Checklist

My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [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, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).
Repository: TypeScript
Issue: Performance Microbenchmark Infrastructure
Labels: Infrastructure

(Ron to provide details on scenarios to support)
Repository: three.js
Issue: setProjectionFromUnion makes incorrect assumptions
Labels: Bug

The comment from `setProjectionFromUnion` states:
> Assumes 2 cameras that are parallel and share an X-axis

For Magic Leap devices, that is not the case and because of this, this function calculates incorrect values which results in the scene not rendering correctly.
It's observable by virtually pinning content to a wall or whiteboard and then walking away. You will then see that the content will rotate or move from its location.

[WebXR](https://www.w3.org/TR/webxr/#xrview-interface) specifies that projection matrices are not supposed to be decomposed: 
> It is strongly recommended that applications use this matrix without modification or decomposition. Failure to use the provided projection matrices when rendering may cause the presented frame to be distorted or badly aligned, resulting in varying degrees of user discomfort.
Repository: flutter
Issue: Add2app: When moving Flutter module the host project will no longer compile on iOS
Labels: platform-ios,tool,a: existing-apps,P3,team-ios,triaged-ios

When using "create module -t" for a Flutter project it creates a file <project>/.ios/Flutter/Generated.xcconfig and inside of it is an environment variable FLUTTER_APPLICATION_PATH which as the absolute path to the project.  (example FLUTTER_APPLICATION_PATH=/Users/aaclarke/dev/NavFlutter/fluttermod=/Users/aaclarke/dev/NavFlutter/fluttermod).

If you move your project to a different directory and compile you app it will no longer compile getting errors like: "The path /Users/aaclarke/dev/NavFlutter/fluttermod does not exist"

There isn't an obvious way to fix this for users.  We could create a tool that will refresh this xcconfig file or we could store the path relative to the .xcodeproject file since that's less likely to change.  When we can't find FLUTTER_APPLICATION_PATH we could also suggest the user refreshes the xcconfig.
Repository: rust
Issue: `impl Trait` with multiple lifetimes imposes a strange lifetime requirement
Labels: C-enhancement,A-diagnostics,A-lifetimes,T-compiler,A-NLL,A-impl-trait

Consider the [following code](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=4973e923873462ad1d3630ffbd463cd6):

```rust
pub struct Store;
impl Store {
    fn scan<'a>(&'a self) -> Box<dyn Iterator<Item = u64> + 'a> { panic!() }
}
pub struct Transaction<'a> {
    kv: &'a Store,
    reads: Vec<u64>,
}

impl<'a> Transaction<'a> {
    pub fn scan(&mut self) -> impl Iterator<Item = u64> + 'a + '_ {
        let iter = self.kv.scan();
        iter.map(move |k| {
            self.reads.push(k);
            k
        })
    }
}
```

Compiling with `#![feature(nll)]` yields the following error:
```
error: lifetime may not live long enough
  --> src/lib.rs:24:9
   |
18 |   impl<'a> Transaction<'a> {
   |        -- lifetime `'a` defined here
19 |       pub fn scan(&mut self) ->
   |                   - let's call the lifetime of this reference `'1`
...
24 | /         iter.map(move |k| {
25 | |             self.reads.push(k);
26 | |             k
27 | |         })
   | |__________^ returning this value requires that `'1` must outlive `'a`

error: aborting due to previous error
```
That is, it's requiring that the reference to `Transaction` outlive `'a`. Unfortunately, it doesn't explain at all why that requirement was imposed.

Also, just returning `+ '_` complains:
```
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
  --> src/lib.rs:20:9
   |
20 |         impl Iterator<Item = u64> + '_
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: hidden type `std::iter::Map<std::boxed::Box<dyn std::iter::Iterator<Item = u64>>, [closure@src/lib.rs:24:18: 27:10 self:&mut Transaction<'a>]>` captures the lifetime 'a as defined on the impl at 18:6
  --> src/lib.rs:18:6
   |
18 | impl<'a> Transaction<'a> {
   |      ^^
```

This is odd to me because if we return `Box<dyn Iterator<Item = u64> + '_>`, everything works fine (and nobody complains about `'a`). Furthermore, the equivalent to the `impl Trait` using an explicit `existential type TransactionScan<'a, 'b>: Iterator<Item = u64>;` works fine as well. 

This may be related to/a dupe of #49431, but the errors produced are different so I'm not sure.