25 |
"tensor[", String.concatWith "," (List.map Int.toString dd), "]" |
"tensor[", String.concatWith "," (List.map Int.toString dd), "]" |
26 |
] |
] |
27 |
|
|
28 |
|
fun samestring (s1 : string, s2) = (s1 = s2) |
29 |
|
val hashstring = HashString.hashString |
30 |
|
fun stringToString s = String.concat["\"", s, "\""] |
31 |
|
|
32 |
datatype rator |
datatype rator |
33 |
= Add of ty |
= Add of ty |
34 |
| Sub of ty |
| Sub of ty |
71 |
| DiffField |
| DiffField |
72 |
| Probe |
| Probe |
73 |
| Transform of ImageInfo.info |
| Transform of ImageInfo.info |
74 |
|
| Input of string |
75 |
|
| InputWithDefault of string |
76 |
|
|
77 |
fun arity (Add _) = 2 |
fun arity (Add _) = 2 |
78 |
| arity (Sub _) = 2 |
| arity (Sub _) = 2 |
105 |
| arity CeilToInt = 1 |
| arity CeilToInt = 1 |
106 |
| arity FloorToInt = 1 |
| arity FloorToInt = 1 |
107 |
| arity (Kernel _) = 0 |
| arity (Kernel _) = 0 |
108 |
| arity (LoadImage _) = 1 |
| arity (LoadImage _) = 0 |
109 |
| arity Convolve = 2 |
| arity Convolve = 2 |
110 |
| arity Inside = 2 |
| arity Inside = 2 |
111 |
| arity (Field _) = 0 |
| arity (Field _) = 0 |
115 |
| arity DiffField = 1 |
| arity DiffField = 1 |
116 |
| arity Probe = 2 |
| arity Probe = 2 |
117 |
| arity (Transform _) = 1 |
| arity (Transform _) = 1 |
118 |
|
| arity (Input _) = 0 |
119 |
|
| arity (InputWithDefault _) = 1 |
120 |
|
|
121 |
fun same (Add a, Add b) = samety(a, b) |
fun same (Add a, Add b) = samety(a, b) |
122 |
| same (Sub a, Sub b) = samety(a, b) |
| same (Sub a, Sub b) = samety(a, b) |
159 |
| same (DiffField, DiffField) = true |
| same (DiffField, DiffField) = true |
160 |
| same (Probe, Probe) = true |
| same (Probe, Probe) = true |
161 |
| same (Transform a, Transform b) = ImageInfo.same(a, b) |
| same (Transform a, Transform b) = ImageInfo.same(a, b) |
162 |
|
| same (Input a, Input b) = samestring(a, b) |
163 |
|
| same (InputWithDefault a, InputWithDefault b) = samestring(a, b) |
164 |
| same _ = false |
| same _ = false |
165 |
|
|
166 |
fun hash (Add a) = 0w3 + hashty a |
fun hash (Add a) = 0w3 + hashty a |
204 |
| hash DiffField = 0w173 |
| hash DiffField = 0w173 |
205 |
| hash Probe = 0w179 |
| hash Probe = 0w179 |
206 |
| hash (Transform a) = 0w181 + ImageInfo.hash a |
| hash (Transform a) = 0w181 + ImageInfo.hash a |
207 |
|
| hash (Input a) = 0w191 + hashstring a |
208 |
|
| hash (InputWithDefault a) = 0w193 + hashstring a |
209 |
|
|
210 |
fun toString (Add a) = concat["Add(", tyToString a, ")"] |
fun toString (Add a) = concat["Add(", tyToString a, ")"] |
211 |
| toString (Sub a) = concat["Sub(", tyToString a, ")"] |
| toString (Sub a) = concat["Sub(", tyToString a, ")"] |
248 |
| toString DiffField = "DiffField" |
| toString DiffField = "DiffField" |
249 |
| toString Probe = "Probe" |
| toString Probe = "Probe" |
250 |
| toString (Transform a) = concat["Transform(", ImageInfo.toString a, ")"] |
| toString (Transform a) = concat["Transform(", ImageInfo.toString a, ")"] |
251 |
|
| toString (Input a) = concat["Input(", stringToString a, ")"] |
252 |
|
| toString (InputWithDefault a) = concat["InputWithDefault(", stringToString a, ")"] |
253 |
|
|
254 |
end |
end |
255 |
|
|