DeepSDFStruct.deep_sdf.nn_utils#

Functions

get_loss_function(loss_fun_spec)

Return a loss function instance for the given spec string.

Classes

ClampedL1Loss([clamp_val])

LeakyClampedL1Loss([clamp_val, leak])

L1 loss that clamps values within [-clamp_val, clamp_val], but applies a leaky linear continuation outside that range instead of hard clamping.

class DeepSDFStruct.deep_sdf.nn_utils.ClampedL1Loss(clamp_val=0.1)#

Bases: torch.nn.modules.module.Module

forward(input, target)#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class DeepSDFStruct.deep_sdf.nn_utils.LeakyClampedL1Loss(clamp_val=0.1, leak=0.01)#

Bases: torch.nn.modules.module.Module

L1 loss that clamps values within [-clamp_val, clamp_val], but applies a leaky linear continuation outside that range instead of hard clamping.

This behaves like a clamp in the center and a LeakyReLU-style slope outside. Both input and target are transformed the same way before L1.

forward(input, target)#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

DeepSDFStruct.deep_sdf.nn_utils.get_loss_function(loss_fun_spec)#

Return a loss function instance for the given spec string.

Parameters:

loss_fun_spec (str)