def install(h, pip, groups, save, save_dev, packages):
    """Install a pip or bower package."""
    if groups:
        groups = [text_type.strip(group) for group in groups.split(",")]
    else:
        groups = h.requirements.keys()

    if not packages:
        for group in groups:
            if group not in h.requirements:
                warning("{} not in requirements".format(group))
                continue
            install = (h.install_bower if group.startswith("bower")
                       else h.install_pip)
            for requirement in h.requirements[group]:
                install(str(requirement), save=False, save_dev=False)
    if pip:
        for package in packages:
            h.install_pip(package, save=save, save_dev=save_dev)
    else:
        for package in packages:
            h.install_bower(package, save=save, save_dev=save_dev)
def testMinimizeSparseResourceVariableCentered(self, dtype):
    with self.cached_session():
      var0 = resource_variable_ops.ResourceVariable([[1.0, 2.0]], dtype=dtype)
      x = constant_op.constant([[4.0], [5.0]], dtype=dtype)
      pred = math_ops.matmul(embedding_ops.embedding_lookup([var0], [0]), x)
      loss = pred * pred
      sgd_op = rmsprop.RMSPropOptimizer(
          learning_rate=1.0,
          decay=0.1,
          momentum=0.0,
          epsilon=1.0,
          centered=True).minimize(loss)
      variables.global_variables_initializer().run()
      # Fetch params to validate initial values
      self.assertAllCloseAccordingToType([[1.0, 2.0]], var0.eval())
      # Run 1 step of sgd
      sgd_op.run()
      # Validate updated params
      self.assertAllCloseAccordingToType(
          [[-7/3.0, -4/3.0]], var0.eval(), atol=0.01)