diff --git a/chapter_multilayer-perceptrons/kaggle-house-price.md b/chapter_multilayer-perceptrons/kaggle-house-price.md index 1a4ce5d63..2fb889ea4 100644 --- a/chapter_multilayer-perceptrons/kaggle-house-price.md +++ b/chapter_multilayer-perceptrons/kaggle-house-price.md @@ -284,8 +284,8 @@ all_features.shape ```{.python .input} #@tab all n_train = train_data.shape[0] -train_features = d2l.tensor(all_features[:n_train].values, dtype=d2l.float32) -test_features = d2l.tensor(all_features[n_train:].values, dtype=d2l.float32) +train_features = d2l.tensor(all_features[:n_train].values.astype(np.float32), dtype=d2l.float32) +test_features = d2l.tensor(all_features[n_train:].values.astype(np.float32), dtype=d2l.float32) train_labels = d2l.tensor( train_data.SalePrice.values.reshape(-1, 1), dtype=d2l.float32) ``` diff --git a/chapter_multilayer-perceptrons/kaggle-house-price_origin.md b/chapter_multilayer-perceptrons/kaggle-house-price_origin.md index 58276499d..663bb6c65 100644 --- a/chapter_multilayer-perceptrons/kaggle-house-price_origin.md +++ b/chapter_multilayer-perceptrons/kaggle-house-price_origin.md @@ -338,8 +338,8 @@ representation for training. ```{.python .input} #@tab all n_train = train_data.shape[0] -train_features = d2l.tensor(all_features[:n_train].values, dtype=d2l.float32) -test_features = d2l.tensor(all_features[n_train:].values, dtype=d2l.float32) +train_features = d2l.tensor(all_features[:n_train].values.astype(np.float32), dtype=d2l.float32) +test_features = d2l.tensor(all_features[n_train:].values.astype(np.float32), dtype=d2l.float32) train_labels = d2l.tensor( train_data.SalePrice.values.reshape(-1, 1), dtype=d2l.float32) ```