Tag：tensorflow

Time：2021323
Give an example The variables in tensorflow are generally the parameters of the model. When the model is complex, shared variables are extremely complex. The official website gives a case. When creating a twolayer convolution filter, the corresponding variable of the filter will be created for each image input. However, we hope that all images […]

Time：2021322
Recently in the study of tensorflow builtin routine speech_ By the way, learn some basic usages of tensorflow. As a visual artifact, tensorboard is a magic weapon for model training and parameter visualization when learning tensorflow. And in the process of training, mainly used the tf.summary () can save the training process and parameter distribution […]

Time：2021223
Calculation chart In tensorflow, compute graph is used to represent compute task. Computational graph is a kind of directed graph, which is used to define the structure of computation. In fact, it is a combination of a series of functions. In the form of graph, users can build a complex operation by using some simple […]

Time：20201116
This paper describes the principle and implementation of Python linear model training through tensorflow. For your reference, the details are as follows: 1. Related concepts For example, we should abstract the distribution law of y = KX + B from the way of a linear distribution featuresIs the input variable, that is, in simple linear […]

Time：2020726
Tensorflow provides two types of splicing: tf.concat (values, axis, name ` concat ‘): stitching according to the specified existing axis tf.stack (values, axis = 0, name = stack ‘): splicing is performed according to the specified new axis t1 = [[1, 2, 3], [4, 5, 6]] t2 = [[7, 8, 9], [10, 11, 12]] tf.concat([t1, […]

Time：2020618
tf.gather And gather_ Nd collects values from params, tf.scatter_ Nd and tf.scatter_ Nd_ Update updates a quantity with updates. Strictly speaking, tf.gather_ Nd and tf.scatter_ Nd_ Update is the reverse of each other. The position of the known value, extract the value from the tensor: tf.gather , tf.gather_ Nd tf.gather Indexes each element (scalar) is […]

Time：2020612
As follows: import tensorflow as tf a=tf.constant([[[1,2,3,4],[4,5,6,7],[7,8,9,10]], [[11,12,13,14],[20,21,22,23],[15,16,17,18]]]) print(a.shape) b,c= tf.split (a, 2,0) ා parameter 1, tensor 2, number of slices obtained 3, dimension of slices assign two slices to B, C respectively print(b.shape) print(c.shape with tf.Session () as sess: view running results print(sess.run(b)) print(sess.run(c)) The output is (2, 3, 4) (1, 3, 4) (1, […]

Time：2020610
tf.slice (input_ , begin, size, name = none): extract a subset of continuous regions according to the specified subscript range tf.gather (params, indices, validate_ Indexes = none, name = none): extract a subset from axis = 0 according to the specified subscript set, which is suitable for extracting a subset of discontinuous regions Output: input […]

Time：202068
call tf.reset_ default_ Graph () resets the calculation graph When building the network to view the calculation chart, if the program is run repeatedly, it will result in redefining and error reporting. In order to debug the calculation graph repeatedly in the same thread or interactive environment (IPython / jupyter), you need to use this […]

Time：202067
Get the dimension of tensor >>> import tensorflow as tf >>> tf.__version__ ‘1.2.0rc1’ >>> x=tf.placeholder(dtype=float32,shape=[1,2,3,4]) >>> x=tf.placeholder(dtype=tf.float32,shape=[1,2,3,4]) >>> x.shape TensorShape([Dimension(1), Dimension(2), Dimension(3), Dimension(4)]) >>> x.get_shape() TensorShape([Dimension(1), Dimension(2), Dimension(3), Dimension(4)]) #Return to tuple >>> x.shape[2] Dimension(3) >>> x.get_shape()[2] Dimension(3) #Get specific dimension value >>> x.shape[2].value 3 >>> x.get_shape()[2].value 3 #You can also convert the tensorshape variable […]

Time：202066
Record the tensorflow learning process of Xiaobai, and leave some experience for Xiaobai who has the same trouble. Let’s start with the process of my mistakes and solutions. In the experiment of style transfer, we use the vgg19 network with preload weight to extract the middle layer results. Because of the improper code, the memory […]

Time：2020530
When using tensorflow to train a model, sometimes we need to rely on the verification set to determine whether the model has been fitted or whether we need to stop training. 1. The first thought is to use tf.placeholder () load different data for calculation, such as def inference(input_): “”” this is where you put […]