tf.sparse_minimum()

tf.sparse_minimum(sp_a, sp_b, name=None) Returns the element-wise min of two SparseTensors. Assumes the two SparseTensors have the same shape, i.e., no broadcasting. Example: sp_zero = ops.SparseTensor([[0]], [0], [7]) sp_one = ops.SparseTensor([[1]], [1], [7]) res = tf.sparse_minimum(sp_zero, sp_one).eval() # "res" should be equal to SparseTensor([[0], [1]], [0, 0], [7]). Args: sp_a: a SparseTensor operand whose dtype is real, and indices lexicographically ordered. sp_b: the other SparseTe

tf.sparse_placeholder()

tf.sparse_placeholder(dtype, shape=None, name=None) Inserts a placeholder for a sparse tensor that will be always fed. Important: This sparse tensor will produce an error if evaluated. Its value must be fed using the feed_dict optional argument to Session.run(), Tensor.eval(), or Operation.run(). For example: x = tf.sparse_placeholder(tf.float32) y = tf.sparse_reduce_sum(x) with tf.Session() as sess: print(sess.run(y)) # ERROR: will fail because x was not fed. indices = np.array([[3, 2,

tf.sparse_merge()

tf.sparse_merge(sp_ids, sp_values, vocab_size, name=None, already_sorted=False) Combines a batch of feature ids and values into a single SparseTensor. The most common use case for this function occurs when feature ids and their corresponding values are stored in Example protos on disk. parse_example will return a batch of ids and a batch of values, and this function joins them into a single logical SparseTensor for use in functions such as sparse_tensor_dense_matmul, sparse_to_dense, etc. The

tf.sparse_fill_empty_rows()

tf.sparse_fill_empty_rows(sp_input, default_value, name=None) Fills empty rows in the input 2-D SparseTensor with a default value. This op adds entries with the specified default_value at index [row, 0] for any row in the input that does not already have a value. For example, suppose sp_input has shape [5, 6] and non-empty values: [0, 1]: a [0, 3]: b [2, 0]: c [3, 1]: d Rows 1 and 4 are empty, so the output will be of shape [5, 6] with values: [0, 1]: a [0, 3]: b [1, 0]: default_value [2, 0]:

tf.sparse_concat()

tf.sparse_concat(concat_dim, sp_inputs, name=None, expand_nonconcat_dim=False) Concatenates a list of SparseTensor along the specified dimension. Concatenation is with respect to the dense versions of each sparse input. It is assumed that each inputs is a SparseTensor whose elements are ordered along increasing dimension number. If expand_nonconcat_dim is False, all inputs' shapes must match, except for the concat dimension. If expand_nonconcat_dim is True, then inputs' shapes are allowd to va

tf.sparse_add()

tf.sparse_add(a, b, thresh=0) Adds two tensors, at least one of each is a SparseTensor. If one SparseTensor and one Tensor are passed in, returns a Tensor. If both arguments are SparseTensors, this returns a SparseTensor. The order of arguments does not matter. Use vanilla tf.add() for adding two dense Tensors. The indices of any input SparseTensor are assumed ordered in standard lexicographic order. If this is not the case, before this step run SparseReorder to restore index ordering. If both

tf.SparseTensorValue.__new__()

tf.SparseTensorValue.__new__(_cls, indices, values, shape) Create new instance of SparseTensorValue(indices, values, shape)

tf.SparseTensorValue.__getstate__()

tf.SparseTensorValue.__getstate__() Exclude the OrderedDict from pickling

tf.SparseTensorValue.values

tf.SparseTensorValue.values Alias for field number 1

tf.SparseTensorValue.__getnewargs__()

tf.SparseTensorValue.__getnewargs__() Return self as a plain tuple. Used by copy and pickle.