Tencent / Tencent/ncnn

/src/net.cpp

Open
#2,005 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
23.8k
Forks
4.5k
Avg merge
2d 20h
Merged PRs (30d)
37

Description

    Mat bottom_blob = blob_mats[bottom_blob_index];
    if (opt.lightmode)
    {
        // delete after taken in light mode
        blob_mats[bottom_blob_index].release();
        // deep copy for inplace forward if data is shared
        if (layer->support_inplace && *bottom_blob.refcount != 1)
        {
            bottom_blob = bottom_blob.clone();
        }
    }

====================
上面的release,是不是应该放到clone的所在的if里面?理解这个release是由于前面bottom_blob 拷贝构造函数refcount++,以及后面clone没有refcount--,所以要release。如果不满足后面的if条件,那就没有clone,这个release是不是不应该有。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/net.cpp at the shown bottom_blob handling, and trace the refcount effects of the copy, release, and conditional clone. Confirm the intended ownership behavior for both branches; the issue is complete when the release placement is resolved and the relevant behavior is covered by the repository's existing validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.