Move the name of the module
This commit is contained in:
parent
db661550e5
commit
9257404edd
|
@ -1,3 +1,6 @@
|
||||||
|
# Fork of gotch modified to work with my fyp project
|
||||||
|
|
||||||
|
|
||||||
# Gotch [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)[![Go.Dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/sugarme/gotch?tab=doc)
|
# Gotch [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)[![Go.Dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/sugarme/gotch?tab=doc)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package gotch
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
lib "github.com/sugarme/gotch/libtch"
|
lib "git.andr3h3nriqu3s.com/andr3/gotch/libtch"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Device struct {
|
type Device struct {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DataLoader combines a dataset and a sampler and provides
|
// DataLoader combines a dataset and a sampler and provides
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/dutil"
|
"git.andr3h3nriqu3s.com/andr3/gotch/dutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewDataLoader(t *testing.T) {
|
func TestNewDataLoader(t *testing.T) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/dutil"
|
"git.andr3h3nriqu3s.com/andr3/gotch/dutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewSliceDataset(t *testing.T) {
|
func TestNewSliceDataset(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package dutil_test
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/dutil"
|
"git.andr3h3nriqu3s.com/andr3/gotch/dutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewKFold(t *testing.T) {
|
func TestNewKFold(t *testing.T) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/dutil"
|
"git.andr3h3nriqu3s.com/andr3/gotch/dutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSequentialSampler(t *testing.T) {
|
func TestSequentialSampler(t *testing.T) {
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
"github.com/sugarme/gotch/vision/aug"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision/aug"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -12,10 +12,10 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
)
|
)
|
||||||
|
|
||||||
func convBn(p *nn.Path, cIn, cOut int64) *nn.SequentialT {
|
func convBn(p *nn.Path, cIn, cOut int64) *nn.SequentialT {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
var device string
|
var device string
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -9,9 +9,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -7,10 +7,10 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -7,10 +7,10 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -3,9 +3,9 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -10,10 +10,10 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/pickle"
|
"git.andr3h3nriqu3s.com/andr3/gotch/pickle"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -10,10 +10,10 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -9,10 +9,10 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -17,9 +17,9 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -9,9 +9,9 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Block struct {
|
type Block struct {
|
||||||
|
|
|
@ -15,8 +15,8 @@ import (
|
||||||
"golang.org/x/image/draw"
|
"golang.org/x/image/draw"
|
||||||
"golang.org/x/image/font"
|
"golang.org/x/image/font"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/example/yolo/freetype"
|
"git.andr3h3nriqu3s.com/andr3/gotch/example/yolo/freetype"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -8,10 +8,10 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module github.com/sugarme/gotch
|
module git.andr3h3nriqu3s.com/andr3/gotch
|
||||||
|
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
float16 "github.com/sugarme/gotch/half"
|
float16 "git.andr3h3nriqu3s.com/andr3/gotch/half"
|
||||||
)
|
)
|
||||||
|
|
||||||
// prevent compiler optimizing out code by assigning to these
|
// prevent compiler optimizing out code by assigning to these
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
float16 "github.com/sugarme/gotch/half"
|
float16 "git.andr3h3nriqu3s.com/andr3/gotch/half"
|
||||||
)
|
)
|
||||||
|
|
||||||
// wantF32toF16bits is a tiny subset of expected values
|
// wantF32toF16bits is a tiny subset of expected values
|
||||||
|
|
|
@ -5,7 +5,7 @@ package nn
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Batch-normalization config.
|
// Batch-normalization config.
|
||||||
|
|
|
@ -5,7 +5,7 @@ package nn
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConvTranspose1DConfig struct {
|
type ConvTranspose1DConfig struct {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Conv1DConfig:
|
// Conv1DConfig:
|
||||||
|
|
|
@ -3,7 +3,7 @@ package nn
|
||||||
// Layers defined by closure
|
// Layers defined by closure
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Func struct {
|
type Func struct {
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Init interface {
|
type Init interface {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Test whether InitTensor() can cause memory blow-up due to accumulate gradient.
|
// Test whether InitTensor() can cause memory blow-up due to accumulate gradient.
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TrainableCModule is a trainable version of JIT Pytorch module
|
// TrainableCModule is a trainable version of JIT Pytorch module
|
||||||
|
|
|
@ -2,7 +2,7 @@ package nn
|
||||||
|
|
||||||
// A layer-normalization layer.
|
// A layer-normalization layer.
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Layer-normalization config.
|
// Layer-normalization config.
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LinearConfig is a configuration for a linear layer
|
// LinearConfig is a configuration for a linear layer
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package nn
|
package nn
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
type lossFnOptions struct {
|
type lossFnOptions struct {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Optimizer is a struct object to run gradient descent.
|
// Optimizer is a struct object to run gradient descent.
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestOptimizer(t *testing.T) {
|
func TestOptimizer(t *testing.T) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package nn
|
package nn
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Dropout:
|
// Dropout:
|
||||||
|
|
|
@ -3,8 +3,8 @@ package nn
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
type State interface{}
|
type State interface{}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func gruTest(rnnConfig *nn.RNNConfig, t *testing.T) {
|
func gruTest(rnnConfig *nn.RNNConfig, t *testing.T) {
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLambdaLR(t *testing.T) {
|
func TestLambdaLR(t *testing.T) {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package nn
|
||||||
// A sequential layer used to chain multiple layers and closures.
|
// A sequential layer used to chain multiple layers and closures.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Sequential is a layer (container) that combines multiple other layers.
|
// Sequential is a layer (container) that combines multiple other layers.
|
||||||
|
|
|
@ -3,7 +3,7 @@ package nn
|
||||||
// Sparse layers
|
// Sparse layers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Configuration option for an embedding layer.
|
// Configuration option for an embedding layer.
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func embeddingTest(embeddingConfig *nn.EmbeddingConfig, t *testing.T) {
|
func embeddingTest(embeddingConfig *nn.EmbeddingConfig, t *testing.T) {
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SEP is a separator to separate path elements in the tensor names.
|
// SEP is a separator to separate path elements in the tensor names.
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestVarStoreEntry(t *testing.T) {
|
func TestVarStoreEntry(t *testing.T) {
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/pickle"
|
"git.andr3h3nriqu3s.com/andr3/gotch/pickle"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ExampleLoadInfo() {
|
func ExampleLoadInfo() {
|
||||||
|
|
|
@ -20,9 +20,9 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
const hexMagicNumber = "1950a86a20f9469cfc6c"
|
const hexMagicNumber = "1950a86a20f9469cfc6c"
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/half"
|
"git.andr3h3nriqu3s.com/andr3/gotch/half"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This file implements Pytorch storage data types.
|
// This file implements Pytorch storage data types.
|
||||||
|
|
|
@ -3,8 +3,8 @@ package ts_test
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ExampleTensor_MustArange() {
|
func ExampleTensor_MustArange() {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package ts_test
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GOMAXPROCS=8 go test -bench=BenchmarkConv2d -benchtime=100x -run=^a | tee op-conv-bench.txt
|
// GOMAXPROCS=8 go test -bench=BenchmarkConv2d -benchtime=100x -run=^a | tee op-conv-bench.txt
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Iter2 is an iterator over a pair of tensors which have the same first dimension
|
// Iter2 is an iterator over a pair of tensors which have the same first dimension
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTextData_NewTextData(t *testing.T) {
|
func TestTextData_NewTextData(t *testing.T) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
lib "github.com/sugarme/gotch/libtch"
|
lib "git.andr3h3nriqu3s.com/andr3/gotch/libtch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ptrToString check C pointer for null. If not null, get value
|
// ptrToString check C pointer for null. If not null, get value
|
||||||
|
|
|
@ -5,7 +5,7 @@ import "C"
|
||||||
import (
|
import (
|
||||||
// "unsafe"
|
// "unsafe"
|
||||||
|
|
||||||
lib "github.com/sugarme/gotch/libtch"
|
lib "git.andr3h3nriqu3s.com/andr3/gotch/libtch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LoadHwc returns a tensor of shape [height, width, channels] on success.
|
// LoadHwc returns a tensor of shape [height, width, channels] on success.
|
||||||
|
|
|
@ -66,7 +66,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NewAxis struct{}
|
type NewAxis struct{}
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIntegerIndex(t *testing.T) {
|
func TestIntegerIndex(t *testing.T) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Iterator interface {
|
type Iterator interface {
|
||||||
|
|
|
@ -14,8 +14,8 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
lib "github.com/sugarme/gotch/libtch"
|
lib "git.andr3h3nriqu3s.com/andr3/gotch/libtch"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CIValue struct {
|
type CIValue struct {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func roundTrip(v interface{}, t *testing.T) {
|
func roundTrip(v interface{}, t *testing.T) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package ts
|
||||||
import(
|
import(
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNpyHeaderParse(t *testing.T) {
|
func TestNpyHeaderParse(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package ts
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
lib "github.com/sugarme/gotch/libtch"
|
lib "git.andr3h3nriqu3s.com/andr3/gotch/libtch"
|
||||||
)
|
)
|
||||||
|
|
||||||
type COptimizer struct {
|
type COptimizer struct {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package ts_test
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ExampleTensor_Split(t *testing.T) {
|
func ExampleTensor_Split(t *testing.T) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
lib "github.com/sugarme/gotch/libtch"
|
lib "git.andr3h3nriqu3s.com/andr3/gotch/libtch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NOTE. This is a temporarily patched to make it run.
|
// NOTE. This is a temporarily patched to make it run.
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (ts *Tensor) ValueGo() interface{} {
|
func (ts *Tensor) ValueGo() interface{} {
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTensor_Format(t *testing.T) {
|
func TestTensor_Format(t *testing.T) {
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
lib "github.com/sugarme/gotch/libtch"
|
lib "git.andr3h3nriqu3s.com/andr3/gotch/libtch"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Scalar struct {
|
type Scalar struct {
|
||||||
|
|
|
@ -9,8 +9,8 @@ import(
|
||||||
"unsafe"
|
"unsafe"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
lib "github.com/sugarme/gotch/libtch"
|
lib "git.andr3h3nriqu3s.com/andr3/gotch/libtch"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
gotch "github.com/sugarme/gotch"
|
gotch "git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
lib "github.com/sugarme/gotch/libtch"
|
lib "git.andr3h3nriqu3s.com/andr3/gotch/libtch"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
)
|
)
|
||||||
|
|
||||||
var n int = 10
|
var n int = 10
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTensorInit(t *testing.T) {
|
func TestTensorInit(t *testing.T) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
gotch "github.com/sugarme/gotch"
|
gotch "git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// nativeEndian is a ByteOrder for local platform.
|
// nativeEndian is a ByteOrder for local platform.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package vision
|
package vision
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch/nn"
|
"git.andr3h3nriqu3s.com/andr3/gotch/nn"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AlexNet implementation
|
// AlexNet implementation
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package aug
|
package aug
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RandomAffine is transformation of the image keeping center invariant.
|
// RandomAffine is transformation of the image keeping center invariant.
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GaussianBlur struct {
|
type GaussianBlur struct {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Ref. https://github.com/pytorch/vision/blob/f1d734213af65dc06e777877d315973ba8386080/torchvision/transforms/functional_tensor.py
|
// Ref. https://github.com/pytorch/vision/blob/f1d734213af65dc06e777877d315973ba8386080/torchvision/transforms/functional_tensor.py
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package aug
|
package aug
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RandomAutocontrast autocontrasts the pixels of the given image randomly with a given probability.
|
// RandomAutocontrast autocontrasts the pixels of the given image randomly with a given probability.
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
|
|
||||||
// "math"
|
// "math"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RandomCrop struct {
|
type RandomCrop struct {
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Randomly selects a rectangle region in an torch Tensor image and erases its pixels.
|
// Randomly selects a rectangle region in an torch Tensor image and erases its pixels.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package aug
|
package aug
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RandomEqualize equalizes the histogram of the given image randomly with a given probability.
|
// RandomEqualize equalizes the histogram of the given image randomly with a given probability.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package aug
|
package aug
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RandomHorizontalFlip horizontally flips the given image randomly with a given probability.
|
// RandomHorizontalFlip horizontally flips the given image randomly with a given probability.
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func gaussianKernel1D(ks int64, sigma float64, dtype gotch.DType, device gotch.Device) *ts.Tensor {
|
func gaussianKernel1D(ks int64, sigma float64, dtype gotch.DType, device gotch.Device) *ts.Tensor {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package aug
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GrayScale converts image to grayscale.
|
// GrayScale converts image to grayscale.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package aug
|
package aug
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RandomInvert struct {
|
type RandomInvert struct {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package aug
|
package aug
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Normalize normalizes a tensor image with mean and standard deviation.
|
// Normalize normalizes a tensor image with mean and standard deviation.
|
||||||
|
|
|
@ -3,8 +3,8 @@ package aug
|
||||||
import (
|
import (
|
||||||
// "fmt"
|
// "fmt"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RandomPerspective performs a random perspective transformation of the given image with a given probability.
|
// RandomPerspective performs a random perspective transformation of the given image with a given probability.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package aug
|
package aug
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RandomPosterize posterizes the image randomly with a given probability by reducing the
|
// RandomPosterize posterizes the image randomly with a given probability by reducing the
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/sugarme/gotch"
|
"git.andr3h3nriqu3s.com/andr3/gotch"
|
||||||
"github.com/sugarme/gotch/ts"
|
"git.andr3h3nriqu3s.com/andr3/gotch/ts"
|
||||||
"github.com/sugarme/gotch/vision"
|
"git.andr3h3nriqu3s.com/andr3/gotch/vision"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ResizeModule struct {
|
type ResizeModule struct {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user