tensorflow常用函数——官方文档索引

TensorFlow.nn.

http://www.tensorfly.cn/tfdoc/api_docs/python/nn.html

Neural Network

  • Activation Functions
    • tf.nn.relu(features, name=None)
    • tf.nn.relu6(features, name=None)
    • tf.nn.softplus(features, name=None)
    • tf.nn.dropout(x, keep_prob, noise_shape=None, seed=None, name=None)
    • tf.nn.bias_add(value, bias, name=None)
    • tf.sigmoid(x, name=None)
    • tf.tanh(x, name=None)
  • Convolution
    • tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, name=None)
    • tf.nn.depthwise_conv2d(input, filter, strides, padding, name=None)
    • tf.nn.separable_conv2d(input, depthwise_filter, pointwise_filter, strides, padding, name=None)
  • Pooling
    • tf.nn.avg_pool(value, ksize, strides, padding, name=None)
    • tf.nn.max_pool(value, ksize, strides, padding, name=None)
    • tf.nn.max_pool_with_argmax(input, ksize, strides, padding, Targmax=None, name=None)
  • Normalization
    • tf.nn.l2_normalize(x, dim, epsilon=1e-12, name=None)
    • tf.nn.local_response_normalization(input, depth_radius=None, bias=None, alpha=None, beta=None, name=None)
    • tf.nn.moments(x, axes, name=None)
  • Losses
    • tf.nn.l2_loss(t, name=None)
  • Classification
    • tf.nn.sigmoid_cross_entropy_with_logits(logits, targets, name=None)
    • tf.nn.softmax(logits, name=None)
    • tf.nn.softmax_cross_entropy_with_logits(logits, labels, name=None)
  • Embeddings
    • tf.nn.embedding_lookup(params, ids, name=None)
  • Evaluation
    • tf.nn.top_k(input, k, name=None)
    • tf.nn.in_top_k(predictions, targets, k, name=None)
  • Candidate Sampling
    • Sampled Loss Functions
    • tf.nn.nce_loss(weights, biases, inputs, labels, num_sampled, num_classes, num_true=1, sampled_values=None, remove_accidental_hits=False, name='nce_loss')
    • tf.nn.sampled_softmax_loss(weights, biases, inputs, labels, num_sampled, num_classes, num_true=1, sampled_values=None, remove_accidental_hits=True, name='sampled_softmax_loss')
    • Candidate Samplers
    • tf.nn.uniform_candidate_sampler(true_classes, num_true, num_sampled, unique, range_max, seed=None, name=None)
    • tf.nn.log_uniform_candidate_sampler(true_classes, num_true, num_sampled, unique, range_max, seed=None, name=None)
    • tf.nn.learned_unigram_candidate_sampler(true_classes, num_true, num_sampled, unique, range_max, seed=None, name=None)
    • tf.nn.fixed_unigram_candidate_sampler(true_classes, num_true, num_sampled, unique, range_max, vocab_file='', distortion=0.0, num_reserved_ids=0, num_shards=1, shard=0, unigrams=[], seed=None, name=None)
    • Miscellaneous candidate sampling utilities
    • tf.nn.compute_accidental_hits(true_classes, sampled_candidates, num_true, seed=None, name=None)

Math

  • Arithmetic Operators
    • tf.add(x, y, name=None)
    • tf.sub(x, y, name=None)
    • tf.mul(x, y, name=None)
    • tf.div(x, y, name=None)
    • tf.mod(x, y, name=None)
  • Basic Math Functions
    • tf.add_n(inputs, name=None)
    • tf.abs(x, name=None)
    • tf.neg(x, name=None)
    • tf.sign(x, name=None)
    • tf.inv(x, name=None)
    • tf.square(x, name=None)
    • tf.round(x, name=None)
    • tf.sqrt(x, name=None)
    • tf.rsqrt(x, name=None)
    • tf.pow(x, y, name=None)
    • tf.exp(x, name=None)
    • tf.log(x, name=None)
    • tf.ceil(x, name=None)
    • tf.floor(x, name=None)
    • tf.maximum(x, y, name=None)
    • tf.minimum(x, y, name=None)
    • tf.cos(x, name=None)
    • tf.sin(x, name=None)
  • Matrix Math Functions
    • tf.diag(diagonal, name=None)
    • tf.transpose(a, perm=None, name='transpose')
    • tf.matmul(a, b, transpose_a=False, transpose_b=False, a_is_sparse=False, b_is_sparse=False, name=None)
    • tf.batch_matmul(x, y, adj_x=None, adj_y=None, name=None)
    • tf.matrix_determinant(input, name=None)
    • tf.batch_matrix_determinant(input, name=None)
    • tf.matrix_inverse(input, name=None)
    • tf.batch_matrix_inverse(input, name=None)
    • tf.cholesky(input, name=None)
    • tf.batch_cholesky(input, name=None)
  • Complex Number Functions
    • tf.complex(real, imag, name=None)
    • tf.complex_abs(x, name=None)
    • tf.conj(in_, name=None)
    • tf.imag(in_, name=None)
    • tf.real(in_, name=None)
  • Reduction
    • tf.reduce_sum(input_tensor, reduction_indices=None, keep_dims=False, name=None)
    • tf.reduce_prod(input_tensor, reduction_indices=None, keep_dims=False, name=None)
    • tf.reduce_min(input_tensor, reduction_indices=None, keep_dims=False, name=None)
    • tf.reduce_max(input_tensor, reduction_indices=None, keep_dims=False, name=None)
    • tf.reduce_mean(input_tensor, reduction_indices=None, keep_dims=False, name=None)
    • tf.reduce_all(input_tensor, reduction_indices=None, keep_dims=False, name=None)
    • tf.reduce_any(input_tensor, reduction_indices=None, keep_dims=False, name=None)
    • tf.accumulate_n(inputs, shape=None, tensor_dtype=None, name=None)
  • Segmentation
    • tf.segment_sum(data, segment_ids, name=None)
    • tf.segment_prod(data, segment_ids, name=None)
    • tf.segment_min(data, segment_ids, name=None)
    • tf.segment_max(data, segment_ids, name=None)
    • tf.segment_mean(data, segment_ids, name=None)
    • tf.unsorted_segment_sum(data, segment_ids, num_segments, name=None)
    • tf.sparse_segment_sum(data, indices, segment_ids, name=None)
    • tf.sparse_segment_mean(data, indices, segment_ids, name=None)
  • Sequence Comparison and Indexing
    • tf.argmin(input, dimension, name=None)
    • tf.argmax(input, dimension, name=None)
    • tf.listdiff(x, y, name=None)
    • tf.where(input, name=None)
    • tf.unique(x, name=None)
    • tf.edit_distance(hypothesis, truth, normalize=True, name='edit_distance')
    • tf.invert_permutation(x, name=None)

