-
Notifications
You must be signed in to change notification settings - Fork 747
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
how to create tensor from java/scala normal array 1d 2d 3d array , #1558
Comments
Using Tensor.create() is probably the easiest way. Are you having issues with that method? |
15.1 we not have this function , in pytorch .we could use new_tensor or full or constant ,now in javacpp we not have ,so import ant func to create some data from normal array , |
import static org.bytedeco.pytorch.global.torch.*;
Tensor data = tensor(13F, 42F, 23F, 14F, 15F, 45F);
Tensor empty = empty(5);
Tensor full = full(new long[] { 4 }, new Scalar(12)); Javacpp pytorch is a binding to C++ libtorch, not to Python pytorch. When looking for documentation or sample code, look first at libtorch documentation. |
thanks .I found this is also ok ··· |
but for 2D array Array[Array[Long]] or 3D Array Array[ Array[Array[Long]]], how to use tensor() method, I try is fault
|
Create 1D tensor and reshape |
OK, thanks, the java**dataset pass data path ,generate tensor batch could you write an example, |
HI, I want to create Tensor ,but make me confuse ,some func is not work ,in pytorch ,we create tensor very easy ,why in javacpp not easy. someone tell me use ones or some func ,but it is now work ,console all 1
my code ,but no correct ,make jvm down
The text was updated successfully, but these errors were encountered: