def proto(self): if self._argument is not None: call = pb.Call( function=self._function.proto, argument=self._argument.proto) else: call = pb.Call(function=self._function.proto) return pb.Computation( type=type_serialization.serialize_type(self.type_signature), call=call)
def create_dummy_computation_call(): function = executor_test_utils.create_dummy_empty_tensorflow_computation() value = pb.Computation(type=type_serialization.serialize_type( computation_types.NamedTupleType([])), call=pb.Call(function=function)) type_signature = computation_types.NamedTupleType([]) return value, type_signature
def create_dummy_computation_call(): """Returns a call computation and type.""" fn, fn_type = create_dummy_computation_tensorflow_constant() type_signature = fn_type.result value = pb.Computation( type=type_serialization.serialize_type(type_signature), call=pb.Call(function=fn)) return value, type_signature
def create_dummy_computation_tuple(): """Returns a tuple computation and type.""" names = ['a', 'b', 'c'] fn, fn_type = create_dummy_computation_tensorflow_constant() element_value = pb.Computation( type=type_serialization.serialize_type(fn_type), call=pb.Call(function=fn)) element_type = fn_type.result elements = [pb.Struct.Element(name=n, value=element_value) for n in names] type_signature = computation_types.StructType( (n, element_type) for n in names) value = pb.Computation( type=type_serialization.serialize_type(type_signature), struct=pb.Struct(element=elements)) return value, type_signature