Commit 9fe0fa6d authored by Nathan Frey's avatar Nathan Frey
Browse files

Formatting

parent b1e7aad1
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -100,9 +100,7 @@ class NormalizingFlowModel(KerasModel):

  """

  def __init__(self,
               model: NormalizingFlow,
               **kwargs):
  def __init__(self, model: NormalizingFlow, **kwargs):
    """Creates a new NormalizingFlowModel.

    Parameters
@@ -147,13 +145,11 @@ class NormalizingFlowModel(KerasModel):

    self.model = model
    self.flow = model.flow  # normalizing flow

    """Initialize tf network."""
    x = self.flow.distribution.sample(self.flow.distribution.batch_shape)
    for b in reversed(self.flow.bijector.bijectors):
      x = b.forward(x)


    self.nll_loss_fn = lambda output, labels, weights: self.create_nll(output)

    super(NormalizingFlowModel, self).__init__(
@@ -178,7 +174,9 @@ class NormalizingFlowModel(KerasModel):

    """

    return Lambda(lambda x: -tf.reduce_mean(self.flow.log_prob(x, training=True)))(output)
    return Lambda(
        lambda x: -tf.reduce_mean(tf.math.add(self.flow.log_prob(x), 1e-10)))(
            output)


class NormalizingFlowLayer(object):
+2 −2
Original line number Diff line number Diff line
@@ -19,11 +19,11 @@ then
    # This is because TensorFlow mainly supports CUDA 10.1.
    cuda=cu101
    dgl_pkg=dgl-cu101
    echo "Installing DeepChem in the GPU envirionment"
    echo "Installing DeepChem in the GPU environment"
else
    cuda=cpu
    dgl_pkg=dgl
    echo "Installing DeepChem in the CPU envirionment"
    echo "Installing DeepChem in the CPU environment"
fi

# Install dependencies except PyTorch and TensorFlow