小编Nat*_*eek的帖子

使用GLFW的VC++ LNK错误

我正在使用VC++ 2010来处理一些OpenGL.但是,它变得很痛苦.我一次又一次地收到错误代码.

这是我正在使用的代码:

// Include standard headers
#include <stdio.h>
#include <stdlib.h>


// Include GLEW
#include <GL/glew.h>

// Include GLFW
#include <GL/glfw.h>


// Include GLM
#include <glm/glm.hpp>
using namespace glm;
int main( void ){        
    // Initialise GLFW
    if( !glfwInit() ){

            fprintf( stderr, "Failed to initialize GLFW\n" );
            return -1;
    }

    glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

    // Open a window and create its OpenGL context
    if( !glfwOpenWindow( 1024, 768, 0,0,0,0, 32,0, GLFW_WINDOW ) )
    {
            fprintf( stderr, "Failed to …
Run Code Online (Sandbox Code Playgroud)

c++ linker visual-studio-2010 glfw

7
推荐指数
1
解决办法
1万
查看次数

Tensorflow渴望和Tensorboard图?

我目前正在Tensorflow中查看Eager模式,想知道是否可以提取要在Tensorboard中使用的图形。我了解Tensorflow Eager模式实际上并没有用户必须创建的图形或会话系统。但是,据我了解,有一个隐藏的东西。是否可以导出此隐藏的Graph和Session以在Tensorboard中支持可视图形视图?还是我需要将模型重做为执行的Graph / Session形式?

python machine-learning tensorflow

7
推荐指数
1
解决办法
2469
查看次数

TensorFlow:SparseSoftmaxCrossEntropyWithLogits错误?

我现在正试图按照tensorflow的入门指南进行操作,而且我正在走向一堵砖墙.我没有看到任何只支持我看到的错误,我相信我的代码不会偏离他们在网站上的内容.

码:

import tensorflow as tf;
import tensorflow.contrib.eager as tfe;

tf.enable_eager_execution();

iris_dataset_url = 'http://download.tensorflow.org/data/iris_training.csv';
iris_csv_file = tf.keras.utils.get_file('iris_dataset.csv', iris_dataset_url);

iris_dataset_tests_url = 'http://download.tensorflow.org/data/iris_test.csv';
iris_tests_csv_file = tf.keras.utils.get_file('iris_tests_dataset.csv', iris_dataset_tests_url);

def iris_data_parse_line(line):
    default_feature = [[0.0], [0.0], [0.0], [0.0], [0.0]];
    parsed_line = tf.decode_csv(line, default_feature);

    features = tf.reshape(parsed_line[:-1], shape=(4,), name="features");
    label = tf.reshape(parsed_line[-1], shape=(), name="label");

    return features, label;

def prediction_loss_diff(features, label, model):
    predicted_label = model(features);
    return tf.losses.sparse_softmax_cross_entropy(label, predicted_label);

def gradient_tune(features, targets, model):
    with tf.GradientTape() as tape:
        prediction_loss = prediction_loss_diff(features, targets, model);
    return tape.gradient(prediction_loss, model.variables);

def train_model(training_dataset, model, …
Run Code Online (Sandbox Code Playgroud)

python machine-learning tensorflow

4
推荐指数
1
解决办法
2160
查看次数

将 C++ 方法作为函数指针传递?

我创建了一个名为 InputControl 的类。我正在使用一个名为 GLFW 的库和一个函数 glfwSetKeyCallback。该函数定义为:

GLFWkeyfun glfwSetKeyCallback ( GLFWwindow * window, GLFWkeyfun cbfun )

类型定义如下:

typedef void(* GLFWkeyfun) (GLFWwindow *, int, int, int, int)

问题是我无法将我的方法转换为函数指针。我觉得我已经尝试以各种可能的方式施展它。我不确定我还需要如何强制转换此方法。是否有特定于将相对方法作为函数指针传递的内容?我的代码如下:

#pragma once
#include <GLFW/glfw3.h>
#include "config.h"

class InputControl {
public:
    void bind();
    void unbind();

private:
     void __glfw__keycallback_bind(GLFWwindow* window, int key, int scancode, int action, int mods);
};
Run Code Online (Sandbox Code Playgroud)

输入控件.cpp

void InputControl::bind() {
    glfwSetKeyCallback(__application__window, __glfw__keycallback_bind);
}

void InputControl::unbind() {

}

void InputControl::__glfw__keycallback_bind(GLFWwindow * window, int key, int scancode, int action, int mods) {
//... other code …
Run Code Online (Sandbox Code Playgroud)

c++ pointers glfw

0
推荐指数
1
解决办法
1084
查看次数