ggt.utils ========= .. py:module:: ggt.utils Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/ggt/utils/data_utils/index /autoapi/ggt/utils/device_utils/index /autoapi/ggt/utils/model_utils/index /autoapi/ggt/utils/tensor_utils/index Functions --------- .. autoapisummary:: ggt.utils.discover_devices ggt.utils.tensor_to_numpy ggt.utils.arsinh_normalize ggt.utils.load_tensor ggt.utils.standardize_labels ggt.utils.metric_output_transform_al_loss ggt.utils.metric_output_transform_al_cov_loss ggt.utils.load_cat ggt.utils.get_output_shape ggt.utils.enable_dropout ggt.utils.specify_dropout_rate Package Contents ---------------- .. py:function:: discover_devices() Check for available devices. .. py:function:: tensor_to_numpy(x) Convert a torch tensor to NumPy for plotting. .. py:function:: arsinh_normalize(X) Normalize a Torch tensor with arsinh. .. py:function:: load_tensor(filename, tensors_path, as_numpy=True) Load a Torch tensor from disk. .. py:function:: standardize_labels(input, data_dir, split, slug, label_col, scaling, invert=False) Standardizes data. During training, input should be the labels, and during inference, input should be the predictions. .. py:function:: metric_output_transform_al_loss(output) Transforms the output of the model, when using aleatoric loss, to a form which can be used by the ignote metric calculators .. py:function:: metric_output_transform_al_cov_loss(output) Transforms the output of the model, when using aleatoric covariance loss, to a form which can be used by the ignote metric calculators .. py:function:: load_cat(data_dir, slug, split) Loads and returns pandas dataframe .. py:function:: get_output_shape(model, image_dim) Get output shape of a PyTorch model or layer .. py:function:: enable_dropout(model) Enable random dropout during inference. From StackOverflow #63397197 .. py:function:: specify_dropout_rate(model, rate) Specify the dropout rate of all layers