From 30068c6b41d0d7b8bdcd86122162c479d25c9b78 Mon Sep 17 00:00:00 2001 From: sugarme Date: Sun, 23 Jul 2023 14:54:02 +1000 Subject: [PATCH] added ts --- CHANGELOG.md | 1 + ts/tensor.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index acd47c3..a57d28b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added conv2d benchmark - Fixed #88 memory leak at `example/char-rnn` - Added missing tensor `Stride()` and `MustDataPtr()`, `IsMkldnn`, `MustIsMkldnn`, `IsContiguous`, `MustIsContiguous` +- Added ts `New()` ## [Nofix] - ctype `long` caused compiling error in MacOS as noted on [#44]. Not working on linux box. diff --git a/ts/tensor.go b/ts/tensor.go index 14d8269..81a39ba 100644 --- a/ts/tensor.go +++ b/ts/tensor.go @@ -82,6 +82,11 @@ func newTensor(ctensor lib.Ctensor, nameOpt ...string) *Tensor { return x } +// New creates new tensor from C tensor. +func New(ctensor lib.Ctensor, nameOpt ...string) *Tensor { + return newTensor(ctensor, nameOpt...) +} + func CheckCMemLeak() string { tensors := []string{} lock.Lock()