Example outputs from OpenAI. They trained a charterer level language model on Amazon reviews. They discovered a single neuron in their model responsible for sentiment and by fixing its value were able to generate new reviews with a particular sentiment. (Source)
import tensorflow as tf
defconv1d(input_, output_size, width, stride):
'''
:param input_: A tensor of embedded tokens with shape [batch_size,max_length,embedding_size]
:param output_size: The number of feature maps we'd like to calculate
:param width: The filter width
:param stride: The stride
:return: A tensor of the concolved input with shape [batch_size,max_length,output_size]
'''
inputSize = input_.get_shape()[-1] # How many channels on the input (The size of our embedding for instance)#This is the kicker where we make our text an image of height 1
input_ = tf.expand_dims(input_, axis=1) # Change the shape to [batch_size,1,max_length,output_size]#Make sure the height of the filter is 1
filter_ = tf.get_variable("conv_filter",shape=[1, width, inputSize, output_size])
#Run the convolution as if this were an image
convolved = tf.nn.conv2d(input_, filter=filter_,strides=[1, 1, stride, 1], padding="SAME")
#Remove the extra dimension, eg make the shape [batch_size,max_length,output_size]
result = tf.squeeze(convolved, axis=1)
return result
A convolutional network learns to recognize hotdogs. It doesn’t care what the hot dog is on, that the table is made of wood etc. It only cares if it saw a hotdog. (Source)
This means that given enough depth, our network could look at the entire input layer though perhaps through a haze of abstractions. Unfortunately this is where the vanishing gradient problem may rear its ugly head.
Here we have a 3X3 filter applied with a dilation of 1,2 and 3. With a dilation of 1 we have a standard convolution. With a dilation of 2 we apply the same 3X3 filter but use every second pixel.
The Encoder part of bytenet based on dilated convolutions. Notice how four layers in the effective receptive field is 16. even though the filter widths are just 3. (Source)
这里有一个英文输入:
Director Jon Favreau, who is currently working on Disney’s forthcoming Jungle Book film, told the website Hollywood Reporter: “I think times are changing.”
通过扩大的卷积给你的翻译:
Regisseur Jon Favreau, der zur Zeit an Disneys kommendem Jungle Book Film arbeitet, hat der Website Hollywood Reporter gesagt: “Ich denke, die Zeiten andern sich”.