foolbox.tensorboard

Internal module for attacks that support logging to TensorBoard

class foolbox.tensorboard.TensorBoard(logdir)

A custom TensorBoard class that accepts EagerPy tensors and that can be disabled by turned into a noop by passing logdir=False.

This makes it possible to add tensorboard logging without any if statements and without any computational overhead if it’s disabled.

Parameters

logdir (Union[typing_extensions.Literal[False], None, str]) –

close()
Return type

None

conditional_mean(tag, x, cond, step)
Parameters
  • tag (str) –

  • x (eagerpy.Tensor) –

  • cond (eagerpy.Tensor) –

  • step (int) –

Return type

None

histogram(tag, x, step, *, first=True)
Parameters
  • tag (str) –

  • x (eagerpy.Tensor) –

  • step (int) –

  • first (bool) –

Return type

None

mean(tag, x, step)
Parameters
  • tag (str) –

  • x (eagerpy.Tensor) –

  • step (int) –

Return type

None

probability(tag, x, step)
Parameters
  • tag (str) –

  • x (eagerpy.Tensor) –

  • step (int) –

Return type

None

probability_ratio(tag, x, y, step)
Parameters
  • tag (str) –

  • x (eagerpy.Tensor) –

  • y (eagerpy.Tensor) –

  • step (int) –

Return type

None

scalar(tag, x, step)
Parameters
  • tag (str) –

  • x (Union[int, float]) –

  • step (int) –

Return type

None

foolbox.tensorboard.maybenoop(f)
Parameters

f (F) –

Return type

F