AurocMetricPyTorch

class AurocMetricPyTorch[source]

Metric to Calculate AuROC

Deprecated since version 0.1: AurocMetricPyTorch will be removed in next release and is deprecated in favor of trixi.logging Modules

Warning

AurocMetricPyTorch will be removed in next release

forward(outputs: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc95767c828>, targets: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc95767c198>)[source]

Actual AuROC calculation

Parameters:
Returns:

auroc value

Return type:

torch.Tensor

AccurarcyMetricPyTorch

class AccuracyMetricPyTorch[source]

Metric to Calculate Accuracy

Deprecated since version 0.1: AccuracyMetricPyTorch will be removed in next release and is deprecated in favor of trixi.logging Modules

Warning

class:AccuracyMetricPyTorch will be removed in next release

forward(outputs: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc9577591d0>, targets: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc9577599b0>)[source]

Actual accuracy calcuation

Parameters:
Returns:

accuracy value

Return type:

torch.Tensor

pytorch_batch_to_numpy

pytorch_batch_to_numpy(tensor: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc95768c5f8>)[source]

Utility Function to cast a whole PyTorch batch to numpy

Parameters:tensor (torch.Tensor) – the batch to convert
Returns:the converted batch
Return type:np.ndarray

pytorch_tensor_to_numpy

pytorch_tensor_to_numpy(tensor: <sphinx.ext.autodoc.importer._MockObject object at 0x7fc95741d240>)[source]

Utility Function to cast a single PyTorch Tensor to numpy

Parameters:tensor (torch.Tensor) – the tensor to convert
Returns:the converted tensor
Return type:np.ndarray

float_to_pytorch_tensor

float_to_pytorch_tensor(f: float)[source]

Converts a single float to a PyTorch Float-Tensor

Parameters:f (float) – float to convert
Returns:converted float
Return type:torch.Tensor

create_optims_default_pytorch

create_optims_default_pytorch(model, optim_cls, **optim_params)[source]

Function to create a optimizer dictionary (in this case only one optimizer for the whole network)

Parameters:
  • model (AbstractPyTorchNetwork) – model whose parameters should be updated by the optimizer
  • optim_cls – Class implementing an optimization algorithm
  • **optim_params – Additional keyword arguments (passed to the optimizer class
Returns:

dictionary containing all created optimizers

Return type:

dict

create_optims_gan_default_pytorch

create_optims_gan_default_pytorch(model, optim_cls, **optim_params)[source]

Function to create a optimizer dictionary (in this case two optimizers: One for the generator, one for the discriminator)

Parameters:
  • model (AbstractPyTorchNetwork) – model whose parameters should be updated by the optimizer
  • optim_cls – Class implementing an optimization algorithm
  • optim_params – Additional keyword arguments (passed to the optimizer class
Returns:

dictionary containing all created optimizers

Return type:

dict

create_optims_default_tf

create_optims_default_tf(optim_cls, **optim_params)[source]

Function to create a optimizer dictionary (in this case only one optimizer)

Parameters:
  • optim_cls – Class implementing an optimization algorithm
  • **optim_params – Additional keyword arguments (passed to the optimizer class)
Returns:

dictionary containing all created optimizers

Return type:

dict