Exemple #1
0
SCM tf_set_attr_bool(SCM scm_description, SCM scm_name, SCM scm_value)
{
  struct tf_description_t *self = get_tf_description(scm_description);
  char *name = scm_to_locale_string(scm_name);
  TF_SetAttrBool(self->description, name, scm_is_true(scm_value));
  free(name);
  return SCM_UNDEFINED;
}
// extern void TF_SetAttrBool(TF_OperationDescription* desc, const char* attr_name,
//                            unsigned char value);
static PHP_METHOD(TensorFlow_OperationDescription, setAttrBool)
{
    zend_string *name;
    zend_bool value;

    ZEND_PARSE_PARAMETERS_START(2, 2)
        Z_PARAM_STR(name)
        Z_PARAM_BOOL(value)
    ZEND_PARSE_PARAMETERS_END();

    // this
    t_tf_operation_description_object* intern = TF_OPERATION_DESCRIPTION_P_ZV(getThis());
    t_tf_operation_description* node = intern->ptr;

    TF_SetAttrBool(node->src, name->val, value);
}