From 312b1ba042cf874c603ee3085a6e68f26f39de90 Mon Sep 17 00:00:00 2001 From: LambdaWill <574819595@qq.com> Date: Fri, 8 Sep 2017 18:37:16 +0800 Subject: [PATCH] Update tensor.md Add how to get the value of specific position in a tensor. --- doc/tensor.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/tensor.md b/doc/tensor.md index 75eaebc6b..77dbed56d 100644 --- a/doc/tensor.md +++ b/doc/tensor.md @@ -1218,6 +1218,13 @@ x[{ 1,3 }] = 1 -- sets element at (i=1,j=3) to 1 0 0 0 0 0 0 [torch.DoubleTensor of dimension 5x6] +> x[{ 1,3 }] -- returns a number + 1 + +> x[{ {1},{3} }] -- returns a tensor + 1 +[torch.DoubleTensor of dimension 1x1] + x[{ 2,{2,4} }] = 2 -- sets a slice of 3 elements to 2 > x 0 0 1 0 0 0