These functions can be used to make custom objects that fit in the family of
existing keras types. For example, new_layer_class()
will return a class
constructor, an object that behaves like other layer functions such as
layer_dense()
. new_callback_class()
will return an object that behaves
similarly to other callback functions, like
callback_reduce_lr_on_plateau()
, and so on. All arguments with a default
NULL
value are optional methods that can be provided.
new_metric_class(classname, ..., initialize, update_state, result)new_loss_class(classname, ..., call = NULL)
new_callback_class(
classname,
...,
on_epoch_begin = NULL,
on_epoch_end = NULL,
on_train_begin = NULL,
on_train_end = NULL,
on_batch_begin = NULL,
on_batch_end = NULL,
on_predict_batch_begin = NULL,
on_predict_batch_end = NULL,
on_predict_begin = NULL,
on_predict_end = NULL,
on_test_batch_begin = NULL,
on_test_batch_end = NULL,
on_test_begin = NULL,
on_test_end = NULL,
on_train_batch_begin = NULL,
on_train_batch_end = NULL
)
new_model_class(
classname,
...,
initialize = NULL,
call = NULL,
train_step = NULL,
predict_step = NULL,
test_step = NULL,
compute_loss = NULL,
compute_metrics = NULL
)
new_layer_class(
classname,
...,
initialize = NULL,
build = NULL,
call = NULL,
get_config = NULL
)
mark_active(x)
A new class generator object that inherits from the appropriate Keras base class.
The classname as a string. Convention is for the classname to be a CamelCase version of the constructor.
Additional fields and methods for the new type.
Optional methods that can be overridden.
A function that should be converted to an active property of the class type.
mark_active()
is a decorator that can be used to indicate functions that
should become active properties of the class instances.