Tags » Code Snippets

Pytorch: How to convert Numpy to Tensor data type or vice versa

If you use both numpy and pytorch libraries, it is inevitable that you need to convert one data format to another. Let’s take a look at how we can achieve that. 403 more words

Pytorch: How to save & load Neural Network

To save and load all of your Neural Network you trained, you only need to use simple command;

torch.save(networkModel, netModelName);

To load network you need to write your class definition unfortunately too, lets hope newer updates remove that requirement (there is also saving method which only stores parameters in a file however i found that more difficult to continue training and estimating, correct me if i am wrong here). 169 more words

Matlab Image Color Overlay

In Matlab language you can add overlay to your image using the code snippet below;

hold on,
% Make a truecolor all-green image.
red= zeros(size(Image,1),size(Image,2),size(Image,3));
h = imshow(red);
hold off
set(h, 'AlphaData', uint8(OverlayImage)); 141 more words

Salesforce: Making a Trigger to execute at last

I had an After trigger in a Grand-child object that does some calculations with Child object and updates the result in Parent object. All the calculation logic were perfectly alright. 269 more words

Code Snippets

Watch Ludo Lefebvre Explain the Magic Behind Classic Escargot

On the back of Ludo Lefebvre’s right hand is a testament to his love of escargot—a tattoo of a cartoony snail that’s become his trademark. Growing up Auxerre, a city in France’s… 384 more words

Food & Drink

Difference in days between two dates

 Difference in days between two dates :

Here, we are stamping the diffrence in days between two dates i.e first date and second date.
function days() 77 more words