py/std: builtins; pydemo: print, tensor

This commit is contained in:
xushiwei
2024-05-18 22:30:35 +08:00
parent 08583463be
commit 7228709616
7 changed files with 425 additions and 23 deletions

11
_pydemo/print/print.go Normal file
View File

@@ -0,0 +1,11 @@
package main
import (
"github.com/goplus/llgo/py"
"github.com/goplus/llgo/py/std"
)
func main() {
x := py.Float(3.14)
std.Print(x)
}

16
_pydemo/tensor/tensor.go Normal file
View File

@@ -0,0 +1,16 @@
package main
import (
"github.com/goplus/llgo/py"
"github.com/goplus/llgo/py/std"
"github.com/goplus/llgo/py/torch"
)
func main() {
data := py.List(
py.List(1.0, 2.0),
py.List(3.0, 4.0),
)
x := torch.Tensor(data)
std.Print(x)
}