@@ -76,34 +76,6 @@ dag_class <- R6Class(
76
76
self $ tf_environment $ hybrid_data_list <- list ()
77
77
},
78
78
79
- # TF1/2 check remove on_graph
80
- # built with TF
81
- # Not sure if we need this anyore since this information will be handled
82
- # by tf_function?
83
- # execute an expression on this dag's tensorflow graph, with the correct
84
- # float type
85
- on_graph = function (expr ) {
86
- # temporarily pass float type info to options, so it can be accessed by
87
- # nodes on definition, without cluncky explicit passing
88
- old_float_type <- options()$ greta_tf_float
89
- old_batch_size <- options()$ greta_batch_size
90
-
91
- on.exit(options(
92
- greta_tf_float = old_float_type ,
93
- greta_batch_size = old_batch_size
94
- ))
95
-
96
- options(
97
- greta_tf_float = self $ tf_float ,
98
- greta_batch_size = self $ tf_environment $ batch_size
99
- )
100
-
101
- # A tf.Graph can be constructed and used directly without a tf.function,
102
- # as was required in TensorFlow 1, but this is deprecated and it is
103
- # recommended to use a tf.function instead.
104
- with(self $ tf_graph $ as_default(), expr )
105
- },
106
-
107
79
# return a list of nodes connected to those in the target node list
108
80
build_dag = function (greta_array_list ) {
109
81
target_node_list <- lapply(greta_array_list , get_node )
@@ -280,21 +252,6 @@ dag_class <- R6Class(
280
252
)
281
253
} else {
282
254
shape <- shape(NULL , length(vals ))
283
- # TF1/2 check?
284
- # this `on_graph` part below is probably not needed/wont work because it
285
- # is using placeholder and co?
286
- #
287
- # defining an empty/unknown thing
288
- # so in TF2, we might not need to define a free state, we can
289
- # define a function that returns these pieces of information
290
- # so we will need to define the function relative to the free state
291
- # and will not need to define the object
292
- # Can we just turn this into a tensor with some arbitrary value?
293
- self $ on_graph(free_state <- tf $ compat $ v1 $ placeholder(
294
- dtype = tf_float(),
295
- shape = shape
296
- ))
297
-
298
255
# TF1/2 check
299
256
# instead?
300
257
# free_state <- tensorflow::as_tensor(
@@ -320,7 +277,6 @@ dag_class <- R6Class(
320
277
lengths <- lengths(params )
321
278
322
279
if (length(lengths ) > 1 ) {
323
- # args <- self$on_graph(tf$split(free_state, lengths, axis = 1L))
324
280
args <- tf $ split(free_state , lengths , axis = 1L )
325
281
} else {
326
282
args <- list (free_state )
0 commit comments