コード例 #1
0
def _GatherGrad(op, grad):
    """Gradient for gather op."""
    handle = op.inputs[0]
    indices = op.inputs[1]
    params_shape = gen_ev_ops.ev_shape(handle, Tkeys=indices.dtype)
    size = array_ops.expand_dims(array_ops.size(indices), 0)
    values_shape = array_ops.concat([size, params_shape[1:]], 0)
    values = array_ops.reshape(grad, values_shape)
    indices = array_ops.reshape(indices, size)
    return [ops.IndexedSlices(values, indices, params_shape), None, None]
コード例 #2
0
 def total_count(self):
     """The shape of this variable."""
     return gen_ev_ops.ev_shape(self._handle,
                                Tkey=self._ktype,
                                Tvalue=self.dtype)
コード例 #3
0
 def total_count(self):
     """The shape of this variable."""
     return gen_ev_ops.ev_shape(self._handle, Tkeys=self._invalid_key_type)