layers3.Layer¶
-
class
layers3.Layer(*args, **kwargs)¶ Layer template. Implement some basic functions by override initialize, build and forward.
-
__init__(*args, **kwargs)¶ Default initialization. Not recommended to touch.
-
build(input_shape)¶ Creates the variables of the layer (optional, for subclass implementers).
This is a method that implementers of subclasses of Layer or Model can override if they need a state-creation step in-between layer instantiation and layer call.
This is typically used to create the weights of Layer subclasses.
Parameters: input_shape – Instance of TensorShape, or list of instances of TensorShape if the layer expects a list of inputs (one instance per input).
-
call(x, *args, **kwargs)¶ This is where the layer’s logic lives.
Parameters: - inputs – Input tensor, or list/tuple of input tensors.
- **kwargs – Additional keyword arguments.
Returns: A tensor or list/tuple of tensors.
-
forward(x, *args, **kwargs)¶ Alternative for call.
Parameters: x – Input tensor or numpy array. The object will be automatically converted to tensor if the input is np.array. Note that other arrays in args or kwargs will not be auto-converted.
-
initialize(*args, **kwargs)¶ Write initialization logic here.
This is a method to assign pre-defined parameters to the class.
-