MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _check_call_args

Method _check_call_args

tensorflow/python/keras/engine/training.py:1422–1439  ·  view source on GitHub ↗

Check that `call` has only one positional arg.

(self, method_name)

Source from the content-addressed store, hash-verified

1420 callbacks=callbacks)
1421
1422 def _check_call_args(self, method_name):
1423 """Check that `call` has only one positional arg."""
1424 # Always allow first arg, regardless of arg name.
1425 fullargspec = tf_inspect.getfullargspec(self.call)
1426 if fullargspec.defaults:
1427 positional_args = fullargspec.args[:-len(fullargspec.defaults)]
1428 else:
1429 positional_args = fullargspec.args
1430 if 'training' in positional_args:
1431 positional_args.remove('training')
1432
1433 # self and first arg can be positional.
1434 if len(positional_args) > 2:
1435 extra_args = positional_args[2:]
1436 raise ValueError(
1437 'Models passed to `' + method_name + '` can only have `training` '
1438 'and the first argument in `call` as positional arguments, '
1439 'found: ' + str(extra_args) + '.')
1440
1441 def _set_optimizer(self, optimizer):
1442 """Sets self.optimizer.

Callers 8

fitMethod · 0.95
evaluateMethod · 0.95
predictMethod · 0.95
train_on_batchMethod · 0.95
test_on_batchMethod · 0.95
predict_on_batchMethod · 0.95
fit_generatorMethod · 0.95
evaluate_generatorMethod · 0.95

Calls 1

removeMethod · 0.45

Tested by 1

test_on_batchMethod · 0.76