generators

package
v0.0.0-...-2fe1034 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatFloat32

func FormatFloat32(x float64) string

func FormatScalar

func FormatScalar(x backends.Value) string

Types

type Code

type Code struct {
	// contains filtered or unexported fields
}

func NewCode

func NewCode() *Code

func (*Code) Indent

func (c *Code) Indent(delta int)

func (*Code) Reset

func (c *Code) Reset()

func (*Code) String

func (c *Code) String() string

func (*Code) WriteChunk

func (c *Code) WriteChunk(chunk string)

func (*Code) WriteLine

func (c *Code) WriteLine(s string, args ...interface{})

type FloatSymbol

type FloatSymbol struct {
	backends.Float
	// contains filtered or unexported fields
}

func NewFloatSymbol

func NewFloatSymbol(s string) *FloatSymbol

func (*FloatSymbol) Init

func (x *FloatSymbol) Init(self backends.Value, s string)

func (*FloatSymbol) String

func (x *FloatSymbol) String() string

func (*FloatSymbol) Symbol

func (x *FloatSymbol) Symbol() string

type Generator

type Generator interface {
	backends.Backend
	HostChunks() []string
	DeviceChunks() []string
	StartCode()
	EndCode()
	PushCode()
	PopCode()
	GetCode() *Code
	WriteLine(s string, args ...interface{})
	WriteChunk(chunk string)
	Indent(delta int)
	EnterInit()
	ExitInit()
	AddGlobalObject(obj GlobalObject)
	BuildProlog()
	MakeIndex(name string) int
	MakeIntSymbol() *IntSymbol
	MakeFloatSymbol() *FloatSymbol
	// following methods must be overriden
	GetData(dest string, start string, stop string, x backends.Tensor) string
	GetMetricSum(x backends.Tensor, start string, stop string) string
	OutputCode(outDir string) error
	FormatBufferRef(tensor backends.Tensor, paren bool) string
}

type GeneratorBase

type GeneratorBase struct {
	backends.BackendBase
	// contains filtered or unexported fields
}

func (*GeneratorBase) AddGlobalObject

func (b *GeneratorBase) AddGlobalObject(obj GlobalObject)

func (*GeneratorBase) DeclareGlobalObjects

func (b *GeneratorBase) DeclareGlobalObjects()

func (*GeneratorBase) DeviceChunks

func (b *GeneratorBase) DeviceChunks() []string

func (*GeneratorBase) EndCode

func (b *GeneratorBase) EndCode()

func (*GeneratorBase) EnterInit

func (b *GeneratorBase) EnterInit()

func (*GeneratorBase) EnterKernel

func (b *GeneratorBase) EnterKernel()

func (*GeneratorBase) EnterProlog

func (b *GeneratorBase) EnterProlog()

func (*GeneratorBase) ExitInit

func (b *GeneratorBase) ExitInit()

func (*GeneratorBase) ExitKernel

func (b *GeneratorBase) ExitKernel()

func (*GeneratorBase) ExitProlog

func (b *GeneratorBase) ExitProlog()

func (*GeneratorBase) GetCode

func (b *GeneratorBase) GetCode() *Code

func (*GeneratorBase) HostChunks

func (b *GeneratorBase) HostChunks() []string

func (*GeneratorBase) Indent

func (b *GeneratorBase) Indent(delta int)

func (*GeneratorBase) Init

func (b *GeneratorBase) Init(
	self Generator,
	rngSeed int,
	defaultDtype base.Dtype,
	compatMode backends.CompatMode)

func (*GeneratorBase) InitializeGlobalObjects

func (b *GeneratorBase) InitializeGlobalObjects()

func (*GeneratorBase) MakeFloatSymbol

func (b *GeneratorBase) MakeFloatSymbol() *FloatSymbol

func (*GeneratorBase) MakeIndex

func (b *GeneratorBase) MakeIndex(name string) int

func (*GeneratorBase) MakeIntSymbol

func (b *GeneratorBase) MakeIntSymbol() *IntSymbol

func (*GeneratorBase) PopCode

func (b *GeneratorBase) PopCode()

func (*GeneratorBase) PushCode

func (b *GeneratorBase) PushCode()

func (*GeneratorBase) StartCode

func (b *GeneratorBase) StartCode()

func (*GeneratorBase) WriteChunk

func (b *GeneratorBase) WriteChunk(chunk string)

func (*GeneratorBase) WriteLine

func (b *GeneratorBase) WriteLine(s string, args ...interface{})

type GlobalObject

type GlobalObject interface {
	Declare()
	Initialize()
}

type IntSymbol

type IntSymbol struct {
	backends.Int
	// contains filtered or unexported fields
}

func NewIntSymbol

func NewIntSymbol(s string) *IntSymbol

func (*IntSymbol) Init

func (x *IntSymbol) Init(self backends.Value, s string)

func (*IntSymbol) String

func (x *IntSymbol) String() string

func (*IntSymbol) Symbol

func (x *IntSymbol) Symbol() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL