Understanding the tensor structure #108
-
Hello everybody, type(torch_tensor), dimension(1) :: in_tensor Is it true that dimension is refered to the batch size or dimension means another thing? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hi @NicoClinco I'm guessing you're coming from python and are less familiar with Fortran? The line you quote declares an array of tensors. This is because fortran is more restrictive than python as a compiled language, so we need to do this for models that may have multiple tensor inputs. Breaking it down, the statement says: "create a vector of If you wanted to pass three different tensors to your model as inputs then you would declare it as Batch size would be part of the tensor you pass in as an element of this array. so if you had a single input to your net of length n, batch size m, you would declare this as above, and then set Does this make sense? Please ask if anything is unclear, and if you can point me at some code I'd be happy to help you get it working! Perhaps it would be clearer if we called this variable |
Beta Was this translation helpful? Give feedback.
-
Apologize for the previous question, i'm newby with torch and indeed i have
never used a network with multiple inputs.
Thank you for the quick answer.
Nicola
Il giorno sab 6 apr 2024 alle ore 19:39 jatkinson1000 <
***@***.***> ha scritto:
… Hi @NicoClinco <https://github.com/NicoClinco> I'm guessing you're coming
from python and are less familiar with Fortran? The line you quote declares
an array of tensors. This is because fortran is more restrictive than
python as a compiled language, so we need to do this for models that may
have multiple tensor inputs.
Breaking it down, the statement says: "create a vector of torch_tensor
types containing one item, and name it in_tensor."
If you wanted to pass three different tensors to your model as inputs then
you would declare it as dimension(3) etc.
Batch size would be part of the tensor you pass in as an element of this
array. so if you had a single input to your net of length n, batch size m,
you would declare this as above, and then set in_tensor(1) to be an nxm
array.
Does this make sense? Please ask if anything is unclear, and if you can
point me at some code I'd be happy to help you get it working!
Perhaps it would be clearer if we called this variable in_tensors in our
tutorials?
—
Reply to this email directly, view it on GitHub
<#108 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWTZBDLCKB2L6HJEFMCU7RTY4AXLNAVCNFSM6AAAAABF2ST6MGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TAMZQHA3TS>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi @NicoClinco Further to this discussion I have opened a pull request #110 to try and clarify some of the aspects you raised here. |
Beta Was this translation helpful? Give feedback.
Hi @NicoClinco I'm guessing you're coming from python and are less familiar with Fortran? The line you quote declares an array of tensors. This is because fortran is more restrictive than python as a compiled language, so we need to do this for models that may have multiple tensor inputs.
Breaking it down, the statement says: "create a vector of
torch_tensor
types containing one item, and name it (the vector)in_tensor
."If you wanted to pass three different tensors to your model as inputs then you would declare it as
dimension(3)
etc.Batch size would be part of the tensor you pass in as an element of this array. so if you had a single input to your net of length n, batch size m, you wou…