Closed lzmchina closed 10 months ago
IIRC, Tensor.set_data() will not copy the data, but only create a reference to it, so you need to make sure that the data from the other Tensor doesn't get deallocated.
IIRC, Tensor.set_data() will not copy the data, but only create a reference to it, so you need to make sure that the data from the other Tensor doesn't get deallocated.
So I should use copy_
api?
Have you solved the problem related to this question ? If you have, please close the issue and issue #1255.
If you haven't: it may be possible to direcly modify the named_parameters
dictionary, using erase()
and insert()
, but it's probably safer to copy the data instead with copy_()
.
In the last issue, I want to update model's parameters by using tensor's
set_data
api :https://github.com/bytedeco/javacpp-presets/issues/1255.But it always crashes:
I'm really confused!