Training

  • Optimizers
    • class tf.train.Optimizer
    • Usage
    • Processing gradients before applying them.
    • Gating Gradients
    • Slots
    • class tf.train.GradientDescentOptimizer
    • class tf.train.AdagradOptimizer
    • class tf.train.MomentumOptimizer
    • class tf.train.AdamOptimizer
    • class tf.train.FtrlOptimizer
    • class tf.train.RMSPropOptimizer
  • Gradient Computation
    • tf.gradients(ys, xs, grad_ys=None, name='gradients', colocate_gradients_with_ops=False, gate_gradients=False, aggregation_method=None)
    • class tf.AggregationMethod
    • tf.stop_gradient(input, name=None)
  • Gradient Clipping
    • tf.clip_by_value(t, clip_value_min, clip_value_max, name=None)
    • tf.clip_by_norm(t, clip_norm, name=None)
    • tf.clip_by_average_norm(t, clip_norm, name=None)
    • tf.clip_by_global_norm(t_list, clip_norm, use_norm=None, name=None)
    • tf.global_norm(t_list, name=None)
  • Decaying the learning rate
    • tf.train.exponential_decay(learning_rate, global_step, decay_steps, decay_rate, staircase=False, name=None)
  • Moving Averages
    • class tf.train.ExponentialMovingAverage
  • Coordinator and QueueRunner
    • class tf.train.Coordinator
    • class tf.train.QueueRunner
    • tf.train.add_queue_runner(qr, collection='queue_runners')
    • tf.train.start_queue_runners(sess=None, coord=None, daemon=True, start=True, collection='queue_runners')
  • Summary Operations
    • tf.scalar_summary(tags, values, collections=None, name=None)
    • tf.image_summary(tag, tensor, max_images=None, collections=None, name=None)
    • tf.histogram_summary(tag, values, collections=None, name=None)
    • tf.nn.zero_fraction(value, name=None)
    • tf.merge_summary(inputs, collections=None, name=None)
    • tf.merge_all_summaries(key='summaries')
  • Adding Summaries to Event Files
    • class tf.train.SummaryWriter
    • tf.train.summary_iterator(path)
  • Training utilities
    • tf.train.global_step(sess, global_step_tensor)
    • tf.train.write_graph(graph_def, logdir, name, as_text=True)

Class tensorflow::Tensor

