import matplotlib.pyplot as plt
import numpy as np

def quick_plot(tensor, name="quick_plot"):
    if hasattr(tensor, 'numpy'):
        values = tensor.cpu().detach().numpy() if hasattr(tensor, 'detach') else tensor.numpy()
    elif hasattr(tensor, 'flatten'):
        values = tensor.flatten()
    else:
        values = np.array(tensor).flatten()
    
    plt.figure(figsize=(10, 6))
    plt.plot(values, linewidth=2)
    plt.grid(True, alpha=0.3)
    plt.tight_layout()
    plt.savefig(f"debug_plots/{name}.png", dpi=300, bbox_inches='tight')

