FCRN-DepthPrediction
FCRN-DepthPrediction copied to clipboard
About the get_incoming_shape function in network.py
In network.py, the author use the code as followed to judge whether the incoming variable is a np.array, list, or tuple object
def get_incoming_shape(incoming):
""" Returns the incoming data shape """
if isinstance(incoming, tf.Tensor):
return incoming.get_shape().as_list()
elif type(incoming) in [np.array, list, tuple]:
return np.shape(incoming)
else:
raise Exception("Invalid incoming layer.")
However, np.array is a function to change a array-like object to a np.ndarray object. np.ndarray is the type name instead of np.array.
So, the correct code may be like as followed:
def get_incoming_shape(incoming):
""" Returns the incoming data shape """
if isinstance(incoming, tf.Tensor):
return incoming.get_shape().as_list()
elif type(incoming) in [np.ndarray, list, tuple]:
# elif isinstance(incoming, (np.ndarray, list, tuple)):
return np.shape(incoming)
else:
raise Exception("Invalid incoming layer.")