def bytes(var): """ Compute the bytes that a theano variable holds """ shape = known_shapes[str(var)] return prod(shape) * bytes_of_dtype(var.dtype)
def test_bytes_of_dtype(): assert bytes_of_dtype('float32') == 4