akankshakshurai/cuda-error-resolution-analysis huggingface dataset:
Edge Loss function implementation

username: aradhyamathur
cooked: <p>I am trying to define a loss function to compute the loss between edge reconstruction. The following is my implementation however I suspect I have made some error. I am calculating the edges using convolutions and then performing mse over it.</p>
<pre><code class="lang-auto">def edge_loss(out, target, cuda=True):
	x_filter = np.array([[1, 0, -1], [2, 0, -2], [1, 0, -1]])
	y_filter = np.array([[1, 2, 1], [0, 0, 0], [-1, -2, -1]])
	convx = nn.Conv2d(1, 1, kernel_size=3, stride=1, padding=1, bias=False)
	convy = nn.Conv2d(1, 1, kernel_size=3 , stride=1, padding=1, bias=False)
	weights_x = torch.from_numpy(x_filter).float().unsqueeze(0).unsqueeze(0)
	weights_y = torch.from_numpy(y_filter).float().unsqueeze(0).unsqueeze(0)

	if cuda:
		weights_x = weights_x.cuda()
		weights_y = weights_y.cuda()

	convx.weight = nn.Parameter(weights_x)
	convy.weight = nn.Parameter(weights_y)

	g1_x = convx(out)
	g2_x = convx(target)
	g1_y = convy(out)
	g2_y = convy(target)

	g_1 = torch.sqrt(torch.pow(g1_x, 2) + torch.pow(g1_y, 2))
	g_2 = torch.sqrt(torch.pow(g2_x, 2) + torch.pow(g2_y, 2))

	return torch.mean((g_1 - g_2).pow(2))
</code></pre>
<p>The loss is then calculated as follows</p>
<pre><code class="lang-auto">loss = edge_loss(out, x)
loss.backward()
</code></pre>
<p>I do not want to update the weights of the convolution filters since these are the edge filters needed. Is this implementation correct?</p>

username: tom
cooked: <p>If you don’t want trainable features, the functional api is a much better match, so <code>torch.nn.functional.conv2d</code> etc.</p>
<p>Best regards</p>
<p>Thomas</p>

username: aradhyamathur
cooked: <p>Thanks. But if I use nn.Conv is my method correct ?</p>

username: John1231983
cooked: <p><a class="mention" href="/u/aradhyamathur">@aradhyamathur</a>: Interesting! Could you share your experiment?</p>

username: edgarriba
cooked: <p>you directly use <a href="https://kornia.readthedocs.io/en/latest/filters.html#kornia.filters.sobel" rel="noopener nofollow ugc">kornia.sobel</a> or <a href="https://kornia.readthedocs.io/en/latest/filters.html#kornia.filters.spatial_gradient" rel="noopener nofollow ugc">kornia.spatial_gradient</a></p>
Best experiment management tools for machine learning

username: Mohamed_Ragab
cooked: <p>I will appreciate if anyone suggests a simple and efficient way to manage and save experiment results?</p>

username: ptrblck
cooked: <p>What would you like to save?<br>
If you are referring to the model and optimizer, have a look at the <a href="https://pytorch.org/docs/stable/notes/serialization.html">Serialization docs</a>.</p>

username: Mohamed_Ragab
cooked: <p>Actually, my question was mainly about experiment management, how to monitor your model in organized way (e.g., hyper-parameters, loss, plots,). So far I use excel sheet to save my results and corresponding hyper parameters manually, I was wondering if there simple and effective tool to save results and help to do visualization also.</p>

username: Mohamed_Ragab
cooked: <p>Would appreciate, if you as an expert, present your best practices for managing ML experiment.</p>

username: ptrblck
cooked: <p>Oh, I’m no expert in managing ML experiments, so let’s wait for the real experts to give their opinion, which tools to use. <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=9" title=":wink:" class="emoji" alt=":wink:"></p>

username: Mauri
cooked: <p><a href="https://wandb.ai" rel="nofollow noopener">https://wandb.ai</a> is a great tool for that. Hope it helps.</p>

username: Foivos_Diakogiannis
cooked: <p>A variety of tools is reported here: <a href="https://neptune.ai/blog/best-ml-experiment-tracking-tools" rel="nofollow noopener">https://neptune.ai/blog/best-ml-experiment-tracking-tools</a></p>
<p>Facing the same problem, getting lost in too many experiments…</p>

username: Mohamed_Ragab
cooked: <p>I would like to thank you, for the last 3 months I have been using wandb.ai, and all what I can say that it is really amazing</p>

username: drewtao
cooked: <p>I’d like to put in a plug for <strong>runx</strong>, which is very lightweight, and we use it in many of my group’s research projects. <a href="https://github.com/NVIDIA/runx" rel="noopener nofollow ugc">https://github.com/NVIDIA/runx</a>.</p>