mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Fix two error messages involving Tensor.dense() (#152631)
Two error messages in the codebase instruct the user to use `Tendor.dense()`. This method doesn't exist, but `Tensor.to_dense()` does, and this is what the user should be using instead. Pull Request resolved: https://github.com/pytorch/pytorch/pull/152631 Approved by: https://github.com/jansel
This commit is contained in:
parent
220870ce9e
commit
b117a6c47b
|
|
@ -822,7 +822,7 @@ class TensorVariable(VariableTracker):
|
|||
unimplemented("Tensor.numpy(). NumPy is not available")
|
||||
if self.layout != torch.strided:
|
||||
raise TypeError(
|
||||
f"can't convert {self.layout} layout tensor to numpy. Use Tensor.dense() first"
|
||||
f"can't convert {self.layout} layout tensor to numpy. Use Tensor.to_dense() first"
|
||||
)
|
||||
from ..symbolic_convert import InstructionTranslator
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ PyObject* tensor_to_numpy(const at::Tensor& tensor, bool force /*=false*/) {
|
|||
"can't convert ",
|
||||
c10::str(tensor.layout()).c_str(),
|
||||
" layout tensor to numpy. ",
|
||||
"Use Tensor.dense() first.");
|
||||
"Use Tensor.to_dense() first.");
|
||||
|
||||
if (!force) {
|
||||
TORCH_CHECK_TYPE(
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user