r""""See [Xu, et al. 2015](https://arxiv.org/pdf/1505.00853v2.pdf)

    Args:
        x: A tensor
        opt:
          name: A name for the operation (optional).
    
    Returns:
      A `Tensor` with the same type and shape as `x`.
504435
def sg_leaky_relu(x, opt):
    
    """
    return tf.where(tf.greater(x, 0), x, 0.01 * x, name=opt.name)
1113607
def atan(cls, x: 'TensorFluent') -> 'TensorFluent':
        '''
        '''
        return cls._unary_op(x, tf.atan2, tf.float32)
703706
def tan(cls, x: 'TensorFluent') -> 'TensorFluent':
        '''
        '''
        return cls._unary_op(x, tf.tan, tf.float32)
1302554
def reconstruct(self, t:Tensor, x:Tensor=None):
        ""
        return self[0].reconstruct(t,x) if has_arg(self[0].reconstruct, 'x') else self[0].reconstruct(t)
1043152
def minimum(x1, x2, output_shape=None, name=None):
  
  output_shape = convert_to_shape(output_shape)
  with tf.name_scope(name, default_name="minimum"):
    x1, x2 = binary_arguments_to_tensors(x1, x2)
    return MinMaxOperation(
        tf.minimum, x1, x2, output_shape=_infer_binary_broadcast_shape(
            x1.shape, x2.shape, output_shape)).outputs[0]
1266146
def get_operation_input_names(self, operation_name):
    
    for input_tensor in self._name_to_operation(operation_name).inputs:
      yield input_tensor.name
659723
def _call(self, x, out=None):
        """"""
        # Lazy import to improve `import odl` time
        import scipy.sparse

        if out is None:
            if scipy.sparse.isspmatrix(self.matrix):
                out = self.matrix.dot(x)
            else:
                dot = np.tensordot(self.matrix, x, axes=(1, self.axis))
                # New axis ends up as first, need to swap it to its place
                out = moveaxis(dot, 0, self.axis)
        else:
            if scipy.sparse.isspmatrix(self.matrix):
                # Unfortunately, there is no native in-place dot product for
                # sparse matrices
                out[:] = self.matrix.dot(x)
            elif (parse_version(np.__version__) < parse_version('1.13.0') and
                  x is out and
                  self.range.ndim == 1):
                # Workaround for bug in Numpy < 1.13 with aliased in and
                # out in np.dot
                out[:] = self.matrix.dot(x)
            elif self.range.ndim == 1:
                with writable_array(out) as out_arr:
                    self.matrix.dot(x, out=out_arr)
            else:
                # Could use einsum to have out, but it's damn slow
                # TODO: investigate speed issue
                dot = np.tensordot(self.matrix, x, axes=(1, self.axis))
                # New axis ends up as first, need to move it to its place
                out[:] = moveaxis(dot, 0, self.axis)

        return out
686898
def export_to_tf_tensor(self, x):
    
    mesh_impl = self.mesh_impl(x)
    return mesh_impl.export_to_tf_tensor(
        x, self.tensors[x].to_laid_out_tensor())
578369
def _set_shape_on_tensor(tensor, shape):
  """"""
  if shape is not None:
    try:
      tensor.set_shape(shape)
    except ValueError:
      raise ValueError("Requested shape does not match tensor's shape: %s vs %s"
                       % (shape, tensor.get_shape()))
  elif tensor.get_shape().ndims is None:
    raise ValueError('Unknown shape on tensor: %s' % tensor)
966713
def get_operator_index(self, name):
        """"""
        opdefs = yield from self.get_operator_definitions()

        name = name.lower()
        if name not in opdefs:
            return None

        return opdefs[name]["index"]
602261
def getopt ( opt )
      result = { :n => '', :t => '', }
      if opt.length > OPTION_PREFIX_LONG.length then
        if opt[0, OPTION_PREFIX_LONG.length] == OPTION_PREFIX_LONG then
          result[:n] = opt[OPTION_PREFIX_LONG.length, opt.length]
          result[:t] = OPTION_PREFIX_LONG
          return result
        end
      end
      if opt.length > OPTION_PREFIX_SHORT.length then
        if opt[0, OPTION_PREFIX_SHORT.length] == OPTION_PREFIX_SHORT then
          result[:n] = opt[OPTION_PREFIX_SHORT.length, opt.length]
          result[:t] = OPTION_PREFIX_SHORT
          return result 
        end
      end
      return result
    end
1276205
def _get_axis(self, name_or_index: AxisIdentifier) -> int:
        """"""
        # TODO: Add unit test
        if isinstance(name_or_index, int):
            if name_or_index < 0 or name_or_index >= self.ndim:
                raise ValueError("No such axis, must be from 0 to {0}".format(self.ndim-1))
            return name_or_index
        elif isinstance(name_or_index, str):
            if name_or_index not in self.axis_names:
                named_axes = [name for name in self.axis_names if name]
                raise ValueError("No axis with such name: {0}, available names: {1}. In most places, you can also use numbers."
                                   .format(name_or_index, ", ".join(named_axes)))
            return self.axis_names.index(name_or_index)
        else:
            raise TypeError("Argument of type {0} not understood, int or str expected.".format(type(name_or_index)))
56138
def filter_opt(opt):
    """"""
    return {k: GLib.Variant(*v) for k, v in opt.items() if v[1] is not None}
1054054
function opt(options, name, defaultValue){
    return options && options[name]!==undefined ? options[name] : defaultValue;
}
857178
def batch_tensor(self, name):
        
        if name in self.transition_tensors:
            return tensor_util.merge_first_two_dims(self.transition_tensors[name])
        else:
            return self.rollout_tensors[name]
120061
def export_to_tf_tensor(self, x, laid_out_x):
    
    return self.combine_slices(laid_out_x.all_slices, x.shape)
332454
def mtf_range(mesh, dim, dtype, name=None):
  
  dim = convert_to_dimension(dim)
  with tf.variable_scope(name, default_name="range"):
    if dtype == tf.bfloat16:
      # tf.range(dtype=bfloat16) gives the wrong shape.
      # TODO(noam): report the bug.
      tf_range = tf.cast(tf.range(dim.size), tf.bfloat16)
    else:
      tf_range = tf.range(dim.size, dtype=dtype)
    return import_tf_tensor(mesh, tf_range, shape=Shape([dim]))