-
Notifications
You must be signed in to change notification settings - Fork 12
does storch tensor not support tensor[2::4] set value tensor slice batch broadcast opration how to do like python pytorch style ? #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
in cpp libtorch , I see them write code like this
|
the origin python pytorch code
|
how to set
the console error
|
when I use update
console
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
HI ,
in python code , tensor slice batch broadcast opration is very easy and convient ,like this
// encoding[::, 0 :: 2] = torch.sin(position * div_term)
// encoding[::, 1 :: 2] = torch.cos(position * div_term)
but now in storch ,I can not do that to set batch value ,so how to do like this
do you know how to do ?
if I write this code like this
I think not suit pytorch
or like this
private def initializeEncodings(): Unit = {
for (pos <- 0 until config.maxSeqLen; i <- 0 until config.embeddingDim) {
val angle = pos / math.pow(10000, 2 * (i / 2) / config.embeddingDim)
encodings(pos)(i) = if (i % 2 == 0) sin(angle) else cos(angle)
}
}
thanks
The text was updated successfully, but these errors were encountered: