Convert to product tensor

def astensor(array: TensorLike) -> BKTensor:
    """Convert to product tensor"""
    tensor = tf.convert_to_tensor(array, dtype=CTYPE)
    if DEVICE == 'gpu':
        tensor = tensor.gpu()  # pragma: no cover

    # size = np.prod(np.array(tensor.get_shape().as_list()))
    N = int(math.log2(size(tensor)))
    tensor = tf.reshape(tensor, ([2]*N))

    return tensor