• Tensorflow 2.0 implements complex neural networks (multiple input multiple output NN, RESNET)


    Common ‘fusion’ operations The realization of complex neural network model is inseparable from “fusion” operation. Common fusion operations are as follows: (1) Sum, difference #Sum layers.Add(inputs) #Difference layers.Subtract(inputs) Inputs: a list of input tensors (the size of the list is at least 2). The shapes of the list must be the same to perform the […]

  • Import tensorflow: importerror: libcublas. So. 9.0 error


    Error: importerror: libcublas. So. 9.0: cannot open shared object file: no such file or directory Problem: no version of cuda9.0 was found. The main reason for this error: CUDA is not installed or CUDA version is wrong This error often occurs when installing tensorflow, but it is not mentioned in the official FAQ. If you […]

  • Tensorflow variable scope


    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 two-layer convolution filter, the corresponding variable of the filter will be created for each image input. However, we hope that all images […]

  • Tensorflow summary usage learning notes


    Recently in the study of tensorflow built-in 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 […]

  • Summary of calculation chart of tensorflow


    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 […]

  • Python through tensorflow linear model training principle and implementation method


    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 […]

  • Splicing example of tensorflow tensor


    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, […]

  • On the extraction and assignment of tensors in tensorflow


    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 […]

  • Tensorflow for slicing tensor data


    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, […]

  • In tensorflow tf.slice and tf.gather Use of slicing functions


    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 […]

  • Implementation of reset / clear calculation graph for tensorflow


    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 […]

  • Example of tensorflow getting tensor dimension


    Get the dimension of tensor >>> import tensorflow as tf >>> tf.__version__ ‘1.2.0-rc1’ >>> 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 […]