This commit is contained in:
sugarme 2023-07-23 13:10:24 +10:00
parent 66599380d4
commit 6aa57478f5
2 changed files with 10 additions and 1 deletions

View File

@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- reworked `ts.Format()`
- Added conv2d benchmark
- Fixed #88 memory leak at `example/char-rnn`
- Added missing tensor `Stride()`
- Added missing tensor `Stride()` and `MustDataPtr()`
## [Nofix]
- ctype `long` caused compiling error in MacOS as noted on [#44]. Not working on linux box.

View File

@ -674,6 +674,15 @@ func (ts *Tensor) DataPtr() (unsafe.Pointer, error) {
return datPtr, nil
}
func (ts *Tensor) MustDataPtr() unsafe.Pointer {
p, err := ts.DataPtr()
if err != nil {
panic(err)
}
return p
}
// Defined returns true is the tensor is defined.
func (ts *Tensor) Defined() (bool, error) {
state := lib.AtDefined(ts.ctensor)