akankshakshurai/cuda-error-resolution-analysis huggingface dataset:
PyTorch Mobile + NNAPI integration

yupri: <p>Hi!<br>
I’m looking into getting a YOLOv5 model running on NNAPI.<br>
The doc (<a href="https://pytorch.org/tutorials/prototype/nnapi_mobilenetv2.html#introduction" class="inline-onebox" rel="noopener nofollow ugc">(Prototype) Convert MobileNetV2 to NNAPI — PyTorch Tutorials 1.7.1 documentation</a>) states that the range of supported operators is limited.<br>
Is it possible to get the listing of supported ops?<br>
What is the strategy of the framework in a situation where the model uses both supported and unsupported ops? Does it bail out of NNAPI completely, or uses split execution, <a href="https://www.tensorflow.org/lite/performance/nnapi#use_supported_models_and_ops" rel="noopener nofollow ugc">like TFLite</a>?</p>

IvanKobzarev: <p>The listing of supported ops you can find here:</p><aside class="onebox githubblob">
  <header class="source">
      <a href="https://github.com/pytorch/pytorch/blob/master/torch/backends/_nnapi/serializer.py#L585-L636" target="_blank" rel="noopener nofollow ugc">github.com</a>
  </header>
  <article class="onebox-body">
    <h4><a href="https://github.com/pytorch/pytorch/blob/master/torch/backends/_nnapi/serializer.py#L585-L636" target="_blank" rel="noopener nofollow ugc">pytorch/pytorch/blob/master/torch/backends/_nnapi/serializer.py#L585-L636</a></h4>
<pre class="onebox"><code class="lang-py"><ol class="start lines" start="585" style="counter-reset: li-counter 584 ;">
<li>ADDER_MAP = {</li><li>    "prim::GetAttr": lambda self, node:</li><li>        self.add_getattr(node),</li><li>    "prim::Constant": lambda self, node:</li><li>        self.add_constant_node(node),</li><li>    "prim::ListConstruct": lambda self, node:</li><li>        self.add_list_construct(node),</li><li>    "prim::TupleConstruct": lambda self, node:</li><li>        self.add_tuple_construct(node),</li><li>    "aten::reshape": lambda self, node:</li><li>        self.add_reshape(node),</li><li>    "aten::quantize_per_tensor": lambda self, node:</li><li>        self.add_quantize(node),</li><li>    "aten::dequantize": lambda self, node:</li><li>        self.add_dequantize(node),</li><li>    "aten::add": lambda self, node:</li><li>        self.add_add_sub_op(node, NNAPI_OperationCode.ADD, NNAPI_FuseCode.FUSED_NONE),</li><li>    "aten::sub": lambda self, node:</li><li>        self.add_add_sub_op(node, NNAPI_OperationCode.SUB, NNAPI_FuseCode.FUSED_NONE),</li><li>    "aten::mul": lambda self, node:</li>
</ol></code></pre>

  This file has been truncated. <a href="https://github.com/pytorch/pytorch/blob/master/torch/backends/_nnapi/serializer.py#L585-L636" target="_blank" rel="noopener nofollow ugc">show original</a>

  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>

<p>If operation is not supported - serialization will fail with exception <a href="https://github.com/pytorch/pytorch/blob/master/torch/backends/_nnapi/serializer.py#L641" class="inline-onebox" rel="noopener nofollow ugc">pytorch/serializer.py at master · pytorch/pytorch · GitHub</a></p>

Aby: <p>Hi what was your progress to get the Pytorch Yolov5 model to run on NNAPI?</p>
What is the difference between tag and group in distributed framwork?

Maxwell_Albert: <p>Hi, I saw tag optional input at dist.send dist.recv api.<br>
And I find that there is also group in pytorch distributed api.<br>
So If I use multiple dist.isend in sam group, is it necessary for me to add tag at each send and receive?<br>
What is the difference between tag and group?<br>
<a href="https://pytorch.org/docs/stable/distributed.html#:~:text=isend(tensor%2C%20dst%2C%20group%3DNone%2C-,tag,-%3D0)" class="onebox" target="_blank" rel="noopener nofollow ugc">https://pytorch.org/docs/stable/distributed.html#:~:text=isend(tensor%2C%20dst%2C%20group%3DNone%2C-,tag,-%3D0)</a></p>

kwen2501: <p>Hi, <code>group</code> is an id for the group of processes which wish to communicate with each other. It is similar to the “communicator” concept in the collective communication.</p>
<p><code>tag</code> is an optional field that explicitly matches a send call with a recv call. Thus these two fields are orthogonal.</p>
Abnormal Mean and standard deviation values for image dataset

siddharth_MV: <p>I tried calculating the mean and standard deviation for an image dataset and I am getting very high values. If I am not wrong the values should be between 0 and 1.</p>
<pre><code class="lang-auto">def mean_std(loader):
    mean = 0.0
    std = 0.0
    total_images_count = 0
    for images, _ in loader:
        image_count_in_a_batch = images.size(0)
        images = images.view(image_count_in_a_batch, images.size(1), -1)
        mean += (images * 1.0).mean(2).sum(0)
        std += (images * 1.0).std(2).sum(0)
        total_images_count += image_count_in_a_batch
    mean /= total_images_count
    std /= total_images_count
    return mean, std

(tensor([112.1058, 126.2224,  79.7943]), tensor([49.5487, 50.0356, 43.0908]))
</code></pre>
<p>I can’t seem to find the mistake in this. Any help would be appreciated!</p>

ptrblck: <aside class="quote no-group" data-username="siddharth_MV" data-post="1" data-topic="149477">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/siddharth_mv/48/48580_2.png" class="avatar"> siddharth_MV:</div>
<blockquote>
<p>If I am not wrong the values should be between 0 and 1.</p>
</blockquote>
</aside>
<p>If you are using normalized inputs in this range, then the <code>mean</code> should be expected in this range, too.<br>
However, based on your values I would guess that your inputs might be raw pixel values in <code>[0, 255]</code>.</p>

siddharth_MV: <p>Since I am using albumentation library, I had to specify the max_pixel_value in the normalize function. It’s working fine now. Thank you!</p>

Sarmad_GTU: <p>I have a question here.<br>
When I want to take the mean and standard deviation value of my dataset, should I take all the data, or do I just have to take the training part?</p>

InnovArul: <p>The Ideal protocol is to use only the training data to calculate the <code>mean</code> and <code>std</code>.</p>

Sarmad_GTU: <p>and the use this in normalization of all parts?</p>

InnovArul: <p>yes, you are right. Use the <code>mean</code>, <code>std</code> from the training set to normalize validation, test, dev sets of data, if any.</p>

Sarmad_GTU: <p>thank you for your explination</p>