Member Summary

  • tensorflow::Tensor::Tensor()
    • Default Tensor constructor. Creates a 1-dimension, 0-element float tensor.
  • tensorflow::Tensor::Tensor(DataType type, const TensorShape &shape)
    • Creates a Tensor of the given type and shape.
  • tensorflow::Tensor::Tensor(Allocator *a, DataType type, const TensorShape &shape)
    • Creates a tensor with the input type and shape, using the allocator ato allocate the underlying buffer.
  • tensorflow::Tensor::Tensor(DataType type)
    • Creates an uninitialized Tensor of the given data type.
  • tensorflow::Tensor::Tensor(const Tensor &other)
  • tensorflow::Tensor::~Tensor()
    • Copy constructor.
  • DataType tensorflow::Tensor::dtype() const
    • Returns the data type.
  • const TensorShape& tensorflow::Tensor::shape() const
    • Returns the shape of the tensor.
  • int tensorflow::Tensor::dims() const
    • Convenience accessor for the tensor shape.
  • int64 tensorflow::Tensor::dim_size(int d) const
    • Convenience accessor for the tensor shape.
  • int64 tensorflow::Tensor::NumElements() const
    • Convenience accessor for the tensor shape.
  • bool tensorflow::Tensor::IsSameSize(const Tensor &b) const
  • bool tensorflow::Tensor::IsInitialized() const
    • Has this Tensor been initialized?
  • size_t tensorflow::Tensor::TotalBytes() const
    • Returns the estimated memory usage of this tensor.
  • Tensor& tensorflow::Tensor::operator=(const Tensor &other)
    • Assign operator. This tensor shares other’s underlying storage.
  • bool tensorflow::Tensor::CopyFrom(const Tensor &other, const TensorShape &shape) TF_MUST_USE_RESULT
    • Copy the other tensor into this tensor and reshape it.
  • Tensor tensorflow::Tensor::Slice(int64 dim0_start, int64 dim0_limit) const
    • Slice this tensor along the 1st dimension.
  • bool tensorflow::Tensor::FromProto(const TensorProto &other) TF_MUST_USE_RESULT
    • Parse other and construct the tensor.
  • bool tensorflow::Tensor::FromProto(Allocator *a, const TensorProto &other) TF_MUST_USE_RESULT
  • void tensorflow::Tensor::AsProtoField(TensorProto *proto) const
    • Fills in proto with *this tensor’s content.
  • void tensorflow::Tensor::AsProtoTensorContent(TensorProto *proto) const
  • TTypes::Vec tensorflow::Tensor::vec()
    • Return the tensor data as an Eigen::Tensor with the type and sizes of this Tensor.
  • TTypes::Matrix tensorflow::Tensor::matrix()
  • TTypes< T, NDIMS >::Tensor tensorflow::Tensor::tensor()
  • TTypes::Flat tensorflow::Tensor::flat()
    • Return the tensor data as an Eigen::Tensor of the data type and a specified shape.
  • TTypes::UnalignedFlat tensorflow::Tensor::unaligned_flat()
  • TTypes::Matrix tensorflow::Tensor::flat_inner_dims()
  • TTypes::Matrix tensorflow::Tensor::flat_outer_dims()
  • TTypes< T, NDIMS >::Tensor tensorflow::Tensor::shaped(gtl::ArraySlice< int64 > new_sizes)
  • TTypes< T, NDIMS >::UnalignedTensor tensorflow::Tensor::unaligned_shaped(gtl::ArraySlice< int64 > new_sizes)
  • TTypes< T >::Scalar tensorflow::Tensor::scalar()
    • Return the Tensor data as a TensorMap of fixed size 1: TensorMap>.
  • TTypes::ConstVec tensorflow::Tensor::vec() const
    • Const versions of all the methods above.
  • TTypes::ConstMatrix tensorflow::Tensor::matrix() const
  • TTypes< T, NDIMS >::ConstTensor tensorflow::Tensor::tensor() const
  • TTypes::ConstFlat tensorflow::Tensor::flat() const
  • TTypes::UnalignedConstFlat tensorflow::Tensor::unaligned_flat() const
  • TTypes::ConstMatrix tensorflow::Tensor::flat_inner_dims() const
  • TTypes::ConstMatrix tensorflow::Tensor::flat_outer_dims() const
  • TTypes< T, NDIMS >::ConstTensor tensorflow::Tensor::shaped(gtl::ArraySlice< int64 > new_sizes) const
  • TTypes< T, NDIMS >::UnalignedConstTensor tensorflow::Tensor::unaligned_shaped(gtl::ArraySlice< int64 > new_sizes) const
  • TTypes< T >::ConstScalar tensorflow::Tensor::scalar() const
  • string tensorflow::Tensor::SummarizeValue(int64 max_entries) const
    • Render the first max_entries values in *this into a string.
  • string tensorflow::Tensor::DebugString() const
    • A human-readable summary of the tensor suitable for debugging.
  • void tensorflow::Tensor::FillDescription(TensorDescription *description) const
  • StringPiece tensorflow::Tensor::tensor_data() const
    • Returns a StringPiece mapping the current tensor’s buffer.

Constants, Sequences, and Random Values

  • Constant Value Tensors
    • tf.zeros(shape, dtype=tf.float32, name=None)
    • tf.zeros_like(tensor, dtype=None, name=None)
    • tf.ones(shape, dtype=tf.float32, name=None)
    • tf.ones_like(tensor, dtype=None, name=None)
    • tf.fill(dims, value, name=None)
    • tf.constant(value, dtype=None, shape=None, name='Const')
  • Sequences
    • tf.linspace(start, stop, num, name=None)
    • tf.range(start, limit, delta=1, name='range')
  • Random Tensors
    • Examples:
    • tf.random_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)
    • tf.truncated_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)
    • tf.random_uniform(shape, minval=0.0, maxval=1.0, dtype=tf.float32, seed=None, name=None)
    • tf.random_shuffle(value, seed=None, name=None)
    • tf.set_random_seed(seed)

你可能感兴趣的:(python,TensorFlow)