You can get the value of a shared variable like this:
w.get_value()
Then this would work:
w.get_value().shape
But this will copy the shared variable content. To remove the copy you can use the borrow parameter like this:
import numpy as np | |
import random | |
unit_step = lambda x: 0 if x < 0 else 1 | |
## create dummy data | |
training_data = [ (np.array([0,0,1]), 0), (np.array([0,1,1]), 1), (np.array([1,0,1]), 1), (np.array([1,1,1]), 1), ] | |
w = np.random.rand(3) | |
errors = [] | |
learning_rate = 0.2 |
import numpy as np | |
import theano | |
import theano.tensor as T | |
from theano import function, config, shared, sandbox | |
from theano import ProfileMode | |
import warnings | |
warnings.filterwarnings("ignore") | |
# Dummy Data |
You can get the value of a shared variable like this:
w.get_value()
Then this would work:
w.get_value().shape
But this will copy the shared variable content. To remove the copy you can use the borrow parameter like this:
sudo apt-add-repository ppa:samrog131/ppa | |
sudo apt-get update | |
sudo apt-get install ffmpeg-real | |
#very important | |
#create a symbolic link | |
sudo ln -sf /opt/ffmpeg/bin/ffmpeg /usr/bin/ffmpeg |
In order to resolve this, we need to create a soft link between two files. | |
Firstly, go to binstar.com and install the ffmpeg conda package(recent most). | |
This will create a libssl1.1.0 file in /anaconda/lib/ | |
Navigate to /usr/lib/ and notice that libssl file does not exist there | |
We need to copy the file there | |
sudo cp /anaconda/lib/libssl1.1.0 /usr/lib/ | |
But the error says that libssl.so.10 is not found. | |
We need to create a soft link like this: |
if ! [[ $# -eq 1 || $# -eq 2 || $# -eq 4 ]]; then | |
echo "Usage: $0 <author> [<start_date> <end_date>] [output_dir]" | |
echo "Example: $0 xinan@me.com 2015-05-25 2015-08-21 ./patches" | |
exit | |
fi | |
author=$1 | |
if [ $# -gt 3 ]; then | |
output_dir=$4 |
##Google Interview Questions: Product Marketing Manager
How do we solve for the policy optimization problem which is to maximize the total reward given some parametrized policy?
To begin with, for an episode the total reward is the sum of all the rewards. If our environment is stochastic, we can never be sure if we will get the same rewards the next time we perform the same actions. Thus the more we go into the future the more the total future reward may diverge. So for that reason it is common to use the discounted future reward where the parameter discount
is called the discount factor and is between 0 and 1.
A good strategy for an agent would be to always choose an action that maximizes the (discounted) future reward. In other words we want to maximize the expected reward per episode.
from __future__ import print_function | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from torch.autograd import Variable | |
def sample_gumbel(shape, eps=1e-20): | |
U = torch.rand(shape).cuda() | |
return -Variable(torch.log(-torch.log(U + eps) + eps)) |
04379243 table | |
03593526 jar | |
04225987 skateboard | |
02958343 car | |
02876657 bottle | |
04460130 tower | |
03001627 chair | |
02871439 bookshelf | |
02942699 camera | |
02691156 airplane |