小编phi*_*013的帖子

如何在laravel刀片上添加HTML 5类型属性?

我有刀片格式的这一行

{{ Form::text('date', null, array('class' => 'form-control', 'type' => 'Date', 'placeholder' => 'Date' )) }}
Run Code Online (Sandbox Code Playgroud)

但是当页面加载时,type属性不会被解析为'date',而是转到'text'.

如何在刀片中获得此功能?

<input class="form-control" type="date" placeholder="Date" name="date">
Run Code Online (Sandbox Code Playgroud)

php forms html5 laravel blade

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

使用Chart JS的空白PNG图像.toBase64Image()函数

我正在尝试保存使用Chart.JS图形库创建的图表副本.当我使用.toBase64Image()函数显示或保存.png图像时,我得到一个空白图像.我尝试在img标签中显示并使用PHP保存图像.save64Img是我显示/保存图像的功能.有没有人有运气使用此功能?

lineOptions = {
        scaleShowGridLines : true,
        scaleGridLineColor : "rgba(0,0,0,.05)",
        scaleGridLineWidth : 1,
        bezierCurve : false,
        pointDot : true,
        pointDotRadius : 4,
        pointDotStrokeWidth : 1,
        pointHitDetectionRadius : 20,
        datasetStroke : true,
        datasetStrokeWidth : 1,
        datasetFill : true,
        responsive: true,      
        scaleOverride : true,
        scaleSteps : 5,
        scaleStepWidth : 20,
        scaleStartValue : 0

    }

    lineChart = {
            labels : label,
            datasets : [
                {
                    label: "stat1",
                    fillColor : "rgba(128,0,0,0.2)",
                    strokeColor : "rgba(128,0,0,1)",
                    pointColor : "rgba(128,0,0,1)",
                    pointStrokeColor : "#fff",
                    pointHighlightFill : "#fff",
                    pointHighlightStroke …
Run Code Online (Sandbox Code Playgroud)

javascript php charts html5 chart.js

5
推荐指数
1
解决办法
3775
查看次数

带有 if 语句的 Keras/Tensorflow 中的自定义损失函数

我需要在 Keras 中创建一个自定义损失函数,并根据条件返回两个不同的损失值的结果。我无法让 if 语句正常运行。

我需要做类似的事情:

def custom_loss(y_true, y_pred):
    sees = tf.Session()
    const = 2
    if (sees.run(tf.keras.backend.less(y_pred, y_true))): #i.e. y_pred - y_true < 0
        return const * mean_squared_error(y_true, y_pred)
    else:
        return mean_squared_error(y_true, y_pred)
Run Code Online (Sandbox Code Playgroud)

尝试运行它时,我不断收到张量错误(见下文)。任何帮助/建议将不胜感激!

InvalidArgumentError: You must feed a value for placeholder tensor 'dense_63_target' with dtype float and shape [?,?]
 [[Node: dense_63_target = Placeholder[dtype=DT_FLOAT, shape=[?,?], _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
Run Code Online (Sandbox Code Playgroud)

python machine-learning keras tensorflow

2
推荐指数
1
解决办法
4072
查看次数