Skip to content

Instantly share code, notes, and snippets.

View darien-schettler's full-sized avatar

Darien Schettler darien-schettler

View GitHub Profile
@darien-schettler
darien-schettler / get_google_colab_resource_utilization
Last active March 9, 2020 17:52
Gets the Resource Utilization Statistics For Your Google Colab
def get_colab_usage(pip_install=False, import_libs=True, return_fn=True):
""" Retrieve Google Colab Resource Utilization Stats
Args:
pip_install (bool, optional): Whether to preform pip installs
import_libs (bool, optional): Whether to import libraries
return_fn (bool, optional): Whether or not to return get_usage fn
Returns:
The get_usage fn ...
@darien-schettler
darien-schettler / get_object_methods_and_docs.py
Last active March 6, 2020 14:22
Function to retrieve an objects methods & respective documentation.
def see_object_methods_and_docs(obj):
""" Function to retrieve an objects methods & respective docs
Args:
obj (object): The object instantiated from the class for
which we would like to reveal information regarding.
i.e. If the class is `Cat` and the object is `jimmy_the_cat`
than we pass `jimmy_the_cat` into this function to reveal
that the `Cat` class has the `meow` method and also the
related documentation for the `meow` method.
# version 2.1.0
import tensorflow as tf
# version 1.18.1
import numpy as np
# ######## DEFINE CUSTOM FUNCTION FOR TF LAMBDA LAYER ######## #
def resize_like(input_tensor, ref_tensor):
""" Resize an image tensor to the same size/shape as a reference image tensor