在这里给出一个示例代码,它实现了你所描述的功能:
import pandas as pd
import torch
import torch.nn as nn
# 读入数据
df = pd.read_csv("data.csv")
train_df = df.iloc[:800, :]
test_df = df.iloc[800:, :]
# 特征和标签
X_train = train_df.iloc[:, :4]
y_train = train_df.iloc[:, 4:]
X_test = test_df.iloc[:, :4]
y_test = test_df.