From 1d587fbd36b7148227dd8194220323a66a8c3c4a Mon Sep 17 00:00:00 2001 From: Philip May Date: Sat, 21 Sep 2024 09:58:49 +0200 Subject: [PATCH] Update pytorch.md --- source/machine-learning/pytorch.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/machine-learning/pytorch.md b/source/machine-learning/pytorch.md index 2c65971..98c4f67 100644 --- a/source/machine-learning/pytorch.md +++ b/source/machine-learning/pytorch.md @@ -6,3 +6,11 @@ - convert tensor to standard Python number - only works for tensors with one element - otherwise an exception is raised - implicitly moves the value to the CPU + +## shape + +Example: + +```python +batch_size, sequence_length = attention_mask.shape +```