is_first_layer¶
- probly.traverse_nn.is_first_layer = <ComputedVariable: A variable whose value is computed dynamically from the current state. ComputedVariable represents a read-only variable that derives its value by applying a computation function to the current state. Unlike regular variables, computed variables cannot be set directly and will raise an error if modification is attempted. Type Parameters: T: The type of the state object V: The type of the computed value Raises: OperationNotSupportedError: When attempting to set the variable's value Example: >>> def compute_total(state): ... return state.get('price') * state.get('quantity') >>> total_var = ComputedVariable(compute_total, name='total') >>> value = total_var.get(state) # Returns computed value >>> total_var.set(state, 100) # Raises OperationNotSupportedError >¶
A variable whose value is computed dynamically from the current state.
ComputedVariable represents a read-only variable that derives its value by applying a computation function to the current state. Unlike regular variables, computed variables cannot be set directly and will raise an error if modification is attempted.
- Type Parameters:
T: The type of the state object V: The type of the computed value
- Raises:
OperationNotSupportedError – When attempting to set the variable’s value
Example
>>> def compute_total(state): ... return state.get('price') * state.get('quantity') >>> total_var = ComputedVariable(compute_total, name='total') >>> value = total_var.get(state) # Returns computed value >>> total_var.set(state, 100) # Raises OperationNotSupportedError