set_index -> _set_index

This commit is contained in:
Adam Paszke
2017-01-31 21:53:21 +01:00
parent 825e919eb8
commit 8f3da5b51d
4 changed files with 4 additions and 12 deletions

View File

@ -251,7 +251,6 @@ view of a storage and defines numeric operations on it.
.. automethod:: scatter_
.. automethod:: select
.. automethod:: set_
.. automethod:: set_index
.. automethod:: share_memory_
.. automethod:: short
.. automethod:: sigmoid

View File

@ -1274,13 +1274,6 @@ Args:
stride (tuple): The desired stride. Defaults to C-contiguous strides.
""")
add_docstr(torch._C.FloatTensorBase.set_index,
"""
set_index(index, value)
Alias for ``self[index] = value``
""")
add_docstr(torch._C.FloatTensorBase.sigmoid,
"""
sigmoid() -> Tensor

View File

@ -35,18 +35,18 @@ class SetItem(InplaceFunction):
self.mark_dirty(i)
if value is None:
value = self.value
i.set_index(self.index, value)
i._set_index(self.index, value)
return i
def backward(self, grad_output):
if self.value is None:
grad_input = grad_output.clone()
grad_input.set_index(self.index, 0)
grad_input._set_index(self.index, 0)
grad_value = grad_output.index(self.index).clone()
return grad_input, grad_value
else:
grad_input = grad_output.clone()
grad_input.set_index(self.index, 0)
grad_input._set_index(self.index, 0)
return grad_input

View File

@ -58,7 +58,7 @@ static PyObject * THPTensor_(storage)(THPTensor *self, PyObject *args)
]]
[[
python_name: set_index
python_name: _set_index
name: THPTensor_(setIndex)
only_register: True
]]