Create things on GPU Consider these two lines: torch.zeros(100, device="gpu") torch.zeros(100).to("cuda") They should effect the same, but first one is faster as it assumes creating GPU tensor directly without copy from CPU, while the second one uses the copy from CPU trick. Two different loss functions If you have two different loss functions, finish the forwards for … [Read more...] about PyTorch healthier life
To see which version of Python 3 you have installed, open a command prompt and run $ python3 --version If you are using Ubuntu 16.10 or newer, then you can easily install Python 3.6 with the following commands: $ sudo apt-get update $ sudo apt-get install python3.6 If you're using another version of Ubuntu (e.g. the latest LTS release), we recommend using the deadsnakes … [Read more...] about Update Python for old Linux boxes
import inspect lines = inspect.getsource(magic_function) print(lines) … [Read more...] about How to get the Python source codelines?
Here is the task: An experimental drug was tested on individuals from 13 to 100. The trail had 2100 participants. Half were under 65 years old, half were over 65 years old. 95% of patients 65 or older experianced no side effects. 95% of patients under 65 experianced no side effects. import numpy as np from random import randint mport keras from keras import backend as … [Read more...] about Experiment in TensorFlow
What would be the "Hello World" problem in Ai? Some would say this would be Spam Filtering using Naive Bayesian Classifier, but many would take the MNIST dataset representing the model containing 60.000 different ciphers 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. This is also known as the MNIST dataset classification problem. To work on this problem using TensorFlow it would be enough … [Read more...] about MNIST dataset classification problem