MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TestScopeSubScope

Function TestScopeSubScope

tensorflow/go/op/scope_test.go:26–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestScopeSubScope(t *testing.T) {
27 var (
28 root = NewScope()
29 sub1 = root.SubScope("x")
30 sub2 = root.SubScope("x")
31 sub1a = sub1.SubScope("y")
32 sub2a = sub2.SubScope("y")
33 )
34 testdata := []struct {
35 scope *Scope
36 name string
37 }{
38 {root, "Const"},
39 {sub1, "x/Const"},
40 {sub1a, "x/y/Const"},
41 {sub2, "x_1/Const"},
42 {sub2a, "x_1/y/Const"},
43 }
44 for _, test := range testdata {
45 c := Const(test.scope, int64(1))
46 if err := test.scope.Err(); err != nil {
47 t.Fatalf("%q: %v", test.name, err)
48 }
49 if got := c.Op.Name(); got != test.name {
50 t.Errorf("%q: Got %q", test.name, got)
51 }
52 }
53}
54
55func TestScopeSubScopeErrors(t *testing.T) {
56 var (

Callers

nothing calls this directly

Calls 6

NewScopeFunction · 0.85
int64Function · 0.85
SubScopeMethod · 0.80
ConstFunction · 0.70
ErrMethod · 0.45
NameMethod · 0.45

Tested by

no test coverage detected