INNER CODE UNIT · Python
cost
deepchem/deepchem · contrib/tensorflow_models/__init__.py:459
def cost(self, output, labels, weights):
"""Calculate single-task training cost for a batch of examples.
Args:
output: Tensor with model outputs.
labels: Tensor with true labels.
weights: Tensor with shape batch_size containing example weights.
Returns:
A tensor with shape batch_size containing the weighted cost for each
example. For use in subclasses that want to calculate additional costs.
"""
raise NotImplementedError('Must be overridden by concrete subclass')
def get_training_op(self, graph, loss):
"""Get training op for applying gradients to variables.
Subclasses that need to do anything fancy with gradients should override