types

package
v0.0.0-...-280633d Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CtxWithUserID

func CtxWithUserID(ctx context.Context, userID string) context.Context

CtxWithUserID creates a new context with the given userID.

func UserIDFromCtx

func UserIDFromCtx(ctx context.Context) string

UserIDFromCtx returns the userID from the given context.

Types

type Block

type Block struct {
	ID       string    `json:"id"`
	Name     string    `json:"name"`
	Type     BlockType `json:"type"`
	Position *Position `json:"position"`

	// for IOBlock
	InitVariables string `json:"initVariables"`

	// for NetworkBlock
	RefNetwork string `json:"refNetwork"`

	// for NormalBlock + NetworkBlock
	Repeats    int        `json:"repeats"`
	Parameters Parameters `json:"parameters"`
}

Block is the block component of the network.

func NewBlock

func NewBlock(blockType BlockType, name string) *Block

NewBlock creates a new instance of Block.

type BlockType

type BlockType string

BlockType is a type of block.

const (
	InType          BlockType = "In"
	OutType         BlockType = "Out"
	NetworkType     BlockType = "Network"
	Conv2dType      BlockType = "Conv2d"
	BatchNorm2dType BlockType = "BachNorm2d"
	ReLUType        BlockType = "ReLU"
	MaxPool2dType   BlockType = "MaxPool2d"
)

Belows are the types of the block. TODO(youngteac.hong): We need to find a way to simplify types for Normal Block. It is burdensome to add a type every time we add a normal block.

type Dependencies

type Dependencies struct {
	BuiltInDeps    map[string]*Dependency `json:"built_in_deps"`
	ThirdPartyDeps map[string]*Dependency `json:"third_party_deps"`
	ProjectDeps    map[string]*Dependency `json:"project_deps"`
}

func NewDefaultDependencies

func NewDefaultDependencies() *Dependencies

NewDefaultDependencies creates a new instance of dependency map with default value.

type Dependency

type Dependency struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Alias   string `json:"alias"`
	Package string `json:"package"`
}

Dependency represents package dependency used in import statements.

type ID

type ID string

ID represents ID of entity.

func IDFromBytes

func IDFromBytes(bytes []byte) ID

IDFromBytes returns ID represented by the encoded hexadecimal string from bytes.

func (ID) Bytes

func (id ID) Bytes() []byte

Bytes returns bytes of decoded hexadecimal string representation of this ID.

func (ID) String

func (id ID) String() string

String returns a string representation of this ID.

type Link struct {
	ID   string `json:"id"`
	From string `json:"from"`
	To   string `json:"to"`
}

Link represents the connection of blocks in the diagram.

type Network

type Network struct {
	ID           string            `json:"id"`
	Name         string            `json:"name"`
	Dependencies *Dependencies     `json:"dependencies"`
	Blocks       map[string]*Block `json:"blocks"`
	Links        map[string]*Link  `json:"links"`
}

Network is data that represents a machine learning network.

func NewDefaultNetwork

func NewDefaultNetwork() *Network

NewDefaultNetwork creates a new instance of Network with the default value.

type ParameterValue

type ParameterValue interface{}

ParameterValue is a value for the parameter.

type Parameters

type Parameters map[string]ParameterValue

Parameters is the parameter value map of the block.

type Position

type Position struct {
	X int `json:"x"`
	Y int `json:"y"`
}

Position represents point on the canvas.

type Project

type Project struct {
	ID       string              `json:"id"`
	Name     string              `json:"name"`
	Networks map[string]*Network `json:"networks"`
}

Project is the project contents of Metis.

func NewProject

func NewProject(id string, name string) *Project

NewProject creates a new instance of Project with the default value.

type ProjectInfo

type ProjectInfo struct {
	ID        ID        `bson:"_id_fake"`
	Name      string    `bson:"name"`
	Owner     string    `bson:"owner"`
	Status    string    `bson:"status"`
	CreatedAt time.Time `bson:"created_at"`
	DeletedAt time.Time `bson:"deleted_at"`
}

ProjectInfo represents the metadata of the project of Metis.

type TemplateInfo

type TemplateInfo struct {
	ID        ID        `bson:"_id_fake"`
	Name      string    `bson:"name"`
	Owner     string    `bson:"owner"`
	Contents  string    `bson:"contents"`
	CreatedAt time.Time `bson:"created_at"`
}

TemplateInfo represents the template.

Jump to

Keyboard shortcuts

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