File size: 345 Bytes
e8f4897 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
def assign_tensor(tensor, val):
"""
copy val to tensor
Args:
tensor: an n-dimensional torch.Tensor
val: an n-dimensional torch.Tensor to fill the tensor with
Returns:
"""
#if isinstance(tensor, Variable):
# assign_tensor(tensor.data, val)
# return tensor
return tensor.data.copy_(val)